textinput/peninputgenerichwr/inc/peninputgenerichwrwindow.h
changeset 0 eb1f2e154e89
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 hwr window layout class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_PENINPUTGENERICHWRWINDOW_H
       
    20 #define C_PENINPUTGENERICHWRWINDOW_H
       
    21 
       
    22 // System includes
       
    23 #include <peninputlayoutwindow.h>
       
    24 
       
    25 // Forward declarations
       
    26 class CFepUiBaseCtrl;
       
    27 class CAknFepCtrlRangeBar;
       
    28 class CAknFepCtrlEventButton;
       
    29 class CTransparentHwrWndExt;
       
    30 class CPeninputLayoutInputmodelChoice;
       
    31 class CFepLayoutMultiLineIcf;
       
    32 
       
    33 // Constants
       
    34 const TInt KMaxFileLength = 80;
       
    35 
       
    36 /**
       
    37  *  Hwr layout window class
       
    38  *  This class define methods to deal with window layout and 
       
    39  *  handle events sent to this window
       
    40  *
       
    41  *  @lib peninputgenerichwr.lib
       
    42  *  @since S60 v3.2
       
    43  */
       
    44 class CPeninputGenericHwrWindow : public CPeninputLayoutWindow
       
    45     {
       
    46 
       
    47 public:
       
    48 
       
    49     /**
       
    50      * Two-phased constructor
       
    51      *
       
    52      * @since S60 v3.2
       
    53      * @param aUiLayout The plugin ui layout
       
    54      * @param aLayoutContext The hwr layout context
       
    55      * @return The pointer to CPeninputGenericHwrWindow object
       
    56      */
       
    57     static CPeninputGenericHwrWindow* NewL( CFepUiLayout* aUiLayout, 
       
    58         MPeninputLayoutContext* aLayoutContext );
       
    59     
       
    60     /**
       
    61      * Destructor
       
    62      *
       
    63      * @since S60 v3.2
       
    64      * @return None
       
    65      */
       
    66     virtual ~CPeninputGenericHwrWindow();
       
    67     
       
    68     /**
       
    69      * Do when case changed
       
    70      *
       
    71      * @since S60 v3.2
       
    72      * @param aNewCase The new case
       
    73      * @return None
       
    74      */
       
    75     void DoCaseChange( TInt aNewCase );
       
    76 
       
    77 // From base class CPeninputLayoutWindow
       
    78 
       
    79     /**
       
    80      * From CPeninputLayoutWindow
       
    81      * Handle control event 
       
    82      *
       
    83      * @since S60 v3.2
       
    84      * @param aEventType The event type
       
    85      * @param aCtrl The control who sends the event
       
    86      * @param aEventData The event data
       
    87      * @return None
       
    88      */
       
    89     void HandleControlEvent( TInt aEventType,
       
    90                              CFepUiBaseCtrl* aCtrl, 
       
    91                              const TDesC& aEventData );
       
    92    
       
    93     /**
       
    94      * From CPeninputLayoutWindow
       
    95      * Get id of window config resource
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @return The id of window config resource
       
    99      */
       
   100     TInt GetWindowConfigResId();
       
   101 
       
   102     /**
       
   103      * From CPeninputLayoutWindow
       
   104      * Get id of window resource
       
   105      *
       
   106      * @since S60 v3.2
       
   107      * @return The id of window resource
       
   108      */ 
       
   109     TInt GetWindowResId();
       
   110 
       
   111     /**
       
   112      * From CPeninputLayoutWindow
       
   113      * Get file name of window config resource
       
   114      *
       
   115      * @since S60 v3.2
       
   116      * @param aLangID The id of language
       
   117      * @return The file name of window config resource
       
   118      */ 
       
   119     const TDesC& GetWindowConfigResFileName( TInt aLangID );
       
   120 
       
   121     /**
       
   122      * From CPeninputLayoutWindow
       
   123      * Get file name of window resource
       
   124      *
       
   125      * @since S60 v3.2
       
   126      * @return The file name of window resource
       
   127      */ 
       
   128     const TDesC& GetWindowResFileName();
       
   129 
       
   130     /**
       
   131      * From CPeninputLayoutWindow
       
   132      * Re-organize all controls in the assigned client area layout
       
   133      *
       
   134      * @since S60 v3.2
       
   135      * @param aClientLayoutId The id of client area layout
       
   136      * @return None
       
   137      */
       
   138     void ReorganizeControls( TInt aClientLayoutId, TBool aNeedReset=ETrue );
       
   139     
       
   140     /**
       
   141      * From CPeninputLayoutWindow
       
   142      * Change unit size
       
   143      *
       
   144      * @since S60 v3.2
       
   145      * @return The window rect
       
   146      */
       
   147     const TRect ChangeUnitSize();
       
   148   
       
   149     /**
       
   150      * From CPeninputLayoutWindow
       
   151      * Change size of client area
       
   152      *
       
   153      * @since S60 v3.2
       
   154      * @param aLeftTopPoint The left top point of client area
       
   155      * @return None
       
   156      */
       
   157     void ChangeClientSize();  
       
   158     
       
   159     /**
       
   160      * From CPeninputLayoutWindow
       
   161      * Construct all controls specified in resource
       
   162      *
       
   163      * @since S60 v3.2
       
   164      * @return None
       
   165      */
       
   166     void CreateAllControlsL();
       
   167     
       
   168     /**
       
   169      * From CPeninputLayoutWindow
       
   170      * Set control fonts. Fonts info comes from resource
       
   171      *
       
   172      * @since S60 v3.2
       
   173      * @return None
       
   174      */
       
   175     void SetControlsFont();
       
   176   
       
   177     /**
       
   178      * From CPeninputLayoutWindow
       
   179      * Pop up choice list
       
   180      *
       
   181      * @since S60 v3.2
       
   182      * @return None
       
   183      */
       
   184     void PopupChoiceList(); 
       
   185         
       
   186     /** 
       
   187      * ConstructFromResourceL load settings from resource.
       
   188      * Before calling this function, the resource id should be set
       
   189      *
       
   190      * @since S60 v3.2
       
   191      * @return None
       
   192      */
       
   193     void ConstructFromResourceL();
       
   194     
       
   195     void OnLanguageChange();
       
   196     
       
   197 void Move(const TPoint& aOffset);
       
   198 protected:
       
   199 
       
   200     /**
       
   201      * Constructor
       
   202      *
       
   203      * @since S60 v3.2
       
   204      * @param aUiLayout The plugin ui layout
       
   205      * @param aLayoutContext The hwr layout context
       
   206      * @return None
       
   207      */
       
   208     CPeninputGenericHwrWindow( CFepUiLayout* aUiLayout, 
       
   209                                MPeninputLayoutContext* aLayoutContext );
       
   210 
       
   211     /**
       
   212      * Second-phase constructor
       
   213      *
       
   214      * @since S60 v3.2
       
   215      * @return None
       
   216      */
       
   217     void ConstructL();
       
   218     
       
   219     virtual TBool IsMultiLineIcf();
       
   220 
       
   221     virtual TBool IsCanChangeRange(TInt aRange);
       
   222     
       
   223     virtual void ChangeToPreviousRange(TInt aRange);    
       
   224 private:
       
   225 
       
   226     /**
       
   227      * Add range bar into client area
       
   228      *
       
   229      * @since S60 v3.2
       
   230      * @return None
       
   231      */
       
   232     void AddRangeBarL();
       
   233 
       
   234     /**
       
   235      * Add button to client area
       
   236      *
       
   237      * @since S60 v3.2
       
   238      * @param aControlId The control id
       
   239      * @param aEventId The control's event id
       
   240      * @param aResId The control's resource id
       
   241      * @param aUnicode The control's unicode
       
   242      * @param aIsRepeat The TBool indicating whether the 
       
   243      *        control is repeated or not
       
   244      * @return The pointer to CAknFepCtrlEventButton object
       
   245      */    
       
   246     CAknFepCtrlEventButton* AddButtonL( const TInt aControlId,
       
   247                                         const TInt aEventId,
       
   248                                         const TInt aResId,
       
   249                                         const TInt aUnicode = 0,
       
   250                                         const TBool aIsRepeat = EFalse );
       
   251 
       
   252     /**
       
   253      * Add hwr box to client area
       
   254      *
       
   255      * @since S60 v3.2
       
   256      * @return None
       
   257      */
       
   258     void AddHwBoxL();
       
   259     
       
   260     /**
       
   261      * Set frame color of hwr write box
       
   262      *
       
   263      * @since S60 v3.2
       
   264      * @return None
       
   265      */
       
   266     void SetHwBoxFrameBackColor();
       
   267 
       
   268     /**
       
   269      * Handle EEventHwrStrokeStarted event. The message is reported each time
       
   270      * pen down in the HWR box area
       
   271      *
       
   272      * @since S60 v3.2
       
   273      * @return None
       
   274      */
       
   275     void OnStrokeStarted();
       
   276 
       
   277     /**
       
   278      * Handle EEventHwrStrokeFinished event. The message is reported when
       
   279      * StrokeTimer times out
       
   280      *
       
   281      * @since S60 v3.2
       
   282      * @return None
       
   283      */
       
   284     void OnStrokeFinished();
       
   285 
       
   286     /**
       
   287      * Handle EEventHwrCharacterTimerOut event. The message is reported when
       
   288      * CharacterTimer times out
       
   289      *
       
   290      * @since S60 v3.2
       
   291      * @return None
       
   292      */
       
   293     void OnStrokeCharacterTimerOut();
       
   294 
       
   295     /**
       
   296      * Handle EEventHwrStrokeCanceled event. The message is reported when
       
   297      * manually cancel writing
       
   298      *
       
   299      * @since S60 v3.2
       
   300      * @return None
       
   301      */
       
   302     void OnStrokeCanceled();
       
   303 
       
   304     /**
       
   305      * Draw guide line
       
   306      *
       
   307      * @since S60 v3.2
       
   308      * @return None
       
   309      */
       
   310     void DrawGuideLine();
       
   311     
       
   312     /**
       
   313      * Calculate guide line position
       
   314      *
       
   315      * @since S60 v3.2
       
   316      * @return None
       
   317      */
       
   318     void CalculateGuideLinePos();
       
   319     
       
   320     /**
       
   321      * Popup input mode switch list
       
   322      *
       
   323      * @since S60 v3.2
       
   324      * @return None
       
   325      */
       
   326     void PopupSwitchWindow();
       
   327     
       
   328     void OnDeActivate();
       
   329     
       
   330     void SubmitRecognitionResult( HBufC* aRes );
       
   331 private:
       
   332 
       
   333     /**
       
   334      * The handwriting box
       
   335      * Not own
       
   336      */
       
   337     CTransparentHwrWndExt* iHwBox;
       
   338     
       
   339     /**
       
   340      * The range bar
       
   341      * Not own
       
   342      */
       
   343     CAknFepCtrlRangeBar* iRangeBar;
       
   344     
       
   345     /**
       
   346      * The language switch button
       
   347      * Not own
       
   348      */
       
   349     CAknFepCtrlEventButton* iLangSwitchBtn;
       
   350     
       
   351     /**
       
   352      * The resource file name
       
   353      */
       
   354     TBuf<KMaxFileLength> iResourceFilename;
       
   355             
       
   356     /**
       
   357      * The array to hold stroke points
       
   358      */
       
   359     RArray<TPoint> iStrokeArray;
       
   360     
       
   361     /**
       
   362      * The array to hold recognize result
       
   363      */
       
   364     RPointerArray<HBufC> iRecogResult;
       
   365     
       
   366     HBufC* iLastResult;
       
   367     
       
   368     /**
       
   369      * Normal transparency factor of hwr write box
       
   370      */
       
   371     TInt iNormalTransFactor;
       
   372 
       
   373     /**
       
   374      * Writting transparency factor of hwr write box
       
   375      */
       
   376     TInt iWriteTransFactor;
       
   377     
       
   378     TBool iDisableCaseChange;
       
   379     TInt  iCachedCase;
       
   380     
       
   381     TRect iHwrWndRect;
       
   382     
       
   383     TPoint iGuideLineTopTl;
       
   384     TPoint iGuideLineTopBr;
       
   385     TPoint iGuideLineBottomTl;
       
   386     TPoint iGuideLineBottomBr;
       
   387     TBool iGuideLineSet;
       
   388     TBool iCharacterStart;
       
   389 
       
   390     CPeninputLayoutInputmodelChoice* iModeSwitchChoice;
       
   391     };
       
   392 
       
   393 #endif // C_PENINPUTGENERICHWRWINDOW_H