textinput/peninputcommonlayout/inc/peninputlayoutwindowext.h
changeset 0 eb1f2e154e89
child 19 ac7e4d1d9209
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2005-2007 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:  common layout window class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPENINPUTLAYOUTWINDOWEXT_H
       
    20 #define C_CPENINPUTLAYOUTWINDOWEXT_H
       
    21 
       
    22 // System includes
       
    23 #include <peninputbasewindowext.h>
       
    24 
       
    25 // User includes
       
    26 #include "peninputctrlpool.h"
       
    27 #include "peninputlayoutconfig.h"
       
    28 #include "peninputcommonlayoutglobalenum.h"
       
    29 
       
    30 // Forward declarations
       
    31 class CFepUiLayout;
       
    32 class CFepInputContextField;
       
    33 class CAknFepCtrlEventButton;
       
    34 class MPeninputLayoutContext;
       
    35 class CPeninputLayoutConfig;
       
    36 class CPeninputNumericKepMappingMgr;
       
    37 
       
    38 /**
       
    39  *  Common pen input layout window class.
       
    40  *  This class define the common behaviors of VKB layout window and 
       
    41  *  HWR layout window.
       
    42  *
       
    43  *  @lib peninputcommonlayout.lib
       
    44  *  @since S60 v3.2
       
    45  */
       
    46 class CPeninputLayoutWindowExt : public CAknFepCtrlBaseWindowExt
       
    47     {
       
    48 
       
    49 public:
       
    50 
       
    51     /**
       
    52      * Destructor
       
    53      *
       
    54      * @since S60 v3.2
       
    55      * @return None
       
    56      */
       
    57     IMPORT_C virtual ~CPeninputLayoutWindowExt();
       
    58 
       
    59     /**
       
    60      * Get layout config
       
    61      *
       
    62      * @since S60 v3.2
       
    63      * @return The pointer to CPeninputLayoutConfig object
       
    64      */
       
    65     IMPORT_C CPeninputLayoutConfig* ConfigInfo() const;
       
    66 
       
    67     /**
       
    68      * Change input language
       
    69      *
       
    70      * @since S60 v3.2
       
    71      * @param aLangID The new language id
       
    72      * @return None
       
    73      */
       
    74     IMPORT_C void ChangeInputLanguageL( TInt aLangID );
       
    75 
       
    76     /**
       
    77      * Change range
       
    78      *
       
    79      * @since S60 v3.2
       
    80      * @param aRange The destination range
       
    81      * @return None
       
    82      */     
       
    83     IMPORT_C void ChangeRange( TInt aRange, TInt aVkbLayoutId = 0, TBool aNotify = ETrue );
       
    84    
       
    85     /**
       
    86      * Set the input context field text
       
    87      *
       
    88      * @since S60 v3.2
       
    89      * @param aData The data of type TFepInputContextFieldData to be set
       
    90      * @return None
       
    91      */          
       
    92     IMPORT_C void SetEditorTextL( const TFepInputContextFieldData& aData );
       
    93     
       
    94     /**
       
    95      * Set if the input context field text is secret
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @param aData The flag
       
    99      * @return None
       
   100      */          
       
   101     IMPORT_C void SetTextIsSecret( TBool aData );
       
   102 
       
   103     void SetNumberGrouping(TBool aData);
       
   104 
       
   105     /**
       
   106      * Method for size changing of the window
       
   107      *
       
   108      * @since S60 v3.2
       
   109      * @param aLandscapeStyle The flag that specify the window style is 
       
   110      *  landscape or portrait
       
   111      * @return None
       
   112      */
       
   113     IMPORT_C virtual void SizeChanged( TBool aLanscapeStyle );
       
   114     
       
   115     /**
       
   116      * Handle control event 
       
   117      *
       
   118      * @since S60 v3.2
       
   119      * @param aEventType The event type
       
   120      * @param aCtrl The control who sends the event
       
   121      * @param aEventData The event data
       
   122      * @return None
       
   123      */     
       
   124     IMPORT_C virtual void HandleControlEvent( TInt aEventType, 
       
   125                                               CFepUiBaseCtrl* aCtrl, 
       
   126                                               const TDesC& aEventData );  
       
   127 
       
   128     /**
       
   129      * Change client area layout
       
   130      *
       
   131      * @since S60 v3.2
       
   132      * @param aClientLayoutId The id of client area layout
       
   133      * @return None
       
   134      */
       
   135     IMPORT_C void ChangeClientLayout( TInt aClientLayoutId );
       
   136     
       
   137     /**
       
   138      * Change vkb area layout
       
   139      *
       
   140      * @since S60 v3.2
       
   141      * @param aVkbLayoutId The id of vkb area layout
       
   142      * @return None
       
   143      */     
       
   144     IMPORT_C void ChangeVkbLayout( TInt aVkbLayoutId );  
       
   145     
       
   146     /**
       
   147      * Get id of window config resource
       
   148      *
       
   149      * @since S60 v3.2
       
   150      * @return The id of window config resource
       
   151      */
       
   152     virtual TInt GetWindowConfigResId() = 0;
       
   153 
       
   154     /**
       
   155      * Get id of window resource
       
   156      *
       
   157      * @since S60 v3.2
       
   158      * @return The id of window resource
       
   159      */ 
       
   160     virtual TInt GetWindowResId() = 0;
       
   161 
       
   162     /**
       
   163      * Get file name of window config resource
       
   164      *
       
   165      * @since S60 v3.2
       
   166      * @param aLangID The id of language
       
   167      * @return The file name of window config resource
       
   168      */ 
       
   169     virtual const TDesC& 
       
   170         GetWindowConfigResFileName( TInt aLangID ) = 0;
       
   171 
       
   172     /**
       
   173      * Get file name of window resource
       
   174      *
       
   175      * @since S60 v3.2
       
   176      * @return The file name of window resource
       
   177      */ 
       
   178     virtual const TDesC& GetWindowResFileName() = 0;
       
   179     
       
   180     /**
       
   181      * Change unit size
       
   182      *
       
   183      * @since S60 v3.2
       
   184      * @return The rect of whole window
       
   185      */
       
   186 	virtual const TRect ChangeUnitSize() = 0;
       
   187   
       
   188     /**
       
   189      * Change size of client area
       
   190      *
       
   191      * @since S60 v3.2
       
   192      * @param aLeftTopPoint The left top point of client area
       
   193      * @return None
       
   194      */
       
   195     virtual void ChangeClientSize() = 0; 
       
   196     
       
   197     /**
       
   198      * Construct all controls specified in resource(implementation will be 
       
   199      * postponed in subclass)
       
   200      *
       
   201      * @since S60 v3.2
       
   202      * @return None
       
   203      */
       
   204     virtual void CreateAllControlsL() = 0;
       
   205     
       
   206     /**
       
   207      * Set control fonts. Fonts info comes from resource
       
   208      *
       
   209      * @since S60 v3.2
       
   210      * @return None
       
   211      */
       
   212     virtual void SetControlsFont() = 0;
       
   213   
       
   214     /**
       
   215      * Pop up choice list
       
   216      *
       
   217      * @since S60 v3.2
       
   218      * @return None
       
   219      */
       
   220     virtual void PopupChoiceList() = 0;
       
   221   
       
   222     /**
       
   223      * Re-organize all controls in the assigned client area layout
       
   224      *
       
   225      * @since S60 v3.2
       
   226      * @param aClientLayoutId The id of client area layout
       
   227      * @return None
       
   228      */
       
   229     virtual void ReorganizeControls( TInt aClientLayoutId, TBool aNeedReset ) = 0;
       
   230 
       
   231     /**
       
   232      * Do when case changed
       
   233      *
       
   234      * @since S60 v3.2
       
   235      * @param aNewCase The new case
       
   236      * @return None
       
   237      */
       
   238     virtual void DoCaseChange( TInt aNewCase ) = 0;
       
   239     IMPORT_C virtual void OnInputLanguageChange();
       
   240           
       
   241     /**
       
   242      * Handler for range button clicked
       
   243      *
       
   244      * @since S60 v3.2
       
   245      * @param aRange The range id
       
   246      * @return None
       
   247      */
       
   248     IMPORT_C virtual void HandleRangeEvent( TInt aRange );
       
   249 
       
   250     /**
       
   251      * Handler for range loop event
       
   252      *
       
   253      * @since S60 v3.2
       
   254      * @param aLoop The loop id
       
   255      * @return None
       
   256      */
       
   257     IMPORT_C virtual void HandleRangeLoopEvent( TInt aLoop );
       
   258     
       
   259 	/**
       
   260      * Handler for shift and capslock merged button clicked
       
   261      *
       
   262      * @since S60 v3.2
       
   263      * @param aMode The mode of the mutimode button
       
   264      * @return None
       
   265      */
       
   266     IMPORT_C virtual void HandleMergedBtnClicked( TInt aCase );
       
   267     
       
   268     /**
       
   269      * Handler for shift button clicked
       
   270      *
       
   271      * @since S60 v3.2
       
   272      * @return None
       
   273      */
       
   274     IMPORT_C virtual void HandleShiftBtnClicked();
       
   275 
       
   276     /**
       
   277      * Handler for capslock button clicked
       
   278      *
       
   279      * @since S60 v3.2
       
   280      * @return None
       
   281      */
       
   282     IMPORT_C virtual void HandleCapslockBtnClicked();
       
   283     
       
   284     /**
       
   285      * Handler for shif and capslock button clicked
       
   286      *
       
   287      * @since S60 v3.2
       
   288      * @return None
       
   289      */
       
   290     IMPORT_C virtual void HandleShiftAndCapslockBtnClicked();
       
   291 
       
   292     /**
       
   293      * Draw window and shadow
       
   294      *
       
   295      * @since S60 v3.2
       
   296      * @return None
       
   297      */          
       
   298     IMPORT_C virtual void Draw();
       
   299     
       
   300     /**
       
   301      * Set if enable switch to hwr
       
   302      *
       
   303      * @since S60 v3.2
       
   304      * @param aEnable The enable flag
       
   305      * @return None
       
   306      */ 
       
   307     IMPORT_C void SetEnableSwitchToHwr(TBool aEnable);
       
   308     
       
   309     /**
       
   310      * Set if enable option button and language switch button
       
   311      *
       
   312      * @since S60 v3.2
       
   313      * @param aEnable The enable flag
       
   314      * @return None
       
   315      */ 
       
   316     IMPORT_C void SetEnableSettingBtn(TBool aEnable);
       
   317 
       
   318     /**
       
   319      * config unit size, reason may due to client layout id changed,
       
   320      * or screen resolution changed
       
   321      *
       
   322      * @since S60 v3.2
       
   323      * @param aClientLayoutId New client layout id
       
   324      * @return ETrue means unit size changed, otherwise EFalse
       
   325      */
       
   326     IMPORT_C virtual TBool ReconfigUnitSize(TInt aClientLayoutId);
       
   327     
       
   328     /**
       
   329      * Get numeric keymapping resource id
       
   330      *
       
   331      * @since S60 v3.2
       
   332      * @return The id of numeric keymapping
       
   333      */ 
       
   334     virtual TInt GetNumKeymappingResId() = 0;
       
   335     
       
   336     IMPORT_C void CPeninputLayoutWindowExt::SetTextAlignmentL( TInt aAlignment );
       
   337        
       
   338 protected:
       
   339 
       
   340     /**
       
   341      * constructor
       
   342      *
       
   343      * @since S60 v3.2
       
   344      * @param aUiLayout The pointer to CFepUiLayout object
       
   345      * @param aLayoutContext The pointer to MPeninputLayoutContext
       
   346      * @return None
       
   347      */
       
   348     IMPORT_C CPeninputLayoutWindowExt( CFepUiLayout* aUiLayout, 
       
   349                                     MPeninputLayoutContext* aLayoutContext );
       
   350 
       
   351     /**
       
   352      * Second-phase constructor
       
   353      *
       
   354      * @since S60 v3.2
       
   355      * @return None
       
   356      */ 
       
   357     IMPORT_C void ConstructL();
       
   358     /**
       
   359      * From CAknFepCtrlBaseWindow
       
   360      * Close window
       
   361      *
       
   362      * @since S60 v3.2
       
   363      * @return The TBool indicating the result of close operation
       
   364      */ 
       
   365     IMPORT_C TBool DoClose();
       
   366     
       
   367     /**
       
   368      * Construct from resource file
       
   369      *
       
   370      * @since S60 v3.2
       
   371      * @param aResReader The resource reader
       
   372      * @param aResUtils The resource utils
       
   373      * @return None
       
   374      */     
       
   375     //IMPORT_C virtual void ConstructFromResourceL( 
       
   376                                      //TResourceReader& aResReader );
       
   377 
       
   378     /** 
       
   379      * ConstructFromResourceL load settings from resource.
       
   380      * Before calling this function, the resource id should be set
       
   381      *
       
   382      * @since S60 v3.2
       
   383      * @return None
       
   384      */
       
   385     //IMPORT_C void ConstructFromResourceL();
       
   386     
       
   387      /**
       
   388      * Add not owned control into the window
       
   389      *
       
   390      * @since S60 v3.2
       
   391      * @param aControl The control to be added
       
   392      * @return None
       
   393      */  
       
   394     IMPORT_C void AddNotOwnedControl( CFepUiBaseCtrl* aControl );
       
   395 
       
   396     /**
       
   397      * Change button status
       
   398      *
       
   399      * @since S60 v3.2
       
   400      * @param aIsDown The button is down or not
       
   401      * @param aControlId The destination button id
       
   402      * @return None
       
   403      */  
       
   404     
       
   405     IMPORT_C void ChangeButtonStatus(const TInt aIsDown, const TInt aControlId);
       
   406 	
       
   407 	/**
       
   408      * Change Merged shift and capslock button status
       
   409      *
       
   410      * @since S60 v3.2
       
   411      * @param aIsShiftCase when shift case
       
   412      * @param aIsCapslockCase when capslock case
       
   413      * @return None
       
   414      */  
       
   415     
       
   416 	IMPORT_C void ChangeMergedButtonStatus(	const TInt aIsShiftCase, 
       
   417 	    								 	const TInt aIsCapslockCase );    								 
       
   418 			
       
   419     /**
       
   420      * Change layout position
       
   421      *
       
   422      * @since S60 v3.2
       
   423      * @return The new rectangle of layout
       
   424      */      
       
   425     IMPORT_C void ChangeLayoutPosition( TInt aJustifyStyle );
       
   426     
       
   427     /**
       
   428      * Set the window rect
       
   429      *
       
   430      * @since S60 v3.2
       
   431      * @param aRect The new rect of the window
       
   432      * @return None
       
   433      */                                            
       
   434     IMPORT_C void SetWindowRect(const TRect& aRect);
       
   435 
       
   436     /**
       
   437      * Read icf bitmap from resource
       
   438      *
       
   439      * @since S60 v3.2
       
   440      * @param aResReader The reource reader
       
   441      * @return None
       
   442      */
       
   443     //IMPORT_C void ReadIcfInfo( TResourceReader aResReader );
       
   444     
       
   445     /**
       
   446      * Set text font for language switch button.
       
   447      *
       
   448      * @since S60 v3.2
       
   449      * @param aSwitchBtn Pointer to language switch button
       
   450      * @return None
       
   451      */
       
   452     IMPORT_C void SetSwitchBtnFont(CAknFepCtrlEventButton& aSwitchBtn);
       
   453     
       
   454     /**
       
   455      * Set text color for language switch button.
       
   456      *
       
   457      * @since S60 v3.2
       
   458      * @param aSwitchBtn Pointer to language switch button
       
   459      * @return None
       
   460      */
       
   461     IMPORT_C void SetSwitchBtnTextColor(CAknFepCtrlEventButton& aSwitchBtn);
       
   462     
       
   463     
       
   464     /**
       
   465      * Change size for base window, such as move button,drag button etc.
       
   466      *
       
   467      * @since S60 v3.2
       
   468      * @return None
       
   469      */
       
   470     IMPORT_C  virtual void SizeChangedForBaseWindow( TInt aTotalColumns ); 
       
   471     
       
   472     IMPORT_C virtual void SetLafLayOut(TInt aRows, TInt aColumns);   
       
   473     
       
   474     IMPORT_C virtual void SetVkbLayoutSize();
       
   475     
       
   476     virtual TBool CreateCustomControlL( TInt16 aControlId, TInt32 aImageId );
       
   477     
       
   478     virtual void AddCustomControlGroupL(CFepUiBaseCtrl* aCtrl);
       
   479 
       
   480 private:
       
   481 
       
   482     /**
       
   483      * Read laf of shadow
       
   484      *
       
   485      * @since S60 v3.2
       
   486      * @param aRect the parent window
       
   487      * @return None
       
   488      */
       
   489     void ReadLafForShadow();
       
   490     
       
   491     /**
       
   492      * Check whether or not the resource file exists
       
   493      *
       
   494      * @since S60 v3.2
       
   495      * @param aFileName The name of resource file
       
   496      * @return The TBool indicating existance of resource file
       
   497      */
       
   498     TBool CheckResourceExist( const TDesC& aFileName );
       
   499     
       
   500     /**
       
   501      * Get case decided by shift&caps status
       
   502      *
       
   503      * @since S60 v3.2
       
   504      * @return The case value
       
   505      */
       
   506     TInt CaseByShiftCapslockStatus();
       
   507     
       
   508     /**
       
   509      * Dim keys
       
   510      *
       
   511      * @since S60 v3.2
       
   512      * @return None
       
   513      */
       
   514     void DimKeys();
       
   515     void DimKeysL();    
       
   516     
       
   517     /**
       
   518      * Change range bar
       
   519      *
       
   520      * @since S60 v3.2
       
   521      * @return None
       
   522      */
       
   523     void ChangeRangeBarL();
       
   524     
       
   525     /**
       
   526      * Change window position
       
   527      *
       
   528      * @since S60 v3.2
       
   529      * @return None.
       
   530      */    
       
   531     void TopLeftJustify();
       
   532 
       
   533     /**
       
   534      * Change window position
       
   535      *
       
   536      * @since S60 v3.2
       
   537      * @return None.
       
   538      */    
       
   539     void BottomRightJustify();
       
   540 
       
   541     /**
       
   542      * Change window position
       
   543      *
       
   544      * @since S60 v3.2
       
   545      * @return None.
       
   546      */    
       
   547     void DataQueryJustify();
       
   548         
       
   549     /**
       
   550      * Get key mapping string from resource or user defined mappings
       
   551      *
       
   552      * @since S60 v3.2
       
   553      * @param aKeyMapping The key mapping enum
       
   554      * @return None.
       
   555      */    
       
   556     HBufC* GetKeyMappingStringL( TInt aKeyMapping, const TInt aLang );
       
   557     
       
   558     void ResetLastColRow();
       
   559 protected: // data
       
   560 
       
   561     /**
       
   562      * The layout config
       
   563      * Own
       
   564      */    
       
   565     CPeninputLayoutConfig* iConfigInfo;
       
   566 
       
   567     /**
       
   568      * The layout context
       
   569      * Not own
       
   570      */
       
   571     MPeninputLayoutContext* iLayoutContext;        
       
   572 
       
   573     /**
       
   574      * The numeric kep mapping manager
       
   575      * Own
       
   576      */        
       
   577     CPeninputNumericKepMappingMgr* iKeyMappingMgr;
       
   578         
       
   579     /**
       
   580      * Vkb layout
       
   581      * Own
       
   582      */ 
       
   583     CAknFepCtrlVkbLayout* iVkbLayout;
       
   584 
       
   585     /**
       
   586      * Language is changed
       
   587      */
       
   588     TBool iLangOrSizeChanged;
       
   589 
       
   590     /**
       
   591      * The total column for the window
       
   592      */
       
   593     TInt iLastUsedTotalColumns;
       
   594 
       
   595     TInt iLastUsedTotalRows;
       
   596 
       
   597     /**
       
   598      * The resource id of window
       
   599      */
       
   600     TInt iWinResId;
       
   601 
       
   602     /**
       
   603      * The resource id of config
       
   604      */
       
   605     TInt iConfigResId;
       
   606     
       
   607     /**
       
   608      * Width of top left shadow rect
       
   609      */
       
   610     TInt iShadowTlWidth;
       
   611 
       
   612     /**
       
   613      * Height of top left shadow rect
       
   614      */
       
   615     TInt iShadowTlHeight;
       
   616 
       
   617     /**
       
   618      * Width of bottom right shadow rect
       
   619      */
       
   620     TInt iShadowBrWidth;
       
   621 
       
   622     /**
       
   623      * Height of bottom right shadow rect
       
   624      */
       
   625     TInt iShadowBrHeight;
       
   626     
       
   627     /**
       
   628      * First time construct flag
       
   629      */
       
   630     TBool iFirstTimeConstruct;        
       
   631     
       
   632     /**
       
   633      * Switch button font id
       
   634      */
       
   635     TInt32 iSwitchFont;
       
   636     
       
   637     /**
       
   638      * Switch button shadow font id
       
   639      */
       
   640     TInt32 iSwitchShadowFont;
       
   641     
       
   642     /**
       
   643      * Indicate whether switch(shadow) font has been set
       
   644      */
       
   645     TBool iSwitchFontSet;
       
   646     
       
   647     /**
       
   648      * Indicate whether need size change when change unit size
       
   649      */
       
   650     TBool iUnitSizeChange;
       
   651     
       
   652     /**
       
   653      * Tone mark set for Viet
       
   654      */
       
   655     HBufC* iToneSet;
       
   656     
       
   657     /**
       
   658      * Vowel char flag for Viet
       
   659      */
       
   660     TBool iVowelChar;
       
   661     };
       
   662 #endif // C_CPeninputLayoutWindowExt_H