textinput/peninputarc/inc/peninputlayoutcontrolinc/peninputlayoutvkb.h
changeset 0 eb1f2e154e89
child 7 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  header file of virtual keyboard control
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_CVIRTUALKEYBOARD_H
       
    19 #define C_CVIRTUALKEYBOARD_H
       
    20 
       
    21 #include <AknsConstants.h>
       
    22 #include <AknLayout2Def.h>
       
    23 #include <AknsItemID.h>
       
    24 
       
    25 #include "peninputlayoutbutton.h"
       
    26 #include "peninputlayoutctrlgroup.h"
       
    27 class CVirtualKey;
       
    28 class CVirtualKeyCtrl;
       
    29 class CBubbleCtrl;
       
    30 class CPenInputColorIcon;
       
    31    
       
    32 #define INVALID_COLOR_GROUP -1
       
    33    
       
    34 typedef struct TVirtualKeyEventData_Tag
       
    35     {
       
    36     TKeyEvent       iKeyEvent; //key event
       
    37     TPtrC           iKeyData;  //data associated with the key
       
    38     CVirtualKey*    iKey;	   // virtual key
       
    39     } TVirtualKeyEventData;
       
    40     
       
    41 enum TVirtualKeyBmpType
       
    42     {
       
    43     EKeyBmpNormal,
       
    44     EKeyBmpNormalMask,
       
    45     EKeyBmpHighlight,
       
    46     EKeyBmpHighlightMask,
       
    47     EKeyBmpDim,
       
    48     EkeyBmpDimMask,
       
    49     EKeyBmpLastType = EkeyBmpDimMask
       
    50     };
       
    51     
       
    52 enum TVirtualKeyTextPos
       
    53     {
       
    54     EPosLeft,
       
    55     EPosRight1,
       
    56     EPosRight2,
       
    57     EPosRight3,
       
    58     EPosLast = EPosRight3
       
    59     };
       
    60     
       
    61 enum TVirtualKeyIrregularKeyType
       
    62     {
       
    63     EKeyLeftDown,
       
    64     EKeyMiddleUp,
       
    65     EKeyMiddleDown,
       
    66     EKeyRightDown,
       
    67     EKeyRightUp
       
    68     };
       
    69 
       
    70 enum TVirtualKeyIrregularKeyState
       
    71     {
       
    72     EKeyStateNormal,
       
    73     EKeyStateNormalMask,
       
    74     EKeyStatePressed,
       
    75     EKeyStatePressedMask,
       
    76     EKeyStateDimmed,
       
    77     EKeyStateDimmedMask
       
    78     };
       
    79 
       
    80 struct TVirtualKeyDrawInfo
       
    81     {
       
    82     TAknsItemID iVKDimLeftImgID;
       
    83     TAknsItemID iVKDimMiddleImgID;
       
    84     TAknsItemID iVKDimRightImgID;
       
    85 
       
    86     TAknsItemID iVKLeftImgID;
       
    87     TAknsItemID iVKMiddleImgID;
       
    88     TAknsItemID iVKRightImgID;
       
    89     
       
    90     TAknsItemID iVKPressedLeftImgID;
       
    91     TAknsItemID iVKPressedMiddleImgID;
       
    92     TAknsItemID iVKPressedRightImgID;
       
    93     
       
    94     TRgb iVKHighlightColor;
       
    95     
       
    96     TBool iSupportSkin;
       
    97     
       
    98     TVirtualKeyDrawInfo(TAknsItemID aVKDimLeftImgID,
       
    99                           TAknsItemID aVKDimMiddleImgID,
       
   100                           TAknsItemID aVKDimRightImgID,
       
   101                           
       
   102                           TAknsItemID aVKLeftImgID,
       
   103                           TAknsItemID aVKMiddleImgID,
       
   104                           TAknsItemID aVKRightImgID,
       
   105                       
       
   106                           TAknsItemID aVKPressedLeftImgID,
       
   107                           TAknsItemID aVKPressedMiddleImgID,
       
   108                           TAknsItemID aVKPressedRightImgID,
       
   109 
       
   110                           TRgb aVKHighlightColor,
       
   111                           TBool aSupportSkin = EFalse)
       
   112         {
       
   113         
       
   114         iVKDimLeftImgID = aVKDimLeftImgID;
       
   115         iVKDimMiddleImgID = aVKDimMiddleImgID;
       
   116         iVKDimRightImgID = aVKDimRightImgID;
       
   117             
       
   118         iVKLeftImgID = aVKLeftImgID;
       
   119         iVKMiddleImgID = aVKMiddleImgID;
       
   120         iVKRightImgID = aVKRightImgID;
       
   121 
       
   122         iVKPressedLeftImgID = aVKPressedLeftImgID;
       
   123         iVKPressedMiddleImgID = aVKPressedMiddleImgID;
       
   124         iVKPressedRightImgID = aVKPressedRightImgID;      
       
   125         
       
   126         iVKHighlightColor = aVKHighlightColor;
       
   127         
       
   128         iSupportSkin = aSupportSkin;
       
   129             
       
   130         };
       
   131         
       
   132     TVirtualKeyDrawInfo()
       
   133         {
       
   134         iSupportSkin = EFalse;
       
   135         };
       
   136     };    
       
   137 
       
   138 //class CVirtualKeyboard
       
   139 /**
       
   140  *  CVirtualKeyboard
       
   141  *
       
   142  *  Keyboard control, it consist of virtual keys
       
   143  *
       
   144  *  @lib feplayoutcontrol.lib  
       
   145  *  @since S60 V4.0
       
   146  */
       
   147 class CVirtualKeyboard : public CControlGroup
       
   148     {
       
   149 protected:    
       
   150     enum TVirtualKeyEvent 
       
   151     	{
       
   152     	EVirtualKeyDown,
       
   153     	EVirtualKeyUp
       
   154     	};
       
   155 public: 
       
   156     /**
       
   157      * class factory function
       
   158      *
       
   159      * @since S60 V4.0     
       
   160      * @param aRect The keyboard position relative to layout
       
   161      * @param aUiLayout The layout contains the keyboard. Owner ship not transferred.
       
   162      * @param aControlId Id for this keyboard control
       
   163      * @param aFontSpec The font used for key drawing.
       
   164      */
       
   165     IMPORT_C static CVirtualKeyboard* NewL(const TRect& aRect, 
       
   166                                            CFepUiLayout* aUiLayout,
       
   167                                            TInt aControlId,
       
   168                                            const TFontSpec& aFontSpec,
       
   169                                            TBool aIrregular = EFalse);
       
   170                                                         
       
   171     /**
       
   172      * class factory function
       
   173      *
       
   174      * @since S60 V4.0     
       
   175      * @param aRect The keyboard position relative to layout
       
   176      * @param aUiLayout The layout contains the keyboard. Owner ship not transferred.
       
   177      * @param aControlId Id for this keyboard control
       
   178      * @param aFont The font used for key drawing.
       
   179      */
       
   180     IMPORT_C static CVirtualKeyboard* NewL(const TRect& aRect, 
       
   181                             CFepUiLayout* aUiLayout,TInt aControlId,
       
   182                                            CFont* aFont,
       
   183                                            TBool aIrregular = EFalse);
       
   184 
       
   185     /**
       
   186      * Destructor
       
   187      *
       
   188      * @since S60 V4.0     
       
   189      */
       
   190     IMPORT_C virtual ~CVirtualKeyboard();
       
   191 
       
   192     /**
       
   193      * Add a key to keyboard
       
   194      *
       
   195      * @since S60 V4.0     
       
   196      * @param aKey The key to be added
       
   197      */    
       
   198     IMPORT_C virtual void AddKeyL(CVirtualKey* aKey);
       
   199 
       
   200     /**
       
   201      * Add a raw key to keyboard. Raw key works like a hardware key which
       
   202      * will generates( by simulating) raw key event when it's pressed.
       
   203      *
       
   204      * @since S60 V4.0     
       
   205      * @param aKey The key to be added
       
   206      */    
       
   207     IMPORT_C virtual void AddRawKeyL(CVirtualKey* aKey);
       
   208     
       
   209     /**
       
   210      * Create and add a key to keyboard
       
   211      *
       
   212      * @since S60 V4.0     
       
   213      * @param aCode The key code for the adding key
       
   214      * @param aScanCode The scancode for the adding key
       
   215      * @param aRect The key position. Relative to key board
       
   216      * @param aTextRect The rect for key drawing
       
   217      * @param aBaseline The baseline for char drawing
       
   218      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   219                         background. Bitmap is stored in virtual key board.
       
   220      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   221                         background. Bitmap is stored in virtual key board.
       
   222      */    
       
   223     IMPORT_C void CreateKeyL(TUint aCode, TUint aScanCode, const TRect& aRect,
       
   224                                 const TRect& aTextRect, TInt aBaseline,
       
   225                                 TInt aHighlightBmpIdx = -1,
       
   226                                 TInt aHighlightMaskBmpId = -1);
       
   227 
       
   228     /**
       
   229      * Create and add a key to keyboard
       
   230      *
       
   231      * @since S60 V4.0     
       
   232      * @param aCode The key code for the adding key
       
   233      * @param aScanCode The scancode for the adding key
       
   234      * @param aRect The key position. Relative to key board
       
   235      * @param aTextRect The rect for key drawing
       
   236      * @param aBaseline The baseline for char drawing
       
   237      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   238                         background. Bitmap is stored in virtual key board.
       
   239      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   240                         background. Bitmap is stored in virtual key board.      
       
   241      */    
       
   242     IMPORT_C void CreateKeyL(const TDesC& aCode, TUint aScanCode, 
       
   243                              const TRect& aRect,const TRect& aTextRect, 
       
   244                              TInt aBaseline, TInt aHighlightBmpIdx = -1,
       
   245                              TInt aHighlightMaskBmpId = -1);
       
   246 
       
   247     /**
       
   248      * Create and add a raw key to keyboard
       
   249      *
       
   250      * @since S60 V4.0     
       
   251      * @param aCode The key code for the adding key
       
   252      * @param aScanCode The scancode for the adding key
       
   253      * @param aRect The key position. Relative to key board
       
   254      * @param aTextRect The rect for key drawing
       
   255      * @param aBaseline The baseline for char drawing
       
   256      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   257                         background. Bitmap is stored in virtual key board.
       
   258      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   259                         background. Bitmap is stored in virtual key board.
       
   260      */    
       
   261     IMPORT_C void CreateRawKeyL(TUint aCode, TUint aScanCode, const TRect& aRect,
       
   262                                 const TRect& aTextRect, TInt aBaseline,
       
   263                                 TInt aHighlightBmpIdx = -1,
       
   264                                 TInt aHighlightMaskBmpId = -1);
       
   265 
       
   266     /**
       
   267      * Create and add a raw key to keyboard
       
   268      *
       
   269      * @since S60 V4.0     
       
   270      * @param aCode The key code for the adding key
       
   271      * @param aScanCode The scancode for the adding key
       
   272      * @param aRect The key position. Relative to key board
       
   273      * @param aTextRect The rect for key drawing
       
   274      * @param aBaseline The baseline for char drawing
       
   275      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   276                         background. Bitmap is stored in virtual key board.
       
   277      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   278                         background. Bitmap is stored in virtual key board.      
       
   279      */    
       
   280     IMPORT_C void CreateRawKeyL(const TDesC& aCode, TUint aScanCode, 
       
   281                              const TRect& aRect,const TRect& aTextRect, 
       
   282                              TInt aBaseline, TInt aHighlightBmpIdx = -1,
       
   283                              TInt aHighlightMaskBmpId = -1);
       
   284            
       
   285     IMPORT_C void CreateRawKeyL(RPointerArray<HBufC>& aUnicodesList,
       
   286                                 TInt aScanCode,
       
   287                                 const TRect& aRect);
       
   288 
       
   289     /**
       
   290      * Remove a key from keyboard. Key is not destroyed.
       
   291      *
       
   292      * @since S60 V4.0     
       
   293      * @param aKey The key to be removed
       
   294      */                                 
       
   295     IMPORT_C void RemoveKey(CVirtualKey* aKey);                    
       
   296 
       
   297     /**
       
   298      * Remove a key from keyboard. Key is not destroyed.
       
   299      *
       
   300      * @since S60 V4.0     
       
   301      * @param aIndex The key index. Index is not checked.
       
   302      */                                 
       
   303     inline void RemoveKey(TInt aIndex);                    
       
   304 
       
   305 
       
   306     /* Set the font for candidate
       
   307      *
       
   308      * @since S60 V4.0
       
   309      * @param aFontSpec the font spec to be used.
       
   310      */                                                   
       
   311     IMPORT_C void SetFont(const TFontSpec& aFontSpec);
       
   312     
       
   313     /**
       
   314      * Set font information
       
   315      *
       
   316      * @since S60 V4.0          
       
   317      * @param aFont The font info for key drawing.Ownership not transferred
       
   318      */
       
   319     IMPORT_C void SetFont(const CFont* aFont);    
       
   320     
       
   321     /**
       
   322      * Set key font color information.
       
   323      *     
       
   324      * @since S60 V4.0          
       
   325      * @param aFontColor The font color info for key drawing.
       
   326      */
       
   327     IMPORT_C void SetFontColor( const TRgb aFontColor );
       
   328     
       
   329     /**
       
   330      * Dim key
       
   331      *
       
   332      * @since S60 V4.0          
       
   333      * @param aKey The key to be dimmed
       
   334      */    
       
   335     IMPORT_C void DimKey(CVirtualKey* aKey,TBool aFlag);
       
   336     
       
   337     IMPORT_C void EnableKeyFeedback( CVirtualKey* aKey, TBool aEnable );
       
   338     
       
   339     /**
       
   340      * Set key dim bitmap
       
   341      *
       
   342      * @since S60 V4.0          
       
   343      * @param aBitmap The dim bitmap
       
   344      */
       
   345     inline void SetDimKeyBmp(CFbsBitmap* aBitmap);
       
   346 
       
   347     /**
       
   348      * Set key dim mask bitmap
       
   349      *
       
   350      * @since S60 V4.0          
       
   351      * @param aBitmap The dim mask bitmap
       
   352      */
       
   353     inline void SetDimKeyMaskBmp(CFbsBitmap* aBitmap);
       
   354     
       
   355     /**
       
   356      * Add key higilight bitmap
       
   357      * @since S60 V4.0
       
   358      * @param aBmp The key hight light bitmap. Owner ship transferred.
       
   359      */
       
   360     IMPORT_C void AddKeyHighLightBitmapL(CFbsBitmap* aBmp);
       
   361     
       
   362     /**
       
   363      * Remove highlight bitmap by index. The bitmap itself is not destroyed.
       
   364      * @since S60 V4.0
       
   365      * @param aIndex. 
       
   366      */
       
   367     IMPORT_C void RemoveKeyHighLightBitmap(TInt aIndex);    
       
   368 
       
   369     /**
       
   370      * Add key highlight mask bitmap
       
   371      * @since S60 V4.0
       
   372      * @param aBmp The key hight light mask bitmap. Owner ship transferred.
       
   373      */
       
   374     IMPORT_C void AddKeyHighLightMaskBitmapL(CFbsBitmap* aBmp);    
       
   375     
       
   376     /**
       
   377      * Remove highlight bitmap by index. The bitmap itself is not destroyed.
       
   378      * @since S60 V4.0
       
   379      * @param aIndex. 
       
   380      */
       
   381     IMPORT_C void RemoveKeyHighLightMaskBitmap(TInt aIndex);    
       
   382     
       
   383     /**
       
   384      * Set fading parameter. Key pressing effect is done by fading the key.
       
   385      * 
       
   386      * @since S60 V4.0
       
   387      * @param aBlackMap Black map fading parameter. 
       
   388      *      See CBitmapContext::SetFadingParameters for more information
       
   389      * @param aWhiteMap White map fading parameter
       
   390      */                                                                 
       
   391     inline void SetFadingParameters(TUint8 aBlackMap, TUint8 aWhiteMap);    
       
   392 
       
   393     /**
       
   394      * Return key array
       
   395      *
       
   396      * @since S60 V4.0
       
   397      * @return The key array
       
   398      */    
       
   399     inline const RPointerArray<CVirtualKey>& KeyArray();
       
   400     
       
   401     /**
       
   402      * Return highlight bmp list
       
   403      *
       
   404      * @since S60 V4.0
       
   405      * @return highlight bmp list
       
   406      */    
       
   407     inline const RPointerArray<CFbsBitmap>& KeyHighlightBmpList();
       
   408     
       
   409     /**
       
   410      * Return highlight mask bmp list
       
   411      *
       
   412      * @since S60 V4.0
       
   413      * @return highlight mask bmp list
       
   414      */        
       
   415     inline const RPointerArray<CFbsBitmap>& KeyHighlightMaskBmpList();
       
   416     
       
   417     inline void SetKeySkinId(TVirtualKeyBmpType aBmpType, TAknsItemID aSkinId);
       
   418     inline TAknsItemID KeySkinId(TVirtualKeyBmpType aBmpType);
       
   419     inline void SetTextLineLayout(TAknTextLineLayout aTextLine, TVirtualKeyTextPos aPos);
       
   420     inline TAknTextLineLayout TextLineLayout(TVirtualKeyTextPos aPos);
       
   421     inline void SetTextLineLayout(TAknTextLineLayout aTextLine);
       
   422     inline TAknTextLineLayout TextLineLayout();
       
   423     inline TBool TextLineLayoutSet(TVirtualKeyTextPos aPos);
       
   424     inline void SetDrawOpaqueBackground(TBool aNeedDraw);
       
   425     /**
       
   426      * Set keyboard text color group
       
   427      *
       
   428      * @since S60 V4.0
       
   429      * @param color group index
       
   430      */        
       
   431     inline void SetKeyTextColorGroup(TInt aColorGroup);
       
   432     inline TInt KeyTextColorGroup() const;
       
   433     //from base class CFepUiBaseCtrl    
       
   434    
       
   435     /**
       
   436      * From CFepUiBaseCtrl
       
   437      * Draw control
       
   438      *
       
   439      * @since S60 V4.0
       
   440      */                       
       
   441     IMPORT_C virtual void Draw();     
       
   442 
       
   443     IMPORT_C void SetRect(const TRect& aRect);    
       
   444     
       
   445     /**
       
   446      * Add key higilight bitmap
       
   447      * @since S60 V4.0
       
   448      * @param aBmp The key hight light bitmap. Owner ship transferred.
       
   449      */
       
   450     IMPORT_C void AddIrregularKeyBitmapL(TVirtualKeyIrregularKeyType aKeyType,
       
   451                                          TVirtualKeyIrregularKeyState aKeyState,
       
   452                                          CFbsBitmap* aBmp);
       
   453     
       
   454     /**
       
   455      * Remove highlight bitmap by index. The bitmap itself is not destroyed.
       
   456      * @since S60 V4.0
       
   457      * @param aIndex. 
       
   458      */
       
   459     IMPORT_C void RemoveIrregularKeyBitmapL(TVirtualKeyIrregularKeyType aKeyType,
       
   460                                             TVirtualKeyIrregularKeyState aKeyState);
       
   461                                             
       
   462     /**
       
   463      * Remove highlight bitmap by index. The bitmap itself is not destroyed.
       
   464      * @since S60 V4.0
       
   465      * @param aIndex. 
       
   466      */
       
   467     IMPORT_C CFbsBitmap* IrregularKeyBitmap(TVirtualKeyIrregularKeyType aKeyType,
       
   468                                             TVirtualKeyIrregularKeyState aKeyState);
       
   469                                             
       
   470                                             
       
   471                                             
       
   472     IMPORT_C TBool IsIrregularKeyBoard();
       
   473                                                                                           
       
   474     IMPORT_C void SetIrregularKeyBoard(TBool aIrregular);
       
   475      
       
   476     /**
       
   477      * Add nonirregular key bitmap
       
   478      * @since S60 V4.0
       
   479      * @param aBmp The key bitmap. Owner ship transferred.
       
   480      */
       
   481     IMPORT_C void SetNonIrregularKeyBitmapL(TVirtualKeyBmpType aBmpType, CFbsBitmap* aBmp);
       
   482     
       
   483     /**
       
   484      * Get non irregularkey bitmap by index. The bitmap itself is not destroyed.
       
   485      * @since S60 V4.0
       
   486      * @param aIndex. 
       
   487      */
       
   488     IMPORT_C CFbsBitmap* NonIrregularKeyBitmap(TVirtualKeyBmpType aBmpType);
       
   489     
       
   490     /**
       
   491      * Hide or show the bubble.
       
   492      * @param aFlag. 
       
   493      * @since S60 V4.0
       
   494      */
       
   495     IMPORT_C void ShowBubble(TBool aFlag);
       
   496     
       
   497     /**
       
   498      * Set bubble bitmap effect.
       
   499      * @since S60 V4.0
       
   500      * @param aBmpId. 
       
   501      * @param aMaskBmpId. 
       
   502      * @param aBgSkinId. 
       
   503      */
       
   504     IMPORT_C void SetBubbleBitmapParam(CFbsBitmap* aBmpId,
       
   505                                        CFbsBitmap* aMaskBmpId,
       
   506                                        TAknsItemID aBgSkinId);
       
   507 
       
   508     /**
       
   509      * Test that keep pointer down effect or not when the pointer is down and moving
       
   510      * @since S60 V4.0
       
   511      */    
       
   512     IMPORT_C TBool GowithPointerDown();    
       
   513 
       
   514     /**
       
   515      * Set keeping pointer down effect when the pointer is down and moving
       
   516      * @since S60 V4.0
       
   517      * @param aFlag. 
       
   518      */    
       
   519     IMPORT_C void SetGowithPointerDown(TBool aFlag);
       
   520         
       
   521     /**
       
   522      * Set the size of bubble
       
   523      *
       
   524      * @since S60 V4.0          
       
   525      * @param aSize The size of bubble
       
   526      */ 
       
   527     IMPORT_C void SetBubbleSize(const TSize& aSize);
       
   528 
       
   529     /**
       
   530      * Set the margin between the bottom of bubble and top of the key
       
   531      *
       
   532      * @since S60 V4.0          
       
   533      * @param aSize The size of bubble
       
   534      */ 
       
   535     IMPORT_C void SetBubbleVerticalMargin(TInt aMargin);
       
   536 
       
   537     /**
       
   538      * Set text format
       
   539      *
       
   540      * @since S60 V4.0          
       
   541      * @param aTextFormat The format of text on bubble 
       
   542      */ 
       
   543     IMPORT_C void SetTextFormat(TAknTextLineLayout aTextFormat);
       
   544     /**
       
   545      * Set the size of bubble frame inner rect
       
   546      *
       
   547      * @since S60 V4.0          
       
   548      * @param aSize The size of bubble frame inner rect
       
   549      */ 
       
   550     IMPORT_C void SetFrameDiff(TInt aLeftDiff,TInt aTopDiff,TInt aRightDiff,TInt aBottomDiff);    
       
   551 
       
   552     IMPORT_C void SetVirtualKeyImgID(TVirtualKeyDrawInfo aVirtualKeyDrawInfo);
       
   553 	
       
   554     /**
       
   555      * Set shift icon showing on the key
       
   556      *
       
   557      * @since S60 V4.0          
       
   558      * @param aIcon shift icon
       
   559      */ 	
       
   560 	IMPORT_C void SetShiftIcon( CPenInputColorIcon* aIcon );
       
   561 	inline CPenInputColorIcon* ShiftIcon();
       
   562     
       
   563 protected:                          
       
   564 
       
   565     /**
       
   566      * 2nd phase constructor
       
   567      *
       
   568      * @since S60 V4.0     
       
   569      */          
       
   570     IMPORT_C void ConstructL();
       
   571     
       
   572     /**
       
   573      * Default constructor
       
   574      *
       
   575      * @since S60 V4.0     
       
   576      * @param aRect The keyboard position relative to layout
       
   577      * @param aUiLayout The layout contains the keyboard. Owner ship not transferred.
       
   578      * @param aControlId Id for this keyboard control
       
   579      * @param aFontSpect The font used for key drawing
       
   580      */          
       
   581      IMPORT_C CVirtualKeyboard(const TRect& aRect,CFepUiLayout* aUiLayout,TInt aControlId,
       
   582                                 const TFontSpec& aFontSpec, TBool aIrregular = EFalse);    
       
   583 
       
   584 
       
   585     /**
       
   586      * 
       
   587      * find the key in a position
       
   588      *
       
   589      * @since S60 V4.0
       
   590      * @param aPoint The point position relative the layout
       
   591      * @return The first key which contains the point
       
   592      */
       
   593     //const CVirtualKey* FindKeyByPosition(const TPoint& aPt);
       
   594     
       
   595     CVirtualKeyCtrl* FindKeyCtrlByPosition(const TPoint& aPt);
       
   596                                 
       
   597     /**
       
   598      * From CFepUiBaseCtrl
       
   599      * Handle pointer down event
       
   600      *
       
   601      * @since S60 V4.0
       
   602      * @param aPoint The point position relative the layout
       
   603      * @return The control which handles the event.     
       
   604      */                                        
       
   605     //IMPORT_C virtual CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   606     
       
   607     /**
       
   608      * From CFepUiBaseCtrl
       
   609      * Handle pointer up event
       
   610      *
       
   611      * @since S60 V4.0
       
   612      * @param aPoint The point position relative the layout
       
   613      * @return The control which handles the event.     
       
   614      */                  
       
   615     //IMPORT_C virtual CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   616     
       
   617     /**
       
   618      * From CFepUiBaseCtrl
       
   619      * Handle pointer move event
       
   620      *
       
   621      * @param aPoint The point
       
   622      * @since S60 V4.0 position relative the layout
       
   623      * @return The control which handles the event.     
       
   624      */                  
       
   625     IMPORT_C virtual CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPt);    
       
   626 
       
   627     /**
       
   628      * From CFepUiBaseCtrl
       
   629      * Handle pointer levae event. 
       
   630      * This will be called only when it's got pointer down event before and 
       
   631      * now pointer leaves without pointer up event
       
   632      *
       
   633      * @since S60 V4.0
       
   634      * @param aPoint current pointer position
       
   635      */    
       
   636     //IMPORT_C void HandlePointerLeave(const TPoint& aPoint);           
       
   637 private:
       
   638     /**
       
   639      * 
       
   640      * Add a key control to keyboard
       
   641      *
       
   642      * @since S60 V4.0
       
   643      * @param aKeyCtrl The key to be added
       
   644      */            
       
   645     void AddKeyControlL(CVirtualKeyCtrl* aKeyCtrl);
       
   646     
       
   647     /**
       
   648      * 
       
   649      * Remove a key control from keyboard. The control is removed and should be used 
       
   650      * later
       
   651      *
       
   652      * @since S60 V4.0
       
   653      * @param aKeyCtrl The key to be removed.
       
   654      */            
       
   655     void RemoveKeyControl(CVirtualKeyCtrl* aKeyCtrl);
       
   656     
       
   657     /**
       
   658      * 
       
   659      * Draw a key
       
   660      *
       
   661      * @since S60 V4.0
       
   662      * @param aKey The key to be drawn
       
   663      */        
       
   664     void DrawKey(const CVirtualKey* aKey);
       
   665     
       
   666     /**
       
   667      * 
       
   668      * Set a key event and report to observer
       
   669      *
       
   670      * @since S60 V4.0
       
   671      * @param aType The general virtuak key event type, i.e, up or down
       
   672      */        
       
   673     //IMPORT_C virtual void ReportKeyEvent(TVirtualKeyEvent aType);
       
   674     
       
   675     //void ReportKeyEvent(TVirtualKeyEvent aType, CVirtualKey* aKey);
       
   676 
       
   677     /**
       
   678      * 
       
   679      * Draw indication when key is pressed
       
   680      *
       
   681      * @since S60 V4.0
       
   682      * @param aKey The key to be drawn
       
   683      * @param aPressedFlag The flag indicates whether the key is pressed.
       
   684      *        Default value is ETrue, show pressed key
       
   685      */    
       
   686     //void DrawIndication(const CVirtualKey* aKey, TBool aPressedFlag = ETrue);
       
   687     
       
   688     /**
       
   689      * 
       
   690      * Change the feedback area
       
   691      *
       
   692      * @since S60 V4.0
       
   693      * @param aId The unique id for this area
       
   694      * @param aNewRect The new feedback area
       
   695      * @param aOldRect The old feedback area
       
   696      */        
       
   697     //void ChangeFeedbackArea(TInt aId,const TRect& aNewRect,const TRect& aOldRect);    
       
   698     
       
   699     /**
       
   700      * 
       
   701      * De-register the feedback area
       
   702      *
       
   703      * @since S60 V4.0
       
   704      * @param aId The unique id for this area
       
   705      * @param aRect The feedback area
       
   706      */      
       
   707     //void DeRegisterFeedbackArea(TInt aId,const TRect& aRect);
       
   708     
       
   709     CVirtualKeyCtrl* FindCtrlForKey(const CVirtualKey* aKey);
       
   710     
       
   711     
       
   712     CVirtualKeyCtrl* CreateKeyCtrlL(CVirtualKey* aKeyInfo, TBool aRawKeyFlag);
       
   713     
       
   714 protected:
       
   715     /**
       
   716      * Current pressed key.
       
   717      * Not own
       
   718      */               
       
   719     CVirtualKey* iPressedKey;
       
   720 private:
       
   721     
       
   722     void ConstructIrregularBmps();
       
   723     
       
   724     void ConstructOneIrregularBmp(RPointerArray<CFbsBitmap>& iBmpList); 
       
   725                                   
       
   726     void DestroyIrregularBmps();                                     
       
   727                                      
       
   728     void DrawBubble(CVirtualKey* aKey);
       
   729     
       
   730     void ClearBubble(TBool aSetZeroSize);
       
   731     
       
   732 private:
       
   733     /**
       
   734      * Virtuak Key array
       
   735      */
       
   736     RPointerArray<CVirtualKey> iKeyArray;    
       
   737     
       
   738     /**
       
   739      * Font information for key drawing
       
   740      */     
       
   741     TFontSpec iFontSpec;
       
   742 
       
   743     /**
       
   744      * Fading parameter. Used for pressed key effect
       
   745      */          
       
   746     TUint8 iFadingParamBlack;
       
   747     
       
   748     /**
       
   749      * Fading parameter. Used for pressed key effect
       
   750      */              
       
   751     TUint8 iFadingParamWhite;
       
   752 
       
   753     /**
       
   754      * High light bitmap list for different size of keys
       
   755      */                  
       
   756     RPointerArray<CFbsBitmap> iKeyHighLightBmpList;
       
   757     
       
   758     /**
       
   759      * bitmap list for different size of keys
       
   760      */                  
       
   761     RPointerArray<CFbsBitmap> iNonIrregularKeyBmpList;
       
   762 	
       
   763     /**
       
   764      * High light mask bitmap list for different size of keys
       
   765      */                  
       
   766     RPointerArray<CFbsBitmap> iKeyHighLightMaskBmpList;
       
   767 
       
   768     RPointerArray<CFbsBitmap> iKeyLeftDownBmpList;
       
   769 
       
   770     RPointerArray<CFbsBitmap> iKeyMiddleUpBmpList;
       
   771 
       
   772     RPointerArray<CFbsBitmap> iKeyMiddleDownBmpList;
       
   773 
       
   774     RPointerArray<CFbsBitmap> iKeyRightDownBmpList;
       
   775 
       
   776     RPointerArray<CFbsBitmap> iKeyRightUpBmpList;
       
   777      
       
   778     /**
       
   779      * Font object for key drawing
       
   780      * Ownership depends on flag iFontOwnership.
       
   781      */          
       
   782     CFont* iFont;    
       
   783 
       
   784     /**
       
   785      * Dim key bitmap.
       
   786      * own
       
   787      */                   
       
   788     CFbsBitmap* iDimKeyBmp;
       
   789     
       
   790     /**
       
   791      * Dim key mask bitmap.
       
   792      * own
       
   793      */    
       
   794     CFbsBitmap* iDimKeyMaskBmp;  
       
   795 
       
   796     /**
       
   797      *  Flag ownership flag. ETrue if CFont object is owned by this control.
       
   798      */
       
   799     TBool iFontOwnership;
       
   800             
       
   801     /**
       
   802      * Item text display color.
       
   803      */
       
   804     TRgb  iFontColor;
       
   805     
       
   806     /**
       
   807      * Reserve item
       
   808      */    
       
   809     TInt iReserver1;
       
   810     
       
   811     TAknsItemID iKeyNormalSkinId;
       
   812     TAknsItemID iKeyHighlightSkinId;
       
   813     TAknsItemID iKeyDimSkinId;
       
   814     RArray<TAknTextLineLayout> iTextLineLayout;
       
   815     RArray<TBool> iTextLineSet;
       
   816     TBool iNeedDrawBackground;
       
   817 
       
   818     /**
       
   819      * Unused key pool. When key is removed from key board, it's added to the pool.
       
   820      * This is a patch for current vkb UI implementation, as they will remove keys 
       
   821      * when a key is handling pointer event.
       
   822      */            
       
   823     RPointerArray<CVirtualKeyCtrl> iUnUsedKeyCtrlPool;
       
   824     
       
   825     /**
       
   826      * Unused raw key pool. When key is removed from key board, it's added to the pool.
       
   827      * This is a patch for current vkb UI implementation, as they will remove keys 
       
   828      * when a key is handling pointer event.
       
   829      */                
       
   830     RPointerArray<CVirtualKeyCtrl> iUnUsedRawKeyCtrlPool;
       
   831     
       
   832     TBool iIrregularKey;
       
   833 
       
   834 	CBubbleCtrl* iBubbleCtrl;
       
   835 	
       
   836 	TInt iBubbleVerticalMargin;
       
   837 	
       
   838 	TBool iGowithPointerDown;
       
   839 	
       
   840 	TSize iBubbleSize;
       
   841 
       
   842 	TAknTextLineLayout iVKBTextLineLayout;
       
   843 	/**
       
   844 	*  Flag to control whether to show bubble
       
   845 	*/
       
   846 	TBool iIsShowBubble;
       
   847 	
       
   848 	/**
       
   849      * Keypad text color group
       
   850      */    
       
   851     TInt iKeyTextColorGroup;
       
   852 	
       
   853 	/**
       
   854      * The shift icon showing on the key
       
   855      */      
       
   856     CPenInputColorIcon* iShiftIcon;
       
   857 friend class CVirtualKeyCtrl;
       
   858 friend class CVirtualRawKeyCtrl;
       
   859 //friend class CVirtualKey;    
       
   860     };
       
   861 
       
   862 //class CVirtualKey
       
   863 /**
       
   864  * CVirtualKey
       
   865  *
       
   866  * Key on virtual key board. A virtual key is similar to the key in hard keyboard.
       
   867  * It will report virtual key up/down event when pressed up/down with a TkeyEvent data
       
   868  *
       
   869  * @lib feplayoutcontrol.lib  
       
   870  * @since S60 V4.0
       
   871  */
       
   872 class CVirtualKey : public CBase
       
   873     {
       
   874 
       
   875 public:
       
   876     /**
       
   877      * Factory function
       
   878      * This is used for those languange whose character needs more unicodes.
       
   879      *
       
   880      * @since S60 V4.0     
       
   881      * @param aCode The code this key stands for. 
       
   882      * @param aScanCode The scan code for this key
       
   883      * @param aRect The position of the key relative to keyboard
       
   884      * @param aCharRect The rect when key is drawn
       
   885      * @param aBaseLine The baseline for key drawing
       
   886      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   887                         background. Bitmap is stored in virtual key board.
       
   888      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   889                         background. Bitmap is stored in virtual key board.                        
       
   890      */
       
   891     IMPORT_C static CVirtualKey* NewL(TUint aCode, TInt aScanCode,
       
   892                                  const TRect& aRect, const TRect& aCharRect, 
       
   893                                  TInt aBaseLine, TInt aHighlightBmpIdx = -1,
       
   894                                  TInt aHighlightMaskBmpId = -1);
       
   895 
       
   896     /**
       
   897      * Factory function
       
   898      * This is used for those languange whose character needs more unicodes.
       
   899      *
       
   900      * @since S60 V4.0     
       
   901      * @param aCode The code this key stands for. 
       
   902      * @param aScanCode The scan code for this key
       
   903      * @param aRect The position of the key relative to keyboard
       
   904      * @param aCharRect The rect when key is drawn
       
   905      * @param aBaseLine The baseline for key drawing
       
   906      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
   907                         background. Bitmap is stored in virtual key board.
       
   908      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
   909                         background. Bitmap is stored in virtual key board.                        
       
   910      */
       
   911     IMPORT_C static CVirtualKey* NewL(const TDesC& aCode, TInt aScanCode,
       
   912                                const TRect& aRect, const TRect& aCharRect, 
       
   913                                TInt aBaseLine, TInt aHighlightBmpIdx = -1,
       
   914                                TInt aHighlightMaskBmpId = -1);
       
   915 
       
   916     IMPORT_C static CVirtualKey* NewL(RPointerArray<HBufC>& aUnicodesList,
       
   917                                       TInt aScanCode,
       
   918                                       const TRect& aRect);
       
   919 
       
   920     /**
       
   921      * Destructor
       
   922      *
       
   923      * @since S60 V4.0     
       
   924      */
       
   925     IMPORT_C virtual ~CVirtualKey();
       
   926     
       
   927     IMPORT_C void SetUnicodesL(RPointerArray<HBufC>& aUnicodesList);
       
   928 
       
   929 
       
   930     /**
       
   931      * Return key position
       
   932      *
       
   933      * @since S60 V4.0
       
   934      * @return The key position relative to key board
       
   935      */    
       
   936     inline const TRect& Rect() const; 
       
   937     /**
       
   938      * Set key position
       
   939      *
       
   940      * @since S60 V4.0
       
   941      * @param The key position
       
   942      */    
       
   943     IMPORT_C void SetRect(const TRect& aRect); 
       
   944     
       
   945     /**
       
   946      * Get key code
       
   947      *
       
   948      * @since S60 V4.0
       
   949      * @return The key code
       
   950      */
       
   951     inline TUint KeyCode() const;
       
   952     
       
   953     /**
       
   954      * Get key code data. Support for multi language
       
   955      *
       
   956      * @since S60 V4.0
       
   957      * @return The key codes
       
   958      */
       
   959     inline const TDesC& KeyUnicodes() const;
       
   960     const TDesC& KeyUnicodes(TVirtualKeyTextPos aPos) const;
       
   961     
       
   962     /**
       
   963      * Get key scancode
       
   964      *
       
   965      * @since S60 V4.0
       
   966      * @return The key scancode
       
   967      */
       
   968     inline TInt ScanCode() const;    
       
   969     
       
   970     /**
       
   971      * Get key display code
       
   972      *
       
   973      * @since S60 V4.0
       
   974      * @return The key scancode
       
   975      */
       
   976     inline TUint DisplayCode() const;
       
   977 
       
   978     /**
       
   979      * Set key display code
       
   980      *
       
   981      * @since S60 V4.0
       
   982      * @param aCode The display code
       
   983      */
       
   984     inline void SetDisplayCode(TUint aCode);
       
   985     /**
       
   986      * Get key highlight image index
       
   987      *
       
   988      * @since S60 V4.0
       
   989      * @return The index for key highligh image
       
   990      */
       
   991     inline TInt HighlightBmpIndex();    
       
   992     
       
   993     /**
       
   994      * Get key highlight mask image index
       
   995      *
       
   996      * @since S60 V4.0
       
   997      * @return The index for key highligh mask image
       
   998      */
       
   999     inline TInt HighlightMaskBmpIndex();       
       
  1000      
       
  1001     /**
       
  1002      * Dim a key
       
  1003      *
       
  1004      * @since S60 V4.0
       
  1005      * @param aFlag The dim status
       
  1006      */
       
  1007     inline void SetDimmed(TBool aFlag);    
       
  1008     
       
  1009     /**
       
  1010      * Get the key dim status
       
  1011      *
       
  1012      * @since S60 V4.0
       
  1013      * @return The dim status
       
  1014      */
       
  1015      inline TBool Dimmed() const;        
       
  1016     
       
  1017     /**
       
  1018      * set key to be a latch key
       
  1019      *
       
  1020      * @since S60 V4.0
       
  1021      * @param aFlag The key latch style flag. ETrue if set to latch key.
       
  1022      */
       
  1023      inline void SetLatchKey(TBool aFlag);
       
  1024     
       
  1025     /**
       
  1026      * test whether this key a latch key
       
  1027      *
       
  1028      * @since S60 V4.0
       
  1029      * @return ETrue if the key is a latch key. Otherwise EFalse
       
  1030      */    
       
  1031      inline TBool IsLatchKey();
       
  1032     
       
  1033     /**
       
  1034      * set key latch state
       
  1035      *
       
  1036      * @since S60 V4.0
       
  1037      * @param The latch key state.
       
  1038      */    
       
  1039      IMPORT_C void SetLatched(TBool aFlag);
       
  1040      
       
  1041      IMPORT_C TVirtualKeyIrregularKeyType IrregualrKeyType();
       
  1042      
       
  1043      IMPORT_C void SetIrregualrKeyType(TVirtualKeyIrregularKeyType aKeyType);
       
  1044     /**
       
  1045      * get key latch state
       
  1046      *
       
  1047      * @since S60 V4.0
       
  1048      * @return The key latch state. ETrue if latched
       
  1049      */    
       
  1050      inline TBool Latched();
       
  1051 
       
  1052      inline void SetInnerRect(const TRect& aRect);
       
  1053      inline TRect InnerRect();
       
  1054      TBool UnicodesListEmpty(TInt& aIdx);
       
  1055 
       
  1056     /**
       
  1057      * Set keyboard to key
       
  1058      *
       
  1059      * @since S60 V4.0
       
  1060      * @param The keyboard which contains the key.
       
  1061      */    
       
  1062 //     inline void SetKeyboard(CVirtualKeyboard* aKeyboard);
       
  1063     
       
  1064      IMPORT_C void SetDisplayUnicodeL( const TDesC& aDspUnicode );
       
  1065      inline TDesC* DisplayUnicode() const;
       
  1066      
       
  1067      IMPORT_C void HideKeyCtrl( TBool aHide ); 
       
  1068      inline void SetKeyData( const TDesC& aKeyData );
       
  1069      inline void SetKeyScancode( TInt aScancode );
       
  1070 protected:            
       
  1071     /**
       
  1072      * 2nd phase constructor
       
  1073      *
       
  1074      * @since S60 V4.0     
       
  1075      */          
       
  1076     void ConstructL(const TDesC& aCodeData);
       
  1077     
       
  1078     void ConstructL(const RPointerArray<HBufC>& aUnicodesList);
       
  1079 
       
  1080 private:
       
  1081     /**
       
  1082      * Default constructor
       
  1083      *
       
  1084      * @since S60 V4.0     
       
  1085      * @param aCode The code this key stands for
       
  1086      * @param aScanCode The scan code for this key
       
  1087      * @param aRect The position of the key relative to keyboard
       
  1088      * @param aCharRect The rect when key is drawn
       
  1089      * @param aBaseLine The baseline for key drawing
       
  1090      * @param aHighlightBmpIdx The bitmap index for highlighging key
       
  1091                         background. Bitmap is stored in virtual key board.
       
  1092      * @param aHighlightMaskIdx The mask bitmap index for highlighging key
       
  1093                         background. Bitmap is stored in virtual key board.                        
       
  1094      */
       
  1095     CVirtualKey(TUint aCode, TInt aScanCode, const TRect& aRect, TInt aHighlightBmpIdx,
       
  1096                  TInt aHighlightMaskBmpId);
       
  1097 
       
  1098     CVirtualKey(TInt aScanCode,
       
  1099                 const TRect& aRect);
       
  1100 private:
       
  1101     /**
       
  1102      * Create a key control
       
  1103      *
       
  1104      * @since S60 V5.0     
       
  1105      * @param aKeyInfo The virtual key information
       
  1106      * @param aRawKeyFlag Flag indicates whether a raw key is needed
       
  1107      * @return The created key control
       
  1108      */
       
  1109     CVirtualKeyCtrl* CreateKeyCtrlL(CVirtualKey* aKeyInfo,TBool aRawKeyFlag);    
       
  1110 private:
       
  1111     /**
       
  1112      * Key event attribute for this key        
       
  1113      */
       
  1114     TUint       iCode;
       
  1115     TUint       iScanCode;
       
  1116     /**
       
  1117      * The position relative to the keyboard. Not relative to the layout.
       
  1118      * This is the valid region when pointer event effected to this key.
       
  1119      */
       
  1120     TRect   iRect;
       
  1121     
       
  1122     TRect   innerRect;
       
  1123 
       
  1124     /**
       
  1125      * The hight light bitmap index for this key. Bitmap is owned by keyboard
       
  1126      * High light bitmap is used when key does not have background bitmap itself,
       
  1127      * pressed/highlight effect is down by show the highlight bitmap then draws text
       
  1128      * on top of the bitmap. See DrawIndication.
       
  1129      * 
       
  1130      * The assumption is that when this index is >= 0 , then fading effect
       
  1131      * is not used. Key pressing effect is then implemented by bitmap.
       
  1132      */    
       
  1133     TInt iHighlightBmpIndex;
       
  1134     
       
  1135     /**
       
  1136      * The hight light mask bitmap index for this key
       
  1137      */    
       
  1138     TInt iHighlightMaskBmpIndex;    
       
  1139     
       
  1140     /*
       
  1141      * Dim status
       
  1142      */
       
  1143     TBool iDimmed;    
       
  1144      
       
  1145     /*
       
  1146     * Latch key flag    
       
  1147     */ 
       
  1148     TBool iIsLatchKey;
       
  1149     
       
  1150     /*
       
  1151     * Latch key state
       
  1152     */ 
       
  1153     TBool iLatched;    
       
  1154     
       
  1155     /**
       
  1156      * unicode data for the key. By default it only contains the key code.
       
  1157      * But for some languages, a character may need several unicodes. 
       
  1158      */    
       
  1159     HBufC* iCodeData;   
       
  1160     RPointerArray<HBufC> iUnicodesList;    
       
  1161     /**
       
  1162      * Unicode data for the key display. Some special character need additional
       
  1163      * unicode to display. It's different than its unicode.
       
  1164      */
       
  1165     HBufC* iDisplayCodeData;
       
  1166 
       
  1167     /**
       
  1168      * Keyboard which contains the key					     
       
  1169      */    
       
  1170     //CVirtualKeyboard* iKeyboard;    
       
  1171     /**
       
  1172      * Key control created for this key information by key board
       
  1173      */        
       
  1174     CVirtualKeyCtrl* iKeyCtrl;    
       
  1175     
       
  1176     TVirtualKeyIrregularKeyType iIrregularKeyType;
       
  1177     /**
       
  1178      * Reserve item
       
  1179      */    
       
  1180     TInt iReserver1;
       
  1181     
       
  1182     /**
       
  1183      * Reserve item
       
  1184      */    
       
  1185     TInt iReserver2;
       
  1186     
       
  1187 friend class CVirtualKeyCtrl;
       
  1188 friend class CVirtualKeyboard;   
       
  1189     };
       
  1190 //end of CVirtualKey
       
  1191     
       
  1192 #include <peninputlayoutvkb.inl>
       
  1193 #endif //C_CVIRTUALKEYBOARD_H