fep/aknfep/UiPlugins/AknFepUiInterface/AvkonImpl/inc/AknFepUIAvkonCtrlJapanesePredictivePane.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     1 /*
       
     2 * Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0""
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:            Predictive Candidate list
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 
       
    25 
       
    26 
       
    27 
       
    28 
       
    29 #ifndef CAKNFEPUICTRLJAPANESEPREDICTIVEPANE_H
       
    30 #define CAKNFEPUICTRLJAPANESEPREDICTIVEPANE_H
       
    31 
       
    32 // INCLUDES
       
    33 #include <aknPopup.h>
       
    34 #include "AknFepUICtrlCandidatePaneInterface.h" // MAknFepUICtrlCandidatePaneInterface
       
    35 #include "AknFepUIAvkonCtrlJapanesePredictiveListBoxModel.h"
       
    36 
       
    37 // CONSTANTS
       
    38 const TInt KJapPredictiveVisibleListRowsMax = 3;
       
    39 const TInt KJapPredictiveVisibleListRowsMin = 1;
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 class CAknFepUIManagerJapanese;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 /**
       
    47 *  CAknFepUICtrlJapanesePredictivePane class.
       
    48 *
       
    49 *  @lib AknFep.lib
       
    50 *  @since 2.6
       
    51 */
       
    52 NONSHARABLE_CLASS(CAknFepUICtrlJapanesePredictivePane) :
       
    53     public CAknPopupList,
       
    54     public MAknFepUICtrlCandidatePaneInterface
       
    55     {
       
    56     public: // Constructors and destructor
       
    57         /**
       
    58         * Two-phased constructor.
       
    59         */
       
    60         static CAknFepUICtrlJapanesePredictivePane* NewL(CAknFepUIManagerJapanese* aUiMng);
       
    61 
       
    62         /**
       
    63         * Destructor.
       
    64         */
       
    65         virtual ~CAknFepUICtrlJapanesePredictivePane();
       
    66 
       
    67     public: // New functions
       
    68         /**
       
    69         * Show Pop-up list
       
    70         * @since 2.6
       
    71         */
       
    72         void ShowWindow();
       
    73 
       
    74         /**
       
    75         * Close Pop-up list
       
    76         * @since 2.6
       
    77         */
       
    78         void ClosePredictiveList();
       
    79 
       
    80         /**
       
    81         * Specify the cursor position of a pop-up list
       
    82         * @since 2.6
       
    83         * @param aItemIndex  The index of the cursor position
       
    84         */
       
    85         void SetCurrentItemIndex(TInt aItemIndex);
       
    86 
       
    87         /**
       
    88         * Specify the display position of a pop-up list
       
    89         *
       
    90         * @since 2.6
       
    91         * @param aOffset     Offset of a window display position
       
    92         */
       
    93         void SetOffsetPosition(TPoint aOffset);
       
    94 
       
    95 public: // Functions from MAknFepUICtrlCandidatePaneInterface
       
    96         /**
       
    97         * From MAknFepUICtrlCandidatePaneInterface
       
    98         * Set position to show candidate list
       
    99         * @since 2.6
       
   100         * @param aLeftSideOfBaseLine    left side of font
       
   101         * @param aHeight                font height
       
   102         * @param aAscent                ascent position
       
   103         */
       
   104         void SetWindowPosition(const TPoint& aLeftSideOfBaseLine,
       
   105                                TInt aHeight,
       
   106                                TInt aAscent);
       
   107 
       
   108         /**
       
   109         * From MAknFepUICtrlCandidatePaneInterface
       
   110         * Show candidate list popup window
       
   111         * @since 2.6
       
   112         * @param aItems     array including each candidate string
       
   113         * @param aIndex     selecting candidate number to display first time
       
   114         *
       
   115         */
       
   116         void ShowCandidateListL(CDesCArrayFlat* aItems, TInt aIndex, TInt aResourceID);
       
   117 
       
   118         /**
       
   119         * From MAknFepUICtrlCandidatePaneInterface
       
   120         * Hide candidate list popup window
       
   121         * @since 2.6
       
   122         */
       
   123         void HideWindow();
       
   124 
       
   125         /**
       
   126         * From MAknFepUICtrlCandidatePaneInterface
       
   127         * Return a selected candidate item number currently
       
   128         * @since 2.6
       
   129         */
       
   130         TInt CurrentItemIndexOfCandidate();
       
   131 
       
   132         /**
       
   133         * From MAknFepUICtrlCandidatePaneInterface
       
   134         * Move a current item in an appointed direction
       
   135         * @since 2.6
       
   136         * @param aDirection     direction
       
   137         */
       
   138         TInt MoveItem(TAknFepUICtrlScroll aDirection);
       
   139 
       
   140     protected: // Functions from CAknPopupList
       
   141         /**
       
   142         * From CAknPopupList Set up a window layout type
       
   143         * @since 2.6
       
   144         * @param aType       Layout type
       
   145         */
       
   146         virtual void SetupWindowLayout(AknPopupLayouts::TAknPopupLayouts aType);
       
   147 
       
   148         /**
       
   149         * From CAknPopupList Set the title for the selection list
       
   150         * @since 2.6
       
   151         * @param aAccept
       
   152         */
       
   153         virtual void AttemptExitL(TBool aAccept);
       
   154 
       
   155         TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
       
   156 
       
   157     protected: // from MEikListBoxObserver
       
   158         /**
       
   159          * Handle pointer up event
       
   160          *
       
   161          * @since S60 V3.2
       
   162          * @param aListBox ListBox control
       
   163          * @param aEventType
       
   164          * @return None
       
   165          */
       
   166         virtual void HandleListBoxEventL(CEikListBox* aListBox, TListBoxEvent aEventType);
       
   167 
       
   168     private:
       
   169         /**
       
   170         * constructor.
       
   171         */
       
   172         CAknFepUICtrlJapanesePredictivePane(CAknFepUIManagerJapanese* aUiMng);
       
   173 
       
   174         /**
       
   175         * Symbian 2nd phase constructor can leave.
       
   176         */
       
   177         void ConstructL();
       
   178 
       
   179         /**
       
   180         * Create array with line information in candidate list
       
   181         * @since 2.6
       
   182         * @param aItems                     array with candidate string
       
   183         * @param aMaxDisplayWidthInPixel    maximum width in pixel
       
   184         * @param aFontId                    font id
       
   185         * @return array with line information
       
   186         */
       
   187         CPredictivePopupLineInfoArray*
       
   188         CreatePredictivePopupLineInfoArrayL(CDesCArrayFlat* aItems,
       
   189                                             const TInt aMaxDisplayWidthInPixel,
       
   190                                             const TInt aFontId);
       
   191 
       
   192         /**
       
   193         * Append to array with line information
       
   194         * @since 2.6
       
   195         * @param aLineArray     array with line information
       
   196         * @param aLineText      string to show in a line
       
   197         * @param aElementArray  array with element information
       
   198         */
       
   199         void PredictivePopupAppendLineL(CPredictivePopupLineInfoArray* aLineArray,
       
   200                                    const TDesC& aLineText,
       
   201                                    CPredictivePopupElementArray* aElementArray);
       
   202 
       
   203         /**
       
   204         * Create arrary with string to show in a line
       
   205         * @since 2.6
       
   206         * @param aLineArray     arrary with line information
       
   207         * @return   string array
       
   208         */
       
   209         CDesCArrayFlat* CreateListTextArrayL(
       
   210                                       CPredictivePopupLineInfoArray* aLineArray);
       
   211 
       
   212         /**
       
   213         * The handler function for size change
       
   214         * @since 2.6
       
   215         * @param aDef                    layout information of popup-window
       
   216         * @param aHeading                heading pane object
       
   217         * @param aListBox                listbox object
       
   218         * @param aWindowOwningControl    Owner control
       
   219         */
       
   220         void HandleSizeChanged(TAknPopupWindowLayoutDef& aDef,
       
   221                                CAknPopupHeadingPane* aHeading,
       
   222                                CEikListBox* aListBox,
       
   223                                CCoeControl* aWindowOwningControl
       
   224                                );
       
   225 
       
   226         /**
       
   227         * The handler function for Draw
       
   228         * @since 2.6
       
   229         * @param aEikEnv         EikEnv
       
   230         * @param aGc             Gc
       
   231         * @param aDef            layout information of popup-window
       
   232         * @param aListBox        Listbox object
       
   233         * @param aHeadingOrNull  Heading Pane object
       
   234         */
       
   235         static void HandleDraw(CEikonEnv* aEikEnv,
       
   236                    CWindowGc& aGc,
       
   237                    const TAknPopupWindowLayoutDef& aDef,
       
   238                    CEikListBox* aListBox,
       
   239                    CAknPopupHeadingPane* aHeadingOrNull);
       
   240 
       
   241         /**
       
   242         * Set up the information on a pop-up window
       
   243         * @since 2.6
       
   244         * @param aDef        layout information of popup-window
       
   245         * @param aRect       rect
       
   246         * @param num         total cantidate number
       
   247         */
       
   248         void CalcPopupMenuWindow(TAknPopupWindowLayoutDef& aDef,
       
   249                                  const TRect& aRect,
       
   250                                  TInt num);
       
   251 
       
   252         /**
       
   253         * Set up the information on a pop-up window
       
   254         * @since 2.6
       
   255         * @param aDef        layout information of popup-window
       
   256         * @param num         total cantidate number
       
   257         * @param heading     ETrue id with heading area, EFalse is without one.
       
   258         */
       
   259         void SetupMenuPopupWindow(TAknPopupWindowLayoutDef& aDef,
       
   260                                   TInt num,
       
   261                                   TBool heading);
       
   262 
       
   263         /**
       
   264         * The handler function for size and a location
       
   265         * @since 2.6
       
   266         * @param aDef                layout information of popup-window
       
   267         * @param aContentInsidePopup
       
   268         * @param aHeadingOrNull      Heading Pane object
       
   269         */
       
   270         static void HandleSizeAndPositionOfComponents(
       
   271                             const TAknPopupWindowLayoutDef& aDef,
       
   272                             CCoeControl* aContentInsidePopup,
       
   273                             CAknPopupHeadingPane* aHeadingOrNull);
       
   274 
       
   275         /**
       
   276         * Draws a window shadow
       
   277         * @since 2.6
       
   278         * @param aCoverRect         the area covered by the shadow
       
   279         * @param aSecondShadowRect  the area used for second shadow
       
   280         * @param aFirstShadowRect   the area of first shadow
       
   281         * @param aOutliineFrameRect the area of black outline frame
       
   282         * @param aInsideAreaRect    the area of content inside the window
       
   283         */
       
   284         static void DrawWindowShadow(CWindowGc& aGc,
       
   285                                      const TAknLayoutRect& aCoverRect,
       
   286                                      const TAknLayoutRect& aSecondShadowRect,
       
   287                                      const TAknLayoutRect& aFirstShadowRect,
       
   288                                      const TAknLayoutRect& aOutlineFrameRect,
       
   289                                      const TAknLayoutRect& aInsideAreaRect);
       
   290 
       
   291         /**
       
   292         * This function returns maximum rows to be able to display in listbox.
       
   293         * Maximum is 7 rows and  minimum is 3 columns.
       
   294         * @since 2.6
       
   295         * @param aModel listbox model object
       
   296         * @return maximum line
       
   297         */
       
   298         TInt MaximumRows(CTextListBoxModel* aModel);
       
   299 
       
   300         /**
       
   301         * Called by the framework to draw the control
       
   302         * @since 2.6
       
   303         * @param aRect  Rectangle in which the Cone framework believes drawing
       
   304         *               is needed
       
   305         */
       
   306         void Draw(const TRect& aRect) const;
       
   307 
       
   308         /**
       
   309         * Handle key events. When a key event occurs,
       
   310         * CONE calls this function for each control on the control stack,
       
   311         * until one of them returns EKeyWasConsumed to indicate that
       
   312         * it processed the key event.
       
   313         *
       
   314         * @since 2.6
       
   315         * @param aKeyEvent  The key event.
       
   316         * @param aType      The type of the event:
       
   317         *                           EEventKey, EEventKeyUp or EEventKeyDown.
       
   318         * @return           Indicates whether or not the key event was used
       
   319         *                   by this control.
       
   320         */
       
   321         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,
       
   322                                     TEventCode aType);
       
   323 
       
   324         /**
       
   325         * selecting a previous candidate
       
   326         * @since 2.6
       
   327         * @return selected candidate number
       
   328         */
       
   329         TInt MovePreviousItem();
       
   330 
       
   331         /**
       
   332         * selecting a next candidate
       
   333         * @since 2.6
       
   334         * @return selected candidate number
       
   335         */
       
   336         TInt MoveNextItem();
       
   337 
       
   338         /**
       
   339         * selecting a previous line candidate
       
   340         * @since 2.6
       
   341         * @return selected candidate number
       
   342         */
       
   343         TInt MovePreviousLineItem();
       
   344 
       
   345         /**
       
   346         * selecting a next line candidate
       
   347         * @since 2.6
       
   348         * @return selected candidate number
       
   349         */
       
   350         TInt MoveNextLineItem();
       
   351 
       
   352         /**
       
   353         * Changing the cba
       
   354         * @since 2.6
       
   355         * @param aResourceID
       
   356         */
       
   357         void UpdateCbaL(TInt aResourceID);
       
   358 
       
   359         /**
       
   360         * from CAknPopupList of MEikCommandObserver
       
   361         * @since 2.6
       
   362         * @param aCommandId aCommandId  Event Id from the soft-key
       
   363         */
       
   364         void ProcessCommandL(TInt aCommandId);
       
   365 
       
   366         /**
       
   367         * show cba
       
   368         * @since 2.6
       
   369         */
       
   370         void ShowWindowCbaL();
       
   371 
       
   372     private:    // Data
       
   373         TRect   iMainPaneRect;
       
   374         TPoint  iOffsetPosition;
       
   375         TInt    iSrcTextHeight;
       
   376 
       
   377         TInt    iMaximumRows;
       
   378         CPredictivePopupLineInfoArray* iLineInfoArray;
       
   379         CDesCArrayFlat* iListTextArray;
       
   380         CAknFepUIManagerJapanese* iUiMng;
       
   381     };
       
   382 
       
   383 #endif  // CAKNFEPUICTRLJAPANESEPREDICTIVEPANE_H
       
   384 
       
   385 // End of File