textinput/peninputgenericvkb/inc/peninputgenericvkbwindow.h
changeset 0 eb1f2e154e89
child 5 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  peninput generic vkb window layout class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PENINPUTGENERICVKBWINDOW_H
       
    20 #define C_PENINPUTGENERICVKBWINDOW_H
       
    21 
       
    22 // System includes
       
    23 #include <peninputlayoutwindowext.h>
       
    24 #include <peninputuistatemgrinterface.h>
       
    25 #include <AknLayoutDef.h>
       
    26 
       
    27 // Forward declarations
       
    28 class CAknFepCtrlRangeBar;
       
    29 class CAknFepCtrlEventButton;
       
    30 class CAknFepCtrlDragButton;
       
    31 class CAknFepCtrlRepeatButton;
       
    32 class CPeninputCommonChoiceList;
       
    33 class CPeninputLayoutInputmodelChoice;
       
    34 class CPeninputGenericVkbLafMgr;
       
    35 class CPeninputSyncBitmapRotator;
       
    36 class CRepository;
       
    37 class CFepLayoutScrollableList;
       
    38 // Constants
       
    39 const TInt KMaxFileLength = 80;
       
    40 
       
    41 /**
       
    42  *  Vkb layout window class
       
    43  *  This class define methods to deal with window layout and 
       
    44  *  handle events sent to this window
       
    45  *
       
    46  *  @lib peninputgenericvkb.lib
       
    47  *  @since S60 v3.2
       
    48  */
       
    49 class CPeninputGenericVkbWindow : public CPeninputLayoutWindowExt
       
    50     {
       
    51 
       
    52 public:
       
    53 
       
    54     /**
       
    55      * Two-phased constructor
       
    56      *
       
    57      * @since S60 v3.2
       
    58      * @param aUiLayout The plugin ui layout
       
    59      * @param aLayoutContext The vkb layout context
       
    60      * @return The pointer to CPeninputGenericVkbWindow object
       
    61      */
       
    62     static CPeninputGenericVkbWindow* NewL( CFepUiLayout* aUiLayout, 
       
    63         MPeninputLayoutContext* aLayoutContext, MPeninputUiStateMgr* aUiStateMgr );
       
    64     
       
    65     /**
       
    66      * Destructor
       
    67      *
       
    68      * @since S60 v3.2
       
    69      * @return None
       
    70      */
       
    71     virtual ~CPeninputGenericVkbWindow();
       
    72     
       
    73     /**
       
    74      * Do when case changed
       
    75      *
       
    76      * @since S60 v3.2
       
    77      * @param aNewCase The new case
       
    78      * @return None
       
    79      */
       
    80     void DoCaseChange( TInt aNewCase );
       
    81 
       
    82 // From base class CPeninputLayoutWindow
       
    83 
       
    84     /**
       
    85      * From CPeninputLayoutWindow
       
    86      * Handle control event 
       
    87      *
       
    88      * @since S60 v3.2
       
    89      * @param aEventType The event type
       
    90      * @param aCtrl The control who sends the event
       
    91      * @param aEventData The event data
       
    92      * @return None
       
    93      */     
       
    94     void HandleControlEvent( TInt aEventType,
       
    95                              CFepUiBaseCtrl* aCtrl, 
       
    96                              const TDesC& aEventData );
       
    97 
       
    98     /**
       
    99      * From CPeninputLayoutWindow
       
   100      * Get id of window config resource
       
   101      *
       
   102      * @since S60 v3.2
       
   103      * @return The id of window config resource
       
   104      */
       
   105     TInt GetWindowConfigResId();
       
   106 
       
   107     /**
       
   108      * From CPeninputLayoutWindow
       
   109      * Get id of window resource
       
   110      *
       
   111      * @since S60 v3.2
       
   112      * @return The id of window resource
       
   113      */ 
       
   114     TInt GetWindowResId();
       
   115     
       
   116     /**
       
   117      * From CPeninputLayoutWindowExt
       
   118      * Get resource id of numeric keymapping
       
   119      *
       
   120      * @since S60 v3.2
       
   121      * @return The id of window resource
       
   122      */ 
       
   123     TInt GetNumKeymappingResId();
       
   124 
       
   125     /**
       
   126      * From CPeninputLayoutWindow
       
   127      * Get file name of window config resource
       
   128      *
       
   129      * @since S60 v3.2
       
   130      * @param aLangID The id of language
       
   131      * @return The file name of window config resource
       
   132      */ 
       
   133     const TDesC& GetWindowConfigResFileName( TInt aLangID );
       
   134 
       
   135     /**
       
   136      * From CPeninputLayoutWindow
       
   137      * Get file name of window resource
       
   138      *
       
   139      * @since S60 v3.2
       
   140      * @return The file name of window resource
       
   141      */ 
       
   142     const TDesC& GetWindowResFileName();
       
   143 
       
   144     /**
       
   145      * From CPeninputLayoutWindow
       
   146      * Re-organize all controls in the assigned client area layout
       
   147      *
       
   148      * @since S60 v3.2
       
   149      * @param aClientLayoutId The id of client area layout
       
   150      * @return None
       
   151      */
       
   152     void ReorganizeControls( TInt aClientLayoutId, TBool aNeedReset );
       
   153   
       
   154     /**
       
   155      * From CPeninputLayoutWindow
       
   156      * Change unit size
       
   157      *
       
   158      * @since S60 v3.2
       
   159      * @return The window rect
       
   160      */
       
   161     const TRect ChangeUnitSize();
       
   162   
       
   163     /**
       
   164      * From CPeninputLayoutWindow
       
   165      * Change size of client area
       
   166      *
       
   167      * @since S60 v3.2
       
   168      * @return None
       
   169      */
       
   170     void ChangeClientSize();  
       
   171     
       
   172     /**
       
   173      * From CPeninputLayoutWindow
       
   174      * Construct all controls specified in resource
       
   175      *
       
   176      * @since S60 v3.2
       
   177      * @return None
       
   178      */
       
   179     void CreateAllControlsL();
       
   180     
       
   181     /**
       
   182      * From CPeninputLayoutWindow
       
   183      * Set control fonts. Fonts info comes from resource
       
   184      *
       
   185      * @since S60 v3.2
       
   186      * @return None
       
   187      */
       
   188     void SetControlsFont();
       
   189   
       
   190     /**
       
   191      * From CPeninputLayoutWindow
       
   192      * Pop up choice list
       
   193      *
       
   194      * @since S60 v3.2
       
   195      * @return None
       
   196      */
       
   197     void PopupChoiceList(); 
       
   198         
       
   199     /** 
       
   200      * ConstructFromResourceL load settings from resource.
       
   201      * Before calling this function, the resource id should be set
       
   202      *
       
   203      * @since S60 v3.2
       
   204      * @return None
       
   205      */
       
   206     void ConstructFromResourceL();
       
   207 
       
   208     static TInt BackgroundTaskL(TAny* aPtr);
       
   209 
       
   210     /**
       
   211      * config unit size, reason may due to client layout id changed,
       
   212      * Set current language
       
   213      *
       
   214      * @since S60 v3.2
       
   215      * @param aLang Current language
       
   216      * @return None
       
   217      */
       
   218     void SetSwitchlistLanguage(TInt aLang);
       
   219 
       
   220     /**
       
   221      * Current editor is secret
       
   222      *
       
   223      * @since S60 v3.2
       
   224      * @param aSecret Editor is secret
       
   225      * @return None
       
   226      */
       
   227     void SetSwitchlistSecretFlag(TBool aSecret);  
       
   228     
       
   229     /**
       
   230      * Dim the arrow keys on FSQ when the editor 
       
   231      * is findpane or secret editor
       
   232      *
       
   233      * @since S60 v3.2
       
   234      * @param aSecret Editor is secret
       
   235      * @return None
       
   236      */
       
   237     void DimArrowKeys( TBool aDimArrow );
       
   238 
       
   239 
       
   240     /**
       
   241      * Pop up switcher windows
       
   242      *
       
   243      * @since S60 v3.2
       
   244      * @param aSecret Editor is secret
       
   245      * @return None
       
   246      */    
       
   247     void PopupSwitchWindowL();
       
   248 
       
   249     /**
       
   250      * Handle accented char event
       
   251      *
       
   252      * @since S60 v3.2
       
   253      * @param aEventType The event type
       
   254      * @param aEventData The event data
       
   255      * @param aDeadKey The DeadKey char buffer
       
   256      * @param anewCharBuf The new Accented buffer
       
   257      * @return None
       
   258      */    
       
   259     TBool HandleAccentCharEvent(TInt aEventType, 
       
   260                                 const TDesC& aEventData, 
       
   261                                 const TDesC& aDeadKey, 
       
   262                                 HBufC* anewCharBuf );
       
   263 
       
   264     /**
       
   265      * Handle virtual key latched event
       
   266      *
       
   267      * @since S60 v3.2
       
   268      * @param aEventType The event type
       
   269      * @param aCtrl The controler
       
   270      * @param aEventData Event data
       
   271      * @return None
       
   272      */    
       
   273     void HandleVirtualKeyLatchedEvent(TInt aEventType, 
       
   274                                       CFepUiBaseCtrl* aCtrl, 
       
   275                                       const TDesC& aEventData );
       
   276 
       
   277 
       
   278     /**
       
   279      * handle virtual key up event
       
   280      *
       
   281      * @since S60 v3.2
       
   282      * @param aEventType The event type
       
   283      * @param aCtrl The controler
       
   284      * @param aEventData Event data
       
   285      * @return None
       
   286      */                                  
       
   287     TBool HandleVirtualKeyUpEvent(TInt aEventType, 
       
   288                                  CFepUiBaseCtrl* aCtrl, 
       
   289                                  const TDesC& aEventData );
       
   290   
       
   291     virtual void SetLafLayOut(TInt aRows, TInt aColumns);
       
   292      /*
       
   293      *
       
   294      * @since S60 v3.2
       
   295      * @return None
       
   296      */                                  
       
   297     void SetDeadKey();
       
   298     void ChangeInputModeL();
       
   299 
       
   300     /**
       
   301      * Unlatch a DeadKey by the key buffer
       
   302      *
       
   303      * @since S60 v3.2
       
   304      * @param abuf The key buffer which will be unlatched
       
   305      * @return None
       
   306      */
       
   307     void UnLatchDeadKey( const TDesC& abuf = KNullDesC );
       
   308   
       
   309     void SetPromptTextL(TUint8* aData);
       
   310     
       
   311     void UpdateLafData();
       
   312     
       
   313 	void ConstructAccentListL(TInt aLang);
       
   314 	
       
   315 	void ShowBubble(TInt aShow);
       
   316 	
       
   317     /**
       
   318      * Show tooltip of ICF
       
   319      * 
       
   320      * @param aText The text to be displayed in ICF
       
   321      * @return None
       
   322      */
       
   323 	void ShowTooltipL( const TDesC& aText );
       
   324 	
       
   325     /**
       
   326      * Hide tooltip of ICF
       
   327      * 
       
   328      * @return None
       
   329      */	
       
   330 	void HideTooltip();
       
   331 	
       
   332     /**
       
   333      * Hide candidate list
       
   334      * 
       
   335      * @return None
       
   336      */		
       
   337 	void HideCandidateList();
       
   338 	
       
   339     /**
       
   340      * Show candidate list
       
   341      * 
       
   342      * @param aItemArray, the contents to be shown
       
   343      * @param aActiveIndex, the default index     
       
   344      * @return None
       
   345      */	
       
   346     void ShowCandidateListL( const CDesCArray* aItemArray,
       
   347                             TInt aActiveIndex );    
       
   348     
       
   349     /**
       
   350      * Handle candidate list selected events
       
   351      * 
       
   352      * @param aCtrl, pointer of the candidate list on which events occur.
       
   353      * @param, aEventData event data
       
   354      * @return None
       
   355      */	
       
   356     void HandleCandidateListSelectedL( CFepUiBaseCtrl* aCtrl, const TDesC& aEventData );        
       
   357     
       
   358 protected:
       
   359 
       
   360     /**
       
   361      * Constructor
       
   362      *
       
   363      * @since S60 v3.2
       
   364      * @param aUiLayout The plugin ui layout
       
   365      * @param aLayoutContext The vkb layout context
       
   366      * @return None
       
   367      */
       
   368     CPeninputGenericVkbWindow( CFepUiLayout* aUiLayout, 
       
   369                                MPeninputLayoutContext* aLayoutContext,
       
   370                                MPeninputUiStateMgr* aUiStateMgr );
       
   371     void ConstructL();
       
   372     
       
   373     virtual TBool CreateCustomControlL( TInt16 aControlId, TInt32 aImageId );  
       
   374     virtual void  AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl);  
       
   375 
       
   376 private:
       
   377     /**
       
   378      * Add range bar into client area
       
   379      *
       
   380      * @since S60 v3.2
       
   381      * @return None
       
   382      */
       
   383     void AddRangeBarL();
       
   384 
       
   385     /**
       
   386      * Add button to client area
       
   387      *
       
   388      * @since S60 v3.2
       
   389      * @param aControlId The control id
       
   390      * @param aEventId The control's event id
       
   391      * @param aResId The control's resource id
       
   392      * @param aUnicode The control's unicode
       
   393      * @param aIsRepeat The TBool indicating whether the 
       
   394      *        control is repeated or not
       
   395      * @return The pointer to CAknFepCtrlEventButton object
       
   396      */    
       
   397     CAknFepCtrlEventButton* AddButtonL( const TInt aControlId,
       
   398                                         const TInt aEventId,
       
   399                                         const TInt aResId,
       
   400                                         const TInt aUnicode = 0,
       
   401                                         const TBool aIsRepeat = EFalse );
       
   402 
       
   403     /**
       
   404      * Add popup window to display accented char list
       
   405      *
       
   406      * @since S60 v3.2
       
   407      * @return None
       
   408      */
       
   409     void AddPopupWindowL();
       
   410 
       
   411     /**
       
   412      * Reset accent button
       
   413      *
       
   414      * @since S60 v3.2
       
   415      * @return None
       
   416      */
       
   417     void ResetAccentButton();
       
   418 
       
   419     /**
       
   420      * Handle size changed for accented chars popup window
       
   421      *
       
   422      * @since S60 v3.2
       
   423      * @return None
       
   424      */
       
   425     void PopupWindowSizeChange();
       
   426     
       
   427     /**
       
   428      * get resource info of accented chars popup window
       
   429      *
       
   430      * @since S60 v3.2
       
   431      * @return None
       
   432      */
       
   433     void GetPopupWndInfoFromResL( TResourceReader reader, const TRect& aRect );  
       
   434     void DoIdleConstructL();
       
   435     
       
   436     void SetVkbLayoutSize();
       
   437     
       
   438     void SimulateRawEvent(TInt aScanCode, TRawEvent::TType aType);
       
   439     
       
   440     void SetRangeBarSizeL(TInt x, TInt y);
       
   441     
       
   442     TBool HandleDeadKeyL(TInt aEventType, const TDesC& aEventData );
       
   443     
       
   444     void ReorgnizeTitleBar();
       
   445     
       
   446     void UpdateICFTextL();
       
   447     
       
   448     inline TBool IsRtoLLanguage( TInt aLanguage );
       
   449     inline TBool IsValidLanguage(TInt aLanguage); 
       
   450     
       
   451     void HandleButtonResOnLangDirChange( TInt aControlId );
       
   452     void HandleButtonResOnLangDirChangeL( TInt aControlId );
       
   453     
       
   454     /*
       
   455     * Create a candidate list control
       
   456     */
       
   457     void CreateCandidateListL();       
       
   458     
       
   459     /*
       
   460     * Retrieve text color from skin for candidiate list
       
   461     */
       
   462     TRgb CandidateListTextColor();
       
   463     
       
   464     /*
       
   465     * Retrieve text color from skin for autocompletion part
       
   466     */
       
   467     TRgb AutoCompletionPartColor();
       
   468         
       
   469 private: // Data
       
   470 
       
   471     /**
       
   472      * The vkb extenting control for vkb area
       
   473      * Not own
       
   474      */
       
   475     CPeninputVkbCtrlExt* iVkbCtrl;
       
   476     
       
   477     /**
       
   478      * The range bar
       
   479      * Not own
       
   480      */
       
   481     CAknFepCtrlRangeBar* iRangeBar;
       
   482     
       
   483     /**
       
   484      * The language switch button
       
   485      * Not own
       
   486      */
       
   487     CAknFepCtrlEventButton* iLangSwitchBtn;
       
   488     
       
   489     /**
       
   490      * The resource file name
       
   491      */
       
   492     TBuf<KMaxFileLength> iResourceFilename;
       
   493     
       
   494     /**
       
   495      * The popup window
       
   496      * Own
       
   497      */    
       
   498     CPeninputCommonChoiceList* iPopupWnd;
       
   499     
       
   500     /**
       
   501      * The background bitmap of popup window
       
   502      * Not own
       
   503      */      
       
   504     CFbsBitmap* iPopupWndBgImg;  
       
   505 
       
   506     /**
       
   507      * The focus bitmap of popup window
       
   508      * Not own
       
   509      */  
       
   510     CFbsBitmap* iPopupWndFocusImg;
       
   511     
       
   512     /**
       
   513      * The UI state manager
       
   514      * Not own
       
   515      */  
       
   516     MPeninputUiStateMgr* iUiStateMgr;
       
   517     
       
   518     /**
       
   519      * Application window rect
       
   520      */  
       
   521     TRect iAppWndRect;
       
   522     
       
   523     /**
       
   524      * VKB window rect
       
   525      */  
       
   526     TRect iVkbWndRect;
       
   527     
       
   528     CIdle *iIdle;                     
       
   529     
       
   530     /**
       
   531      * Whether popup window has been initied
       
   532      */  
       
   533     TBool iPopupInited;
       
   534     
       
   535     /**
       
   536      * Popup window item rect
       
   537      */  
       
   538     TRect iPopupItemRect;
       
   539 
       
   540     /**
       
   541      * Choice text layout
       
   542      */  
       
   543     TAknTextLineLayout iChoiceTextLayout;
       
   544     
       
   545     /**
       
   546      * Whether popup window text property has been set
       
   547      */  
       
   548     TBool iPopupSet;
       
   549     
       
   550     /**
       
   551      * Array of unit size
       
   552      * Own
       
   553      */  
       
   554     RArray<TSize> iUnits;
       
   555     /**
       
   556      * Touch input switcher
       
   557      * Own
       
   558      */  
       
   559     CAknFepCtrlRepeatButton* iArrowLeftButton;
       
   560     
       
   561     CAknFepCtrlRepeatButton* iArrowRightButton;
       
   562     
       
   563     CAknFepCtrlDragButton* iMoveButton;
       
   564     
       
   565     CPeninputGenericVkbLafMgr* iLafMgr;
       
   566     
       
   567 //    CPeninputLayoutInputmodelChoice* iModeSwitchChoice;
       
   568 
       
   569     /**
       
   570      * The new DeadKey buffer
       
   571      */  
       
   572     TBuf<16> iNewDeadKeyBuf;
       
   573 
       
   574     /**
       
   575      * The old DeadKey buffer
       
   576      */  
       
   577     TBuf<16> iOldDeadKeyBuf;
       
   578     
       
   579     
       
   580     TAknWindowLineLayout iBubbleSize;
       
   581     TAknTextLineLayout iBubbleTextLayout;    
       
   582     TBool iFirstConstruct;   
       
   583     
       
   584     /**
       
   585      * Writing language
       
   586      */  
       
   587     TInt iLanguage;
       
   588     
       
   589     /**
       
   590      * Bitmap rotator
       
   591      */  
       
   592 	CPeninputSyncBitmapRotator* iBmpRotator;
       
   593 
       
   594 private:	
       
   595 	CFepLayoutScrollableList* iCandidateList;
       
   596 	
       
   597     };
       
   598 
       
   599 inline TBool CPeninputGenericVkbWindow::IsRtoLLanguage( TInt aLanguage )
       
   600 	{
       
   601 	return ( aLanguage == ELangArabic ||
       
   602 			 aLanguage == ELangHebrew ||
       
   603 			 aLanguage == ELangFarsi  ||
       
   604 			 aLanguage == ELangUrdu );	
       
   605 	}    
       
   606 
       
   607 inline TBool CPeninputGenericVkbWindow::IsValidLanguage(TInt aLanguage)
       
   608 	{
       
   609 	return (aLanguage != ELangTest && aLanguage != ELangNone);	
       
   610 	}
       
   611 #endif // C_PENINPUTGENERICVKBWINDOW_H