textinput/peninputfingerhwrar/inc/peninputfingerhwrarlayout.h
branchRCL_3
changeset 3 f5a1e66df979
child 5 a47de9135b21
equal deleted inserted replaced
0:eb1f2e154e89 3:f5a1e66df979
       
     1 /*
       
     2 * Copyright (c) 2005-2008 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 for finger hwr UiLayout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PENINPUTFINGERHWRARLAYOUT_H
       
    20 #define C_PENINPUTFINGERHWRARLAYOUT_H
       
    21 
       
    22 // INCLUDES
       
    23 #include "peninputpluginutils.h"
       
    24 #include "peninputlayout.h"
       
    25 #include "peninputfingerhwrarstoreconstants.h"
       
    26 #include "peninputfingerhwrarcontrolid.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CPeninputFingerHwrArStateManagerBase;
       
    30 class CPeninputFingerHwrArDataStore;
       
    31 class CRepository;
       
    32 class CPeninputFingerHwrArWnd;
       
    33 
       
    34 // class DECLARATIONS
       
    35 
       
    36 /**
       
    37  *  class CPeninputHwrfscnLayout.
       
    38  *
       
    39  *  Chinese full screen handwriting ui layout class.
       
    40  *
       
    41  *  @lib peninputfingerhwr.lib
       
    42  *  @since S60 v5.0
       
    43  */
       
    44 class CPeninputFingerHwrArLayout : public CFepUiLayout
       
    45     {
       
    46 public:
       
    47     /**
       
    48      * The writing speed.
       
    49      *
       
    50      *@since S60 v5.0
       
    51      */
       
    52     enum TWritingSpeed
       
    53         {
       
    54         EWritingSpeedVeryFast = 1,
       
    55         EWritingSpeedFast,
       
    56         EWritingSpeedNormal,
       
    57         EWritingSpeedSlow,
       
    58         EWritingSpeedVerySlow
       
    59         };
       
    60 public:
       
    61     /** 
       
    62      * Symbian constructor.
       
    63      *
       
    64      * @since S60 5.0
       
    65      * 
       
    66      * @param aLayoutOwner The MLayoutOwner
       
    67      * @param aInitData Init data for layout
       
    68      * @return Pointer to created CPeninputHwrfscnLayout object
       
    69      */
       
    70     static CPeninputFingerHwrArLayout* NewL(MLayoutOwner* aLayoutOwner,
       
    71             const TAny* aInitData);
       
    72 
       
    73 public:
       
    74     //from CFepUiLayout
       
    75     /**
       
    76      * From CFepUiLayout.
       
    77      * Handle layout command event
       
    78      *
       
    79      * @since Series 60 5.0
       
    80      * @param aCmd Command Id.
       
    81      * @param aData Data for command.
       
    82      * @return Errors when return value small than 0.    
       
    83      */
       
    84     TInt HandleCommand(const TInt aCmd, TUint8* aData);
       
    85     
       
    86     /**
       
    87      * From CFepUiLayout.
       
    88      * Handle layout command event
       
    89      *
       
    90      * @since Series 60 5.0
       
    91      * @param aCmd Command Id.
       
    92      * @param aData Data for command.
       
    93      * @return Errors when return value small than 0.    
       
    94      */
       
    95     TInt HandleCommandL(const TInt aCmd, TUint8* aData);
       
    96 
       
    97     /**
       
    98      * From CFepUiLayout.
       
    99      * Inform layout the size changing event
       
   100      *
       
   101      * @since Series 60 5.0
       
   102      * @param pData The event data.
       
   103      * @return KErrNone if successfully size changing. 
       
   104      */
       
   105     TInt SizeChanged(const TAny* pData);
       
   106 
       
   107     /**
       
   108      * From CFepUiLayout.
       
   109      * Handle editor text coming
       
   110      * Called by animation dll when app editor text is coming.
       
   111      * If a ui layout has a editor area, it must implements this function to get the text
       
   112      *
       
   113      * @since Series 60 5.0
       
   114      * @param aData The fep input context field data
       
   115      * @return KErrNone is operation succeeded.    
       
   116      */
       
   117     TInt OnAppEditorTextComing(const TFepInputContextFieldData& aData);
       
   118 
       
   119     /**
       
   120      * From CFepUiLayout.
       
   121      * Handle application info change
       
   122      *
       
   123      * @since Series 60 5.0
       
   124      * @param aInfo The information.
       
   125      * @param aType The information type.
       
   126      * @return none
       
   127      */
       
   128     void HandleAppInfoChange(const TDesC& aInfo, TPeninputAppInfo aType);
       
   129 
       
   130     
       
   131     /**
       
   132      * From CFepUiLayout
       
   133      * Called by owner when the system resource changed event.
       
   134      *
       
   135      * @since S60 v4.0
       
   136      * @param aType the event type
       
   137      * @return KErrNone if successfully size changing. 
       
   138      */
       
   139     TInt OnResourceChange(TInt aType);
       
   140     
       
   141     /**
       
   142      * From MPenUiLayoutBase
       
   143      * Return the peninput ui type
       
   144      *
       
   145      * @since Series 60 5.0
       
   146      * @return The ui type @see TPenInputUiType
       
   147      */
       
   148     TInt PenInputType();
       
   149 
       
   150     /**
       
   151      * From MFepLayoutBase        
       
   152      * Called by owner when the layout is going to be hidden
       
   153      *
       
   154      * @since S60 5.0
       
   155      * @return none
       
   156      */
       
   157     void OnDeActivate();
       
   158     
       
   159 public:
       
   160     //from MEventObserver;    
       
   161     /**
       
   162      * From MEventObserver 
       
   163      * handle control event.
       
   164      * 
       
   165      * @since Series 60 5.0
       
   166      * @param aEventType The event type
       
   167      * @param aCtrl The control who sends the event
       
   168      * @param aEventData The event data
       
   169      * @return none
       
   170      */
       
   171     void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   172             const TDesC& aEventData);
       
   173     void HandleControlEventL(TInt aEventType, CFepUiBaseCtrl* aCtrl,
       
   174             const TDesC& aEventData);
       
   175 
       
   176 public:
       
   177 
       
   178     /**
       
   179      * Get the data stroe object.
       
   180      * 
       
   181      * @since Series 60 5.0
       
   182      * @return The CPeninputHwrfscnDataStore reference
       
   183      */
       
   184     CPeninputFingerHwrArDataStore& DataStore();
       
   185 
       
   186     /**
       
   187      * Replace the char before the cursor in forground app with a new char.
       
   188      *
       
   189      * @since S60 5.0
       
   190      * @param aOldCharCode The old char need to be replaced
       
   191      * @param aNewCharCode The new char for replacing the old char
       
   192      * @return none
       
   193      */
       
   194     void Replace(const TDesC& aOldCharCode, const TDesC& aNewCharCode,
       
   195             const TBool aIsPart = EFalse);
       
   196 
       
   197     /**
       
   198      * Submit string to layout owner.
       
   199      *
       
   200      * @since S60 5.0
       
   201      * @param aCharCode The buffer needed to be submitted.
       
   202      * @return none
       
   203      */
       
   204     void SubmitStringToFep(const TDesC& aCharCode);
       
   205 
       
   206     /**
       
   207      * Submit char to layout owner.
       
   208      *
       
   209      * @since S60 5.0
       
   210      * @param aCharCode The buffer needed to be submitted.
       
   211      * @return none
       
   212      */    
       
   213     void SubmitCharToFep(const TInt aCharCode);
       
   214 
       
   215     /**
       
   216      * repository callback for settings.
       
   217      *
       
   218      * @since S60 5.0
       
   219      * @param aPtr callback data.
       
   220      * @return error code.
       
   221      */
       
   222     static TInt HandleGSRepositoryCallBack(TAny* aPtr);
       
   223     
       
   224     /**
       
   225      * load default settings.
       
   226      * 
       
   227      * @since S60 5.0
       
   228      * @param aSetPosFlag The buffer needed to be submitted.
       
   229      * @return none
       
   230      */
       
   231     void LoadAndPublishDefaultL();
       
   232     
       
   233 
       
   234     /**
       
   235      * sync stroke end mark of writingbox with hwr engine.
       
   236      * 
       
   237      * @param aEndMark a TPoint object as new stroke end mark.
       
   238      * @return none   
       
   239      */
       
   240     void SyncHwrStrokeEndMark(const TPoint&  aEndMark);
       
   241 
       
   242 private:
       
   243     /**
       
   244      * C++ constructor
       
   245      *
       
   246      * @since S60 5.0
       
   247      * @param aLayoutOwner The MLayoutOwner pointer.
       
   248      * @return none
       
   249      */
       
   250     CPeninputFingerHwrArLayout(MLayoutOwner* aLayoutOwner);
       
   251 
       
   252     /**
       
   253      * standard c++ destructor.
       
   254      *
       
   255      * @since S60 5.0
       
   256      * @return none
       
   257      */
       
   258     ~CPeninputFingerHwrArLayout();
       
   259 
       
   260     /**
       
   261      * Symbian second-phase constructor
       
   262      *
       
   263      * @since S60 5.0
       
   264      * @param aInitData The init data passed by layout engine.
       
   265      * @return none
       
   266      */
       
   267     void ConstructL(const TAny* aInitData);
       
   268 
       
   269 
       
   270     /**
       
   271      * Create the hwr box window
       
   272      *
       
   273      * @since S60 5.0
       
   274      * @return none
       
   275      */
       
   276     void CreateHwrWindowL();
       
   277 
       
   278     /**
       
   279      * Create the state manager
       
   280      *
       
   281      * @since S60 5.0
       
   282      * @return none
       
   283      */
       
   284     void CreateStateManagerL();
       
   285 
       
   286     
       
   287 private:
       
   288     /**
       
   289      * handler of button down event.
       
   290      *  
       
   291      * @since S60 5.0
       
   292      * @param aEventType event type id.
       
   293      * @param aCtrl event src.
       
   294      * @param aEventData event data.
       
   295      * @return none
       
   296      */
       
   297     void OnCtrlButtonDownL(TInt aEventType, CFepUiBaseCtrl* aCtrl,  
       
   298             const TDesC& aEventData);
       
   299 
       
   300     /**
       
   301      * handler of button up event.
       
   302      *  
       
   303      * @since S60 5.0
       
   304      * @param aEventType event type id.
       
   305      * @param aCtrl event src.
       
   306      * @param aEventData event data.
       
   307      * @return none
       
   308      */
       
   309     void OnCtrlButtonUpL(TInt aEventType, CFepUiBaseCtrl* aCtrl, 
       
   310             const TDesC& aEventData);
       
   311 
       
   312     /**
       
   313      * handler of rep-button clicked event.
       
   314      *  
       
   315      * @since S60 5.0
       
   316      * @param aCtrl event src.
       
   317      * @param aData event data.
       
   318      * @return none
       
   319      */    
       
   320     void OnRepButtonClickedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   321 
       
   322     /**
       
   323      * clicked event handler of the BACKSPACE button.
       
   324      *  
       
   325      * @since S60 5.0
       
   326      * @return none
       
   327      */     
       
   328     void OnBackspaceClickedL();
       
   329     
       
   330     /**
       
   331      * handler of virtual key down event.
       
   332      *  
       
   333      * @since S60 5.0
       
   334      * @param aCtrl event src.
       
   335      * @param aData event data.
       
   336      * @return none
       
   337      */ 
       
   338     void OnVirtualKeyDownL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   339     
       
   340     /**
       
   341      * handler of virtual key up event.
       
   342      *  
       
   343      * @since S60 5.0
       
   344      * @param aCtrl event src.
       
   345      * @param aData event data.
       
   346      * @return none
       
   347      */     
       
   348     void OnVirtualKeyUpL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   349     
       
   350     /**
       
   351      * handler of candidate list event.
       
   352      *  
       
   353      * @since S60 5.0
       
   354      * @param aCtrl event src.
       
   355      * @param aData event data.
       
   356      * @return none
       
   357      */     
       
   358     void OnCandidateSelectedL(CFepUiBaseCtrl* aCtrl, const TDesC& aData);
       
   359     
       
   360     /**
       
   361      * clicked event handler of icf.
       
   362      *  
       
   363      * @since S60 5.0
       
   364      * @return none
       
   365      */
       
   366     void OnIcfClicked();
       
   367 
       
   368     /**
       
   369      * handler of StrokeStarted event.
       
   370      *  
       
   371      * @since S60 5.0
       
   372      * @return none
       
   373      */
       
   374     void OnHwrStrokeStartedL();
       
   375 
       
   376     /**
       
   377      * handler of StrokeFinished event.
       
   378      *  
       
   379      * @since S60 5.0
       
   380      * @return none
       
   381      */    
       
   382     void OnHwrStrokeFinishedL();
       
   383     
       
   384     /**
       
   385      * handler of CharacterFinished event.
       
   386      *  
       
   387      * @since S60 5.0
       
   388      * @return none
       
   389      */    
       
   390     void OnHwrCharacterFinishedL();
       
   391 
       
   392 private:
       
   393     /**
       
   394      * get value from repository
       
   395      * 
       
   396      * @since S60 v5.0
       
   397      * @param aWatcher repository reader.
       
   398      * @param aId value id.
       
   399      * @return value
       
   400      */
       
   401     TInt GetNewValue(CAknFepRepositoryWatcher* aWatcher, const TInt aId);
       
   402     
       
   403     /**
       
   404      * get hwr trail color from repository
       
   405      * 
       
   406      * @since S60 v5.0
       
   407      * @return color value.
       
   408      */    
       
   409     TInt GetPenTrailColor();
       
   410     
       
   411 
       
   412     /**
       
   413      * set hwr writing speed.
       
   414      * 
       
   415      * @since S60 v5.0
       
   416      * @param aWritingSpeed speed
       
   417      * @return none
       
   418      */    
       
   419     void SetWritingSpeed(const TInt aWritingSpeed);
       
   420     
       
   421     /**
       
   422      * set hwr writing pen width.
       
   423      * 
       
   424      * @since S60 v5.0
       
   425      * @param aWritingSpeed speed
       
   426      * @return none
       
   427      */     
       
   428     void SetBoxPenSize(const TSize aPenSize);
       
   429     
       
   430     /**
       
   431      * set hwr writing pen color.
       
   432      * 
       
   433      * @since S60 v5.0
       
   434      * @param aWritingSpeed speed
       
   435      * @return none
       
   436      */    
       
   437     void SetBoxPenColor(const TInt aPenColor);
       
   438 
       
   439     /**
       
   440      * set guide line on or off.
       
   441      * 
       
   442      * @since S60 v5.0
       
   443      * @param aGuideLineOn  guide line on or off.
       
   444      * @return none
       
   445      */    
       
   446     void SetGuideLineOn(const TBool aGuideLineOn);
       
   447     
       
   448     /**
       
   449      * get current state manager. 
       
   450      * 
       
   451      * @since S60 v5.0
       
   452      * @return current state manager  
       
   453      */
       
   454     CPeninputFingerHwrArStateManagerBase* CurStateManager();
       
   455     
       
   456     /**
       
   457      * change current state manager to standby state.
       
   458      * 
       
   459      * @since S60 v5.0
       
   460      * @return none 
       
   461      */
       
   462     void ChangeCurStateManagerToStandby();
       
   463 	
       
   464 private:
       
   465     
       
   466     /**
       
   467      * main window.
       
   468      * not own
       
   469      */
       
   470     CPeninputFingerHwrArWnd* iHwrWnd;
       
   471     
       
   472     /**
       
   473      * The data store
       
   474      * Own
       
   475      */
       
   476     CPeninputFingerHwrArDataStore* iDataStore;
       
   477 
       
   478     /**
       
   479      * The state manager
       
   480      * Own
       
   481      */
       
   482     RPointerArray<CPeninputFingerHwrArStateManagerBase> iStateMgrArray;
       
   483 
       
   484     /**
       
   485      * The resource Id
       
   486      * 
       
   487      */
       
   488     TInt iResId;
       
   489 
       
   490     /**
       
   491      * Repository watcher
       
   492      */
       
   493     CAknFepRepositoryWatcher* iGSRepositoryWatcher;
       
   494     
       
   495     /**
       
   496      * Repository object.
       
   497      */
       
   498     CRepository* iRepositorySetting;
       
   499     
       
   500     /**
       
   501      * Last overlap index.
       
   502      */
       
   503     TInt iLastOverlapIdx; 
       
   504     };
       
   505 #endif //C_PENINPUTFINGERHWRARLAYOUT_H