textinput/peninputhwrboxcn/ctrlinc/peninputhwrboxgroup.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:  The class of handwriting box container.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_AKNFEPHWRBOXGROUP_H
       
    20 #define C_AKNFEPHWRBOXGROUP_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <peninputlayoutbasecontrol.h>
       
    24 #include <peninputlayoutctrlgroup.h>
       
    25 #include <peninputlayouthwrwnd.h>
       
    26 #include <peninputlayoutminterface.h>
       
    27 #include "peninputhwrpropertysubscriber.h"
       
    28 
       
    29 /* FORWARD DECLARATIONS */
       
    30 class TResourceReader;
       
    31 
       
    32 /**
       
    33  *  HWR(Hand Writing Recognition) box container class.
       
    34  *
       
    35  *  This class holds one or more handwriting boxes, processes event
       
    36  *  sent from hwr boxes and managers boxes UI.
       
    37  *
       
    38  *  @lib peninputhwrboxcn.lib
       
    39  *  @since S60 v3.2 
       
    40  */
       
    41 class CAknFepHwrBoxGroup: public CControlGroup, 
       
    42                           public MEventObserver,
       
    43                           public MAknFepHwrPropertySubscriber
       
    44     {
       
    45 public:
       
    46 
       
    47 
       
    48     /**
       
    49      * Two-phased constructor. 
       
    50      * CAknFepHwrBoxGroup creates aBoxCount HWR boxes.
       
    51      * After creating a new CAknFepHwrBoxGroup and SetTransparency
       
    52      * must be called.
       
    53 
       
    54      * @param aUiLayout Ui layout instance from CFepUiLayout
       
    55      * @param aBoxGroupId The box group control id
       
    56      * @param aBoxCount The count of contained HWR box
       
    57      * @return The instance of CAknFepHwrBoxGroup
       
    58      */
       
    59     static CAknFepHwrBoxGroup* NewL(CFepUiLayout* aUiLayout,
       
    60                                     TInt aBoxGroupId,
       
    61                                     TInt aBoxCount);
       
    62                                     
       
    63     /**
       
    64      * Two-phased constructor. 
       
    65      * CAknFepHwrBoxGroup creates aBoxCount HWR boxes.
       
    66      * After creating a new CAknFepHwrBoxGroup and SetTransparency
       
    67      * must be called.
       
    68 
       
    69      * @param aUiLayout Ui layout instance from CFepUiLayout
       
    70      * @param aBoxGroupId The box group control id
       
    71      * @param aBoxCount The count of contained HWR box
       
    72      * @return The instance of CAknFepHwrBoxGroup
       
    73      */
       
    74     static CAknFepHwrBoxGroup* NewLC(CFepUiLayout* aUiLayout,
       
    75                                      TInt aBoxGroupId,
       
    76                                      TInt aBoxCount);
       
    77     /**
       
    78      * Destructor.
       
    79      */
       
    80     virtual ~CAknFepHwrBoxGroup();
       
    81 
       
    82     /** 
       
    83      * ConstructFromResourceL load HWR box settings from resource.
       
    84      * Reserved interface currently does nothing.
       
    85      *
       
    86      * @since S60 v3.2
       
    87      * @param aReader A resource reader
       
    88      * @return None
       
    89      */
       
    90     void ConstructFromResourceL(TResourceReader& aReader); 
       
    91     
       
    92     /** 
       
    93      * ConstructFromResourceL load HWR box settings from resource.
       
    94      * Before calling this function, the resource id should be set
       
    95      *
       
    96      * @since S60 v3.2
       
    97      * @return None
       
    98      */
       
    99     void ConstructFromResourceL();
       
   100 
       
   101     /**
       
   102      * Return the HWR box count in the container
       
   103      *
       
   104      * @since S60 v3.2
       
   105      * @return Number of HWR box in the container
       
   106      */
       
   107     TInt BoxCount();
       
   108 
       
   109     /**
       
   110      * Clear current handwriting trail if any. There is only one 
       
   111      * box is writing at a time. CancelWriting only clear current
       
   112      * writing box's trail.
       
   113      *
       
   114      * @since S60 v3.2
       
   115      * @return None 
       
   116      */
       
   117     void CancelWriting();
       
   118     
       
   119     /**
       
   120      * Return current active box pen stroke list array.
       
   121      *
       
   122      * @since S60 v3.2
       
   123      * @return Reference of stroke list array 
       
   124      */
       
   125     const RArray<TPoint>& StrokeList();
       
   126     
       
   127     /**
       
   128      * Hand size change event.
       
   129      * this function is called by parent control which knows the
       
   130      * box container position.
       
   131      *
       
   132      * @since S60 v3.2
       
   133      * @param aRect The new position rectangle
       
   134      * @return None
       
   135      */
       
   136     void SizeChanged(const TRect& aRect);
       
   137 
       
   138     /**
       
   139      * Hand size change event.
       
   140      * this function loads the new position from LAF.
       
   141      *
       
   142      * @since S60 v3.2
       
   143      * @return None
       
   144      */
       
   145     void SizeChanged();
       
   146     
       
   147     /**
       
   148      * Iterate to set each HWR box backgound color.
       
   149      *
       
   150      * @since S60 v3.2
       
   151      * @param aCol New pen color
       
   152      * @return None
       
   153      */
       
   154     void SetBoxBackColor(const TRgb aCol);
       
   155     
       
   156     /**
       
   157      * Iterate to set each HWR box frame color.
       
   158      *
       
   159      * @since S60 v3.2
       
   160      * @param aCol New frame color
       
   161      * @return None
       
   162      */
       
   163     void SetBoxFrameColor(const TRgb aCol);
       
   164     
       
   165     /**
       
   166      * Iterate to set each HWR box stroke end mark.
       
   167      *
       
   168      * @since S60 v3.2
       
   169      * @param aEndMark The stroke end mark
       
   170      * @return None
       
   171      */
       
   172     void SetStrokeEndMark(const TPoint& aEndMark);
       
   173 
       
   174     /**
       
   175      * Set transparent level of HWR box.
       
   176      * 
       
   177      * @since S60 v3.2
       
   178      * @param aActiveTrans, The active box(current writing) tranparency
       
   179      * @param aInactiveTrans, The inactive box transparency
       
   180      * @return None
       
   181      */
       
   182      void SetTransparency(const TUint8 aActiveTrans, const TUint8 aInactiveTrans);
       
   183     
       
   184     /**
       
   185      * Get transparent level of HWR box for active box transparency.
       
   186      * 
       
   187      * @since S60 v3.2
       
   188      * @return The active box transparency.
       
   189      */
       
   190     inline TUint8 ActiveTransparency() const;
       
   191     
       
   192     /**
       
   193      * Get transparent level of HWR box for inactive box transparency.
       
   194      * 
       
   195      * @since S60 v3.2
       
   196      * @return The inactive box transparency.
       
   197      */
       
   198     inline TUint8 InactiveTransparency() const;
       
   199     
       
   200     /**
       
   201      * Set property,  From base class MAknFepHwrPropertySubscriber
       
   202      *
       
   203      * @since S60 v3.2
       
   204      * @param aPropertyName The properyt name
       
   205      * @param aPropertyValue The properyt value
       
   206      * @return None
       
   207      */
       
   208     void SetPropertyL(
       
   209             const MAknFepHwrPropertySubscriber::TAknFepHwrProperty aPropertyName, 
       
   210             const TDesC& aPropertyValue);
       
   211             
       
   212     TPoint StrokeEndMark();
       
   213     
       
   214 protected: 
       
   215 
       
   216     /**
       
   217      * From base class MEventObserver
       
   218      *
       
   219      * Handle event 
       
   220      * @since S60 v3.2
       
   221      * @param aEventType The event type
       
   222      * @param aCtrlId The control who sends the event
       
   223      * @param aEventData The event data
       
   224      * @return None
       
   225      */
       
   226     virtual void HandleControlEvent(TInt aEventType, 
       
   227                              CFepUiBaseCtrl* aCtrl, 
       
   228                              const TDesC& aEventData);
       
   229 private:
       
   230 
       
   231     /**
       
   232      * C++ default constructor.
       
   233      *
       
   234      * @param aUiLayout Ui layout instance from CFepUiLayout
       
   235      * @param aBoxGroupId The box group control id
       
   236      */
       
   237     CAknFepHwrBoxGroup(CFepUiLayout* aUiLayout, TInt aBoxGroupId);
       
   238     
       
   239     /**
       
   240      * By default Symbian 2nd phase constructor is private.
       
   241      *
       
   242      * @param aCandidateWnd Candidate window observer
       
   243      * @param aBoxCount the count of contained HWR box
       
   244      * @return None
       
   245     */
       
   246     void ConstructL(TInt aBoxCount);
       
   247 
       
   248     /**
       
   249      * Iterate to set each HWR box writting speed.
       
   250      *
       
   251      * @since S60 v3.2
       
   252      * @param aCharDelay The submit character timer in micro seconds
       
   253      * @return None
       
   254      */
       
   255     void SetWritingSpeed(const TTimeIntervalMicroSeconds32& aCharDelay);
       
   256 
       
   257     /**
       
   258      * Iterate to set each HWR box trail drawing pen size.
       
   259      *
       
   260      * @since S60 v3.2
       
   261      * @param aSize New pen size
       
   262      * @return None
       
   263      */
       
   264     void SetBoxPenSize(const TSize aSize);
       
   265 
       
   266     /**
       
   267      * Iterate to set each HWR box trail drawing pen color.
       
   268      *
       
   269      * @since S60 v3.2
       
   270      * @param aCol New pen color
       
   271      * @return None
       
   272      */
       
   273     void SetBoxPenColor(const TRgb aCol);
       
   274     
       
   275     /**
       
   276      * Handle EEventHwrStrokeStarted event. The message is reported each time 
       
   277      * pen down in the HWR box area.
       
   278      * @since S60 v3.2
       
   279      * @param aBoxFrom The box which generates the message
       
   280      * @return None
       
   281      */
       
   282     void OnStrokeStarted(CTransparentHwrWnd* aBoxFrom);
       
   283                          
       
   284     /**
       
   285      * Handle EEventHwrStrokeFinished event. The message is reported when
       
   286      * StrokeTimer times out.
       
   287      * @since S60 v3.2
       
   288      * @param aBoxFrom The box which generates the message
       
   289      * @return None
       
   290      */
       
   291     void OnStrokeFinished(CTransparentHwrWnd* aBoxFrom);
       
   292 
       
   293     /**
       
   294      * Handle EEventHwrCharacterTimerOut event. The message is reported when
       
   295      * CharacterTimer times out.
       
   296      * @since S60 v3.2
       
   297      * @param aBoxFrom The box which generates the message
       
   298      * @return None
       
   299      */
       
   300     void OnStrokeCharacterTimerOut(CTransparentHwrWnd* aBoxFrom);
       
   301 
       
   302     /**
       
   303      * Handle EEventHwrStrokeCanceled event. The message is reported when
       
   304      * manually cancel writing.
       
   305      * @since S60 v3.2
       
   306      * @param aBoxFrom The box which generates the message
       
   307      * @return None
       
   308      */
       
   309     void OnStrokeCanceled(CTransparentHwrWnd* aBoxFrom);
       
   310 
       
   311     /**
       
   312      * Explicit refresh HWR boxes UI.
       
   313      *
       
   314      * @return None
       
   315      */
       
   316     void RefreshUI(CTransparentHwrWnd* aBox = NULL);
       
   317 
       
   318     /**
       
   319      * Submit first candidate in candidate buffer immediatelly 
       
   320      * and clear handwriting trail.
       
   321      *
       
   322      * @since S60 v3.2
       
   323      * @return None
       
   324      */
       
   325     void SubmitWriting();
       
   326 
       
   327 private: // data
       
   328 
       
   329     /**
       
   330      * The background transparent alpha value(percentage).
       
   331      * The value is between 0-255, 0 mean totally invisible, 100 means opaque
       
   332      * iActiveMask Current writing box background transparency
       
   333      * iInactiveMask None writing box background transparency
       
   334      */
       
   335     TUint8 iActiveTrans;
       
   336 
       
   337     TUint8 iInactiveTrans;
       
   338 
       
   339     /**
       
   340      * Current wrting box pointer. Not own.
       
   341      * NULL means no box in writing state.
       
   342      */
       
   343     CTransparentHwrWnd* iActiveBox;
       
   344     
       
   345     /**
       
   346      * First time construct flag
       
   347      */
       
   348     TBool iFirstTimeConstruct;
       
   349     };
       
   350 
       
   351 #include "peninputhwrboxgroup.inl"
       
   352 
       
   353 #endif // C_AKNFEP_HWRBOXGROUP_H
       
   354 
       
   355 //End Of File