textinput/peninputfingerhwr/inc/peninputfingerhwrrangeselector.h
changeset 0 eb1f2e154e89
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 /*
       
     2 * Copyright (c) 2009 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 of char range selector.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_PENINPUTFINGERHWRRANGESELECTOR_H
       
    19 #define C_PENINPUTFINGERHWRRANGESELECTOR_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <e32cmn.h>
       
    25 
       
    26 #include <peninputlayoutctrlgroup.h>
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class CAknFepCtrlEventButton;
       
    30 class CAknFepCtrlMultiImageButton;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  class CPeninputFingerHwrRangeSelector.
       
    36  *
       
    37  *  a droplist as range selector. 
       
    38  *
       
    39  *  @lib peninputfingerhwr.lib
       
    40  *  @since S60 v5.0
       
    41  */
       
    42 class CPeninputFingerHwrRangeSelector : public CControlGroup
       
    43     {
       
    44 public:
       
    45     /**
       
    46      * Symbian constructor
       
    47      * 
       
    48      * @since S60 v5.0
       
    49      * @param aUiLayout The layout
       
    50      * @param aId The control id
       
    51      * @return pointer of created object.
       
    52      */
       
    53     static CPeninputFingerHwrRangeSelector* NewL( CFepUiLayout* aUiLayout, TInt aId );
       
    54 
       
    55     /**
       
    56      * Symbian constructor
       
    57      * 
       
    58      * @since S60 v5.0
       
    59      * @param aUiLayout The layout
       
    60      * @param aId The control id
       
    61      * @return pointer of created object.
       
    62      */    
       
    63     static CPeninputFingerHwrRangeSelector* NewLC( CFepUiLayout* aUiLayout, TInt aId );
       
    64 
       
    65     /**
       
    66      * standard c++ destructor.
       
    67      *
       
    68      * @since S60 v5.0
       
    69      */    
       
    70     ~CPeninputFingerHwrRangeSelector();
       
    71     
       
    72 public:
       
    73     /**
       
    74      * popup the list.
       
    75      * 
       
    76      * @since S60 v5.0
       
    77      * 
       
    78      * @param aDirect direction of popup. It can be one of the following:
       
    79      *     EPopDirAuto, EPopDirLeft, EPopDirRight, EPopDirTop, EPopDirDown.
       
    80      *     default value is EPopDirAuto.
       
    81      *     See TPeninputPopListDirection
       
    82      * @return None
       
    83      */
       
    84     void Popup( TInt aDirect = EPopDirAuto);
       
    85     
       
    86     /**
       
    87      * cancel the popup.
       
    88      * 
       
    89      * @since S60 v5.0
       
    90      * @return None
       
    91      * 
       
    92      */
       
    93     void CancelPopup();
       
    94     
       
    95     /**
       
    96      * get visibility of popup.
       
    97      * @since S60 v5.0
       
    98      * @return ETrue if the popup is visible
       
    99      */
       
   100     TBool IsPopup();
       
   101     
       
   102     /**
       
   103      * set permitted char range.
       
   104      * 
       
   105      * @since S60 v5.0 
       
   106      * @param aPermittedRanges permitted character ranges. It can be combination of the following: 
       
   107      *     ERangeNative, ERangeEnglish, ERangeNumber.
       
   108      *     See TAknFepPenInputRange.
       
   109      */
       
   110     void SetPermittedRanges( const TInt aPermittedRanges );
       
   111     
       
   112     /**
       
   113      * set current char range.
       
   114      * 
       
   115      * @since S60 v5.0
       
   116      * @param aCurRange current character range. It must be one of the following:
       
   117      *     EFingerHwrNativeRange, EFingerHwrEnglishRange,EFingerHwrNumberRange.
       
   118      *     See TFingerHwrRange. 
       
   119      * @param aActive 
       
   120      */
       
   121     void SetCurRange( const TInt aCurRange, const TBool aActive );
       
   122     
       
   123     /**
       
   124      * set base rect of popup.
       
   125      * 
       
   126      * @since S60 v5.0
       
   127      * @param aRect
       
   128      * @return None
       
   129      */
       
   130     void SetBaseRect(const TRect& aRect);
       
   131 
       
   132 protected: //virtuals from CControlGroup (CFepUiBaseCtrl)
       
   133 
       
   134     /**
       
   135      * From CControlGroup
       
   136      * Handle pointer down event
       
   137      *
       
   138      * @since S60 V5.0
       
   139      * @param aPoint The point position relative the layout
       
   140      * @return The control which handles the event.     
       
   141      */   
       
   142     CFepUiBaseCtrl* HandlePointerDownEventL(const TPoint& aPoint);
       
   143     
       
   144     /**
       
   145      * From CControlGroup
       
   146      * Handle pointer up event
       
   147      *
       
   148      * @since S60 V5.0
       
   149      * @param aPoint The point position relative the layout
       
   150      * @return The control which handles the event.     
       
   151      */           
       
   152     CFepUiBaseCtrl* HandlePointerUpEventL(const TPoint& aPoint);
       
   153     
       
   154     /**
       
   155      * From CControlGroup
       
   156      * Handle pointer move event
       
   157      *
       
   158      * @since S60 54.0
       
   159      * @param aPoint The point position relative the layout
       
   160      * @return The control which handles the event.     
       
   161      */      
       
   162     CFepUiBaseCtrl* HandlePointerMoveEventL(const TPoint& aPoint);
       
   163     
       
   164 private:
       
   165 
       
   166     /**
       
   167      * C++ constructor
       
   168      * 
       
   169      * @since S60 v5.0
       
   170      * @param aFepUiLayout A Ui Layout environment (CFepUiLayout)
       
   171      * @param aControlId Control id
       
   172      * @return none.
       
   173      */
       
   174     CPeninputFingerHwrRangeSelector(CFepUiLayout* aFepUiLayout, TInt aControlId);
       
   175     
       
   176     /**
       
   177      * Symbian second-phase constructor
       
   178      *
       
   179      * @since S60 v5.0
       
   180      * @return None
       
   181      */    
       
   182     void ConstructL();
       
   183     
       
   184     /**
       
   185      * EventButton creation helper.
       
   186      * 
       
   187      * @since S60 v5.0
       
   188      * @param aCtrlId button control id.
       
   189      * @param aResId resource id.
       
   190      * @param aEvent event id;
       
   191      * @param aUnicode a unicode value to be sent
       
   192      * @return pointer to created CAknFepCtrlEventButton obj.
       
   193      */       
       
   194     CAknFepCtrlEventButton* CreateEventBtnL( TInt aCtrlId, TInt32 aResId,
       
   195             TInt aEvent = 0xFFFF,TInt aUnicode=0 );
       
   196     
       
   197     
       
   198     /**
       
   199      * MultiImageButton creation helper.
       
   200      * 
       
   201      * @since S60 v5.0
       
   202      * @param aCtrlId button control id.
       
   203      * @param aResId resource id. 
       
   204      * @return pointer to created CAknFepCtrlMultiImageButton obj.
       
   205      */      
       
   206     CAknFepCtrlMultiImageButton* CreateMultiBtnL( TInt aCtrlId, TInt32 aResId );
       
   207     
       
   208     /**
       
   209      * EventButton layout helper. Move button to specified rect.
       
   210      * 
       
   211      * @since S60 v5.0
       
   212      * @param aButton the button to move
       
   213      * @param aRect new rect of button
       
   214      * @param aXPadding horz padding of button icon.
       
   215      * @param aYPadding vert padding of button icon.
       
   216      * @param aReloadImages Specifies whether the images is to be reloaded.
       
   217      * @return None
       
   218      */     
       
   219     void MoveIconButton( CAknFepCtrlEventButton* aButton, const TRect& aRect, 
       
   220             TInt aXPadding=0, TInt aYPadding=0, TBool aReloadImages=ETrue );
       
   221     
       
   222     /**
       
   223      * MultiIconButton layout helper. Move button to specified rect.
       
   224      * 
       
   225      * @since S60 v5.0
       
   226      * @param aButton the button to move
       
   227      * @param aRect new rect of button
       
   228      * @param aXPadding horz padding of button icon.
       
   229      * @param aYPadding vert padding of button icon.
       
   230      * @param aReloadImages  Specifies whether the images is to be reloaded.
       
   231      * @return None
       
   232      */      
       
   233     void MoveMultiIconButton( CAknFepCtrlMultiImageButton* aButton, 
       
   234             const TRect& aRect, TInt aXPadding=0, TInt aYPadding=0, 
       
   235             TBool aReloadImages=ETrue );
       
   236     
       
   237     /**
       
   238      * layout buttons.
       
   239      * 
       
   240      * @since S60 v5.0
       
   241      * @param aPermittedRanges permitted char range flags. It can be combination of the following: 
       
   242      *     ERangeNative
       
   243      *     ERangeEnglish
       
   244      *     ERangeNumber.
       
   245      *     See TAknFepPenInputRange.
       
   246      * @param aCurRange current range id. It can be one of the following:
       
   247      *      EFingerHwrNativeRange
       
   248      *      EFingerHwrEnglishRange
       
   249      *      EFingerHwrNumberRange
       
   250      *      EFingerHwrSymbolRange
       
   251      * @param aActive Specifies whether the current range is active.
       
   252      * @param aShowDropList Specifies whether the popup is visible.
       
   253      * @param aDropDirect direction of popup. It can be one of the following:
       
   254      *     EPopDirAuto 
       
   255      *     EPopDirLeft 
       
   256      *     EPopDirRight 
       
   257      *     EPopDirTop 
       
   258      *     EPopDirDown
       
   259      *    See TPeninputPopListDirection.
       
   260      * @return none.
       
   261      */
       
   262     void LayoutRangeButtons( TInt aPermittedRanges, TInt aCurRange, 
       
   263             TBool aActive, TBool aShowDropList, TInt aDropDirect );
       
   264     
       
   265     /**
       
   266      * calculates popup direction.
       
   267      * 
       
   268      * @since S60 v5.0
       
   269      * @param aBound rect of display area.
       
   270      * @param aTarget position of popup list.
       
   271      * @param aItemSize item size.
       
   272      * @param aItemCount item count.
       
   273      * @param aDirect direction of popup. It can be one of the following:
       
   274      *     EPopDirAuto 
       
   275      *     EPopDirLeft 
       
   276      *     EPopDirRight 
       
   277      *     EPopDirTop 
       
   278      *     EPopDirDown
       
   279      *    See TPeninputPopListDirection.
       
   280      * @return a TPoint object as popup direction and offset.
       
   281      */
       
   282     TPoint CalcDropListDirection( const TRect& aBound, const TPoint& aTarget, 
       
   283             const TSize& aItemSize, TInt aItemCount, TInt aDirect );
       
   284     
       
   285     /**
       
   286      * calculate popup rect.
       
   287      * 
       
   288      * @since S60 v5.0
       
   289      * @param aRect base rect of popup
       
   290      * @param aWidth new width of popup
       
   291      * @param aHeight new height of popup
       
   292      * @return none
       
   293      */
       
   294     void CalcDropListRect( TRect& aRect, const TInt aWidth, const TInt aHeight );
       
   295     
       
   296 private:
       
   297     /**
       
   298      * chinese range button.
       
   299      * not own.
       
   300      */
       
   301     CAknFepCtrlEventButton* iRangeChBtn;
       
   302     
       
   303     /**
       
   304      * english range button.
       
   305      * not own.
       
   306      */
       
   307     CAknFepCtrlEventButton* iRangeEnBtn;
       
   308     
       
   309     /**
       
   310      * numeric range button.
       
   311      * not own.
       
   312      */    
       
   313     CAknFepCtrlEventButton* iRangeNumBtn;
       
   314     
       
   315     
       
   316     /**
       
   317      * chinese range button, selected.
       
   318      * not own.
       
   319      */    
       
   320     CAknFepCtrlMultiImageButton* iRangeChMiBtn;
       
   321     
       
   322     /**
       
   323      * english range button, selected.
       
   324      * not own.
       
   325      */ 
       
   326     CAknFepCtrlMultiImageButton* iRangeEnMiBtn;
       
   327     
       
   328     /**
       
   329      * numeric range button, selected.
       
   330      * not own.
       
   331      */    
       
   332     CAknFepCtrlMultiImageButton* iRangeNumMiBtn;
       
   333     
       
   334     /**
       
   335      * visibility of popup list.
       
   336      */
       
   337     TBool iPopupVisible;
       
   338     
       
   339     /**
       
   340      * bit mask of permitted char ranges.
       
   341      */
       
   342     TInt iPermittedRanges;
       
   343     
       
   344     /**
       
   345      * Current char range id.
       
   346      */
       
   347     TInt iCurRange;
       
   348     
       
   349     /**
       
   350      * whether current range is active.
       
   351      */
       
   352     TBool iCurRangeActive;
       
   353     
       
   354     /**
       
   355      * base rect of popup.
       
   356      */
       
   357     TRect iPopupBaseRect;
       
   358     
       
   359     };
       
   360 
       
   361 #endif // C_PENINPUTFINGERHWRRANGESELECTOR_H