textinput/peninputhwrboxjp/inc/peninputhwrboxlayout.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2002-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:  hwr layout
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPENINPUTHWRBOXLAYOUT_H
       
    20 #define C_CPENINPUTHWRBOXLAYOUT_H
       
    21 
       
    22 //  System includes
       
    23 #include <peninputcommonlayout.h>
       
    24 
       
    25 /** class forward decalaration */
       
    26 class CPeninputHwrBoxWindow;
       
    27 class CPeninputHiraganaKanji;
       
    28 class CPeninputHwrBoxDataMgr;
       
    29 
       
    30 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
    31 #include <flogger.h>
       
    32 #endif
       
    33 
       
    34 /**
       
    35  *  peninputhwrboxjp layout
       
    36  *
       
    37  *  @lib peninputhwrboxjp.lib
       
    38  *  @since S60 v3.2
       
    39  */
       
    40 class CPeninputHwrBoxLayout : public CPeninputCommonLayout
       
    41     {
       
    42 
       
    43 public:
       
    44 
       
    45     /**
       
    46      * Symbian constructor.
       
    47      *
       
    48      * @since S60 v3.2
       
    49      * @param aLafEnv The LAF enviroment
       
    50      * @param aInitData Init data for layout
       
    51      * @return Pointer to created CPeninputHwrBoxLayout object
       
    52      */
       
    53     static CPeninputHwrBoxLayout* NewL(MLayoutOwner* aLayoutOwner, const TAny* aInitData);
       
    54 
       
    55     /**
       
    56      * destructor.
       
    57      *
       
    58      * @since S60 v3.2
       
    59      * @return None
       
    60      */
       
    61     virtual ~CPeninputHwrBoxLayout();
       
    62 
       
    63     /**
       
    64      * From MFepLayoutBase
       
    65      * HandleEventL. Handle UI event.
       
    66      * There are only 3 kinds of UI event right now: raw event,
       
    67      * pointer and pointer buffer event.
       
    68      *
       
    69      * @since S60 v4.0
       
    70      * @param aType The event type. See TEventType
       
    71      * @param aEventData The event data.
       
    72      * @return The control which processes the event
       
    73      */
       
    74     TBool HandleEventL(TEventType aType, const TAny* aEventData);
       
    75 
       
    76 //from CFepUiLayout
       
    77 
       
    78     /**
       
    79      * From CFepUiLayout.
       
    80      * Handle layout command event
       
    81      *
       
    82      * @since S60 v3.2
       
    83      * @param aCmd Command Id.
       
    84      * @param aData Data for command.
       
    85      * @return Errors when return value small than 0.
       
    86      */
       
    87     TInt HandleCommand(TInt aCmd, TUint8* aData);
       
    88 
       
    89     /**
       
    90      * From CFepUiLayout.
       
    91      * Handle the event from control
       
    92      *
       
    93      * @since S60 v3.2
       
    94      * @param aEventType The event type
       
    95      * @param aCtrl  The sender
       
    96      * @param aEventData The event data.
       
    97      * @return None
       
    98      */
       
    99     void HandleControlEvent(TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData);
       
   100 
       
   101     /**
       
   102      * Handle the event for Pen from control
       
   103      *
       
   104      * @since S60 v3.2
       
   105      * @param aEventType The event type
       
   106      * @param aCtrl  The sender
       
   107      * @param aEventData The event data.
       
   108      * @return
       
   109      */
       
   110     TBool HandleControlEventPen(TInt aEventType, CFepUiBaseCtrl* aCtrl, const TDesC& aEventData);
       
   111 
       
   112     /**
       
   113      * From CFepUiLayout.
       
   114      * Handle editor text coming
       
   115      * Called by animation dll when app editor text is coming.
       
   116      * If a ui layout has a editor area, it must implements this function to get the text
       
   117      *
       
   118      * @since S60 v3.2
       
   119      * @param aTotalTextLen The total editor text len
       
   120      * @param aTextStartPos The position of the selection in whole editor text
       
   121      * @param aCursolSel The cursor selection in the editor
       
   122      * @param aText The text sent by fep.
       
   123      * @return KErrNone is operation succeeded.
       
   124      */
       
   125     TInt OnAppEditorTextComing( const TFepInputContextFieldData& aData);
       
   126 
       
   127     /**
       
   128      * Submit the candidate.
       
   129      *
       
   130      * @since S60 v3.2
       
   131      * @param aCharCode The char code
       
   132      * @return None
       
   133      */
       
   134     void SubmitL(const TDesC& aCharCode);
       
   135 
       
   136     /**
       
   137      * Delete the candidate.
       
   138      *
       
   139      * @since S60 v3.2
       
   140      * @param aChar The delete key code
       
   141      * @return None
       
   142      */
       
   143     void DeleteL(TInt aChar = EKeyBackspace);
       
   144 
       
   145     /**
       
   146      * From CFepUiLayout.
       
   147      * Handle raw event key
       
   148      *
       
   149      * @since S60 v3.2
       
   150      * @param aData the key raw event data
       
   151      * @return ETrue if the key was handled, otherwise EFalse
       
   152      */
       
   153     TBool HandleRawKeyEventL(const TRawEvent& aKeyEvent);
       
   154 
       
   155     /**
       
   156      * From CFepUiLayout.
       
   157      * Handle pointer down/up event while this event is outside of the layout
       
   158      * Do nothing in default implementation
       
   159      *
       
   160      * @since S60 v4.0
       
   161      * @param aEvent The raw event
       
   162      * @return EFalse if the event needs forward on. Otherwise ETrue.
       
   163      */
       
   164     TBool OnPointerEventOutsideLayout(const TRawEvent& aEvent);
       
   165 
       
   166     /**
       
   167      * Get DataMgr Pointer
       
   168      *
       
   169      * @since S60 v3.2
       
   170      * @return DataMgr Pointer
       
   171      */
       
   172     CPeninputHwrBoxDataMgr* DataMgr(TInt aDummy);
       
   173 
       
   174     /**
       
   175      * Get  HwrBox Window Pointer
       
   176      *
       
   177      * @since S60 v3.2
       
   178      * @return HwrBox Window Pointer
       
   179      */
       
   180     CPeninputHwrBoxWindow* HwrBoxWindow();
       
   181 
       
   182     void ToPenStandBy(TBool aNotStandBy = EFalse);
       
   183 
       
   184     void Initialize();
       
   185 
       
   186     void CompleteIfConvertingL();
       
   187 
       
   188     /**
       
   189      * clear last input char and goto PenStandBy
       
   190      *
       
   191      * @since S60 v3.2
       
   192      * @return None
       
   193      */
       
   194     void ClearInputToPenStandByL();
       
   195 
       
   196 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   197     /**
       
   198      * write log "New"
       
   199      *
       
   200      * @since S60 V4.0
       
   201      */
       
   202     void WriteHwrStrokeLogNew();
       
   203 #endif
       
   204 
       
   205 private:
       
   206 
       
   207     /**
       
   208      * C++ default constructor
       
   209      *
       
   210      * @since S60 v3.2
       
   211      * @param aLafEnv The LAF enviroment
       
   212      * @return None
       
   213      */
       
   214     CPeninputHwrBoxLayout(MLayoutOwner* aLayoutOwner);
       
   215 
       
   216     /**
       
   217      * Symbian second-phase constructor
       
   218      *
       
   219      * @since S60 v3.2
       
   220      * @param aInitData Init data of layout
       
   221      * @return None
       
   222      */
       
   223     void ConstructL(const TAny* aInitData);
       
   224 
       
   225     /**
       
   226      * Set current range
       
   227      *
       
   228      * @since S60 v3.2
       
   229      * @return None.
       
   230      */
       
   231     void DoSetCurrentRange();
       
   232 
       
   233     /**
       
   234      * CompleteAll HiraganaKanji
       
   235      *
       
   236      * @since S60 v3.2
       
   237      * @return None.
       
   238      */
       
   239     void HiraganaKanjiCompleteAll();
       
   240 
       
   241 // From base class CPeninputCommonLayout
       
   242 
       
   243     /**
       
   244      * From CPeninputCommonLayout
       
   245      * Factory method for creation of layout window. The decision which
       
   246      * layout window(VKB or HWR) is created will be postboned in subclasses
       
   247      * of this class
       
   248      *
       
   249      * @since S60 v3.2
       
   250      * @return None
       
   251      */
       
   252     void CreateLayoutWindowL();
       
   253 
       
   254     /**
       
   255      * From CPeninputCommonLayout
       
   256      * Factory method for creation resource config. It is enough at present
       
   257      * to create and initialize resource config. Any necessary extension
       
   258      * will be implemented in subclasses
       
   259      *
       
   260      * @since S60 v3.2
       
   261      * @return None
       
   262      */
       
   263     void CreateDataMgrL( const TAny* aInitData );
       
   264 
       
   265 
       
   266     /**
       
   267      * From CPeninputCommonLayout
       
   268      * Get the layout type, VKB or HWR, child class must rewrite the function
       
   269      *
       
   270      * @since S60 v3.2
       
   271      * @return The layout type
       
   272      */
       
   273      TInt LayoutType();
       
   274 
       
   275     /**
       
   276      * SemiTransparencyRequired. Tell whether this layout require transparency.
       
   277      * This is to save memory used in mask bitmap. If transparency not deeded,
       
   278      * We use black-white bitmap.
       
   279      *
       
   280      * @since S60 v3.2
       
   281      * @return ETrue if layout require transparency, otherwise EFalse.
       
   282      */
       
   283     TBool SemiTransparencyRequired();
       
   284 
       
   285     /**
       
   286      * Translate range by fullhalf
       
   287      *
       
   288      * @since S60 v3.2
       
   289      * @param aRange The range need to set
       
   290      * @return New range
       
   291      */
       
   292     TInt TranslateRangeHullHalf(TInt aRange) const;
       
   293 
       
   294     // async
       
   295     static TInt KeyEventCallback(TAny* aThis);
       
   296     void DoKeyEventL();
       
   297     void DoPointerEvent();
       
   298     static TInt KeyEventClearCallback(TAny* aThis);
       
   299     static TInt PointerEventCallback(TAny* aThis);
       
   300     void DoKeyClearEventL();
       
   301 
       
   302     /**
       
   303      * PointerEvent Capture or not.
       
   304      *
       
   305      * @since S60 V4.0
       
   306      * @param aFlag ETrue if want to hide the control.
       
   307      */
       
   308     void SetCapturePointerEvent(TBool aFlag);
       
   309 
       
   310     /**
       
   311      * After Capture is rereased by fremawork, Capture On again
       
   312      *
       
   313      * @since S60 V4.0
       
   314      */
       
   315     void SetCapturePointerEventAgain();
       
   316 
       
   317     /**
       
   318      * HiraganaHandleControlEventJp
       
   319      *
       
   320      * @since S60 v3.2
       
   321      * @param aEventType The event type
       
   322      * @param aEventData The event data.
       
   323      * @return None
       
   324      */
       
   325     void HiraganaHandleControlEventJp(TInt aEventType, const TDesC& aEventData);
       
   326 
       
   327     /**
       
   328      * check if EStatusPredictiveTransitoryInputWithNoChar
       
   329      *
       
   330      * @since S60 v3.2
       
   331      * @return ETrue if EStatusPredictiveTransitoryInputWithNoChar, otherwise EFalse
       
   332      */
       
   333     TBool IsPredictiveWithNoChar() const;
       
   334 
       
   335 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   336     /**
       
   337      * write log "Clear"
       
   338      *
       
   339      * @since S60 V4.0
       
   340      */
       
   341     void WriteHwrStrokeLogClear();
       
   342 
       
   343     /**
       
   344      * write log character range
       
   345      *
       
   346      * @since S60 V4.0
       
   347      */
       
   348     void WriteHwrStrokeLogRange();
       
   349 #endif
       
   350 
       
   351 private: //data
       
   352     /**
       
   353      * The ui state for pen manager
       
   354      * Own
       
   355      */
       
   356     CPeninputUiStateMgr* iUiStatePenMgr;
       
   357 
       
   358     /**
       
   359      * The hwr window
       
   360      * Not Own
       
   361      */
       
   362     CPeninputHwrBoxWindow* iHwrWindow;
       
   363 
       
   364     /**
       
   365      * The hiraganakanji
       
   366      * Own
       
   367      */
       
   368     CPeninputHiraganaKanji* iHiraganaKanji;
       
   369 
       
   370     /**
       
   371      * status:WaitforEditorTextComing
       
   372      */
       
   373     TInt iWaitforEditorTextComing;
       
   374 
       
   375     /**
       
   376      * Active object for calling @c KeyEventCallback asynchronously.
       
   377      * Own.
       
   378      */
       
   379     CAsyncCallBack* iKeyEventAsync;
       
   380 
       
   381 
       
   382     /**
       
   383      * Active object for calling @c KeyEventClearCallback asynchronously.
       
   384      * Own.
       
   385      */
       
   386     CAsyncCallBack* iKeyEventClearAsync;
       
   387 
       
   388     /**
       
   389      * Active object for calling @c PointerEventCallback asynchronously.
       
   390      * Own.
       
   391      */
       
   392     CAsyncCallBack* iPointerEventAsync;
       
   393 
       
   394     TRawEvent iKeyEvent;
       
   395     TRawEvent iPointerEventDown;
       
   396 
       
   397     TBool iCapturePointerEvent;
       
   398 
       
   399     /**
       
   400      * The last Submit Text
       
   401      * Own
       
   402      */
       
   403     HBufC* iSubmitText; // own
       
   404 
       
   405     /**
       
   406      * The Original InputRange
       
   407      */
       
   408     TInt iRangeOrg;
       
   409 
       
   410     /**
       
   411      * The dropdownlist expanded
       
   412      */
       
   413     TBool iExpanded;
       
   414 
       
   415     /**
       
   416      * The drop down list control
       
   417      * Not own
       
   418      */
       
   419     CFepUiBaseCtrl* iDropdownList;
       
   420 
       
   421 #ifdef __PENINPUT_HWR_STROKE_LOG_ON
       
   422     RFileLogger iLogger;
       
   423     TInt iLogOff;
       
   424 #endif
       
   425     };
       
   426 
       
   427 #endif // C_CPENINPUTHWRBOXLAYOUT_H
       
   428 
       
   429 //End Of File