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