textinput/peninputcommonlayout/inc/peninputcommonlayoutext.h
changeset 27 694fa80c203c
parent 24 fc42a86c98e3
child 35 0f326f2e628e
equal deleted inserted replaced
24:fc42a86c98e3 27:694fa80c203c
     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 common layout framework
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPENINPUTCOMMONLAYOUTEXT_H
       
    20 #define C_CPENINPUTCOMMONLAYOUTEXT_H
       
    21 
       
    22 // System includes
       
    23 #include <centralrepository.h>
       
    24 #include <peninputlayout.h>
       
    25 #include <peninputlayoutplugininterface.h>
       
    26 
       
    27 // User includes
       
    28 #include "peninputlayoutcontext.h"
       
    29 
       
    30 // Forward decalaration
       
    31 class CPeninputDataMgr;
       
    32 class CPeninputUiStateMgr;
       
    33 class MPeninputUiStateMgr;
       
    34 class CPeninputLayoutWindowExt;
       
    35 
       
    36 /**
       
    37  *  Peninput common layout
       
    38  *
       
    39  *  @lib peninputcommonlayout.lib
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 class CPeninputCommonLayoutExt : public CFepUiLayout, 
       
    43                               public MPeninputLayoutContext
       
    44     {
       
    45 
       
    46 public:
       
    47 
       
    48     /**
       
    49      * Destructor
       
    50      *
       
    51      * @since S60 v3.2
       
    52      * @return None
       
    53      */
       
    54     IMPORT_C virtual ~CPeninputCommonLayoutExt();
       
    55 
       
    56     /**
       
    57      * Get data manager
       
    58      *
       
    59      * @since S60 v3.2
       
    60      * @return The pointer to MPeninputDataProvider
       
    61      */
       
    62     IMPORT_C MPeninputDataProvider* DataMgr() const;
       
    63 
       
    64     /**
       
    65      * Get layout window
       
    66      *
       
    67      * @since S60 v3.2
       
    68      * @return The pointer to CPeninputLayoutWindow object
       
    69      */
       
    70     IMPORT_C CPeninputLayoutWindowExt* LayoutWindow() const;
       
    71 
       
    72     /**
       
    73      * Get ui state manager
       
    74      *
       
    75      * @since S60 v3.2
       
    76      * @return The pointer to MPeninputUiStateMgr
       
    77      */
       
    78     IMPORT_C MPeninputUiStateMgr* UiStateMgr() const;
       
    79 
       
    80 // From CFepUiLayout
       
    81 
       
    82     /**
       
    83      * From CFepUiLayout
       
    84      * Handle layout command event
       
    85      *
       
    86      * @since S60 v3.2
       
    87      * @param aCmd Command Id
       
    88      * @param aData Data for command
       
    89      * @return Errors when return value smaller than 0     
       
    90      */
       
    91     IMPORT_C TInt HandleCommand( TInt aCmd, TUint8* aData );
       
    92 
       
    93     /**
       
    94      * From CFepUiLayout
       
    95      * Inform layout the size changing event
       
    96      *
       
    97      * @since S60 v3.2
       
    98      * @param aData The event data
       
    99      * @return KErrNone if successfully size changing
       
   100      */
       
   101     IMPORT_C TInt SizeChanged( const TAny* aData );
       
   102 
       
   103     /**
       
   104      * From CFepUiLayout
       
   105      * Handle the event from control
       
   106      *
       
   107      * @since S60 v3.2
       
   108      * @param aEventType The event type
       
   109      * @param aCtrl The sender
       
   110      * @param aEventData The event data
       
   111      * @return None
       
   112      */
       
   113     IMPORT_C virtual void HandleControlEvent( TInt aEventType, 
       
   114                                               CFepUiBaseCtrl* aCtrl, 
       
   115                                               const TDesC& aEventData );
       
   116 
       
   117     /**
       
   118      * From CFepUiLayout
       
   119      * Handle editor text coming
       
   120      * Called by animation dll when app editor text is coming
       
   121      * If a ui layout has a editor area, it must implements 
       
   122      * this function to get the text
       
   123      *
       
   124      * @since S60 v3.2
       
   125      * @param aData Editor Text Coming data
       
   126      * @return KErrNone is operation succeeded
       
   127      */
       
   128     IMPORT_C TInt OnAppEditorTextComing( 
       
   129         const TFepInputContextFieldData& aData );
       
   130 
       
   131     /**
       
   132      * From CFepUiLayout 
       
   133      * Get the layout type, vkb or hwr. It's now similar to LayoutType which defines in 
       
   134      * another interface.
       
   135      * 
       
   136      * @since S60 v3.2
       
   137      * @return The layout type
       
   138      */
       
   139     IMPORT_C virtual TInt PenInputType();
       
   140     
       
   141     IMPORT_C void SetPositionFromOutside(const TPoint& aNewPos);
       
   142                                   
       
   143 // From MKeyRawEventHandler
       
   144 
       
   145     /**
       
   146      * From CFepUiLayout
       
   147      * Handle raw event key
       
   148      *
       
   149      * @since S60 v3.2
       
   150      * @param aKeyEvent The key raw event data
       
   151      * @return ETrue if the key was handled, otherwise EFalse
       
   152      */
       
   153     IMPORT_C TBool HandleRawKeyEventL( const TRawEvent& aKeyEvent );
       
   154 
       
   155 // From MPeninputLayoutContext
       
   156 
       
   157     /**
       
   158      * Send event to window
       
   159      *
       
   160      * @since S60 v3.2
       
   161      * @param aEventType The event type
       
   162      * @param aCtrl The sender
       
   163      * @param aEventData The event data
       
   164      * @return None
       
   165      */
       
   166     IMPORT_C void SendEventToWindow( TInt aEventType, 
       
   167                                      CFepUiBaseCtrl* aCtrl, 
       
   168                                      const TDesC& aEventData = KNullDesC );
       
   169 
       
   170     /**
       
   171      * Send event to layout
       
   172      *
       
   173      * @since S60 v3.2
       
   174      * @param aEventType The event type
       
   175      * @param aCtrl The sender
       
   176      * @param aEventData The event data
       
   177      * @return None
       
   178      */
       
   179     IMPORT_C void SendEventToLayout( TInt aEventType, 
       
   180                                      CFepUiBaseCtrl* aCtrl, 
       
   181                                      const TDesC& aEventData = KNullDesC );
       
   182 
       
   183 
       
   184     IMPORT_C TBool IsShiftPermitted();
       
   185     
       
   186     IMPORT_C TBool IsCapsLockPermitted();
       
   187     /**
       
   188      * Request data from data provider
       
   189      *
       
   190      * @since S60 v3.2
       
   191      * @param aDataType The data request 
       
   192      * @return The data you request
       
   193      */
       
   194     IMPORT_C TAny* RequestData( TPeninputDataType aDataType );
       
   195 
       
   196     /**
       
   197      * Set resource utils
       
   198      *
       
   199      * @since S60 v3.2
       
   200      * @param aDataType Data type
       
   201      * @param aData Data value
       
   202      * @return None
       
   203      */
       
   204     IMPORT_C void SetData( TPeninputDataType aDataType, TAny* aData );
       
   205 
       
   206     /**
       
   207      * Sendkey to fep
       
   208      *
       
   209      * @since S60 v3.2
       
   210      * @param aEventType Event type
       
   211      * @param aEventData Event data
       
   212      * @return None
       
   213      */
       
   214     IMPORT_C void Sendkey( TInt aEventType, 
       
   215                            const TDesC& aEventData = KNullDesC );
       
   216 
       
   217 protected:
       
   218 
       
   219    /**
       
   220      * 2nd phase construction - constructor
       
   221      *
       
   222      * @since S60 v3.2
       
   223      * @param aLafEnv The LAF enviroment
       
   224      * @param aLayoutOwner The owner of layout
       
   225      * @return None
       
   226      */ 
       
   227     IMPORT_C CPeninputCommonLayoutExt( MLayoutOwner* aLayoutOwner );
       
   228 
       
   229     /**
       
   230      * 2nd phase construction - second constructor
       
   231      *
       
   232      * @since S60 v3.2
       
   233      * @param aInitData Init data of layout
       
   234      * @return None
       
   235      */
       
   236     IMPORT_C void ConstructL( const TAny* aInitData );
       
   237 
       
   238     /**
       
   239      * From CFepUiLayout
       
   240      * Test whether the position is valid
       
   241      * This is used to test the target position when draging controls 
       
   242      * to some place
       
   243      *
       
   244      * @since S60 v4.0
       
   245      * @param aRect The rect to be checked
       
   246      * @param aDragbar The dragbar being dragged
       
   247      * @param aVInfo The valid information in vertial dirtection. ETrue is 
       
   248      *        vertical moving is valid.It's only used when aRect is not 
       
   249      *        valid but moving in vertical direction is valid
       
   250      * @param aHInfo The valid information in horizontal dirtection
       
   251      *        ETrue is horizontal moving is valid.It's only used when aRect 
       
   252      *        is not valid but moving in vertical direction is valid
       
   253      * @param aFlag ETrue if whole layout is moving, otherwise, only 
       
   254      *        components moving
       
   255      * @return ETrue if aRect is a valid position. Otherwise, EFalse
       
   256      */       
       
   257     IMPORT_C TBool IsValidDestination( const TRect& aRect, 
       
   258                                        CDragBar* aDragBar, 
       
   259                                        TBool& aVInfo, 
       
   260                                        TBool& aHInfo, 
       
   261                                        TBool aFlag );
       
   262 
       
   263     /**
       
   264      * Init layout owner
       
   265      *
       
   266      * @since S60 v3.2
       
   267      * @return The rect of the layout
       
   268      */
       
   269     IMPORT_C virtual TRect Init();
       
   270 
       
   271     /**
       
   272      * Save a virtual keybroad key to the repository
       
   273      * 
       
   274      * @since S60 v3.2
       
   275      * @param aKey The key name in repository
       
   276      * @param aValue The unicode of key
       
   277      * @return None
       
   278      */
       
   279     IMPORT_C virtual void SaveKey( TInt aKey, TInt aValue );
       
   280 
       
   281     /**
       
   282      * Factory method for creation of layout window. The decision which 
       
   283      * layout window(VKB or HWR) is created will be postboned in subclasses 
       
   284      * of this class.
       
   285      *
       
   286      * @since S60 v3.2
       
   287      * @return None
       
   288      */
       
   289     virtual void CreateLayoutWindowL() = 0;
       
   290 
       
   291     /**
       
   292      * Factory method for creation resource config. It is enough at present 
       
   293      * to create and initialize resource config. Any necessary extension 
       
   294      * will be implemented in subclasses.
       
   295      * 
       
   296      * @since S60 v3.2
       
   297      * @return None
       
   298      */
       
   299     virtual void CreateDataMgrL( const TAny* aInitData ) = 0;
       
   300 
       
   301     /**
       
   302      * Get the layout type, vkb or hwr, child class must rewrite the function.
       
   303      * 
       
   304      * @since S60 v3.2
       
   305      * @return The layout type
       
   306      */
       
   307      virtual TInt LayoutType() = 0;
       
   308 
       
   309 private: // New method
       
   310 	
       
   311     /**
       
   312      * Change input language
       
   313      *
       
   314      * @since S60 v3.2
       
   315      * @param aLangID The language id you want to change to
       
   316      * @return None
       
   317      */
       
   318     void ChangeInputLanguage( TInt aLangID );
       
   319 
       
   320     /**
       
   321      * Change current range
       
   322      *
       
   323      * @since S60 v3.2
       
   324      * @param aRange The range need to set
       
   325      * @return None
       
   326      */
       
   327     void ChangeRange( TInt aRange );
       
   328     
       
   329     /**
       
   330      * Translate range for some languages
       
   331      *
       
   332      * @since S60 v3.2
       
   333      * @param aRange The range need to set
       
   334      * @return New range
       
   335      */    
       
   336     TInt TranslateRange(TInt aRange);
       
   337     
       
   338     /**
       
   339      * Set if enable switch to hwr
       
   340      *
       
   341      * @since S60 v3.2
       
   342      * @param aEnable The enable flag
       
   343      * @return None
       
   344      */ 
       
   345     void SetEnableSwitchToHwr(TBool aEnable);
       
   346     
       
   347     /**
       
   348      * Set if enable option button and language switch button
       
   349      *
       
   350      * @since S60 v3.2
       
   351      * @param aEnable The enable flag
       
   352      * @return None
       
   353      */ 
       
   354     void SetEnableSettingBtn(TBool aEnable);
       
   355     
       
   356 protected:
       
   357 	
       
   358     /**
       
   359      * The data manager
       
   360      * Own
       
   361      */
       
   362     CPeninputDataMgr* iDataMgr;
       
   363     
       
   364     /**
       
   365      * The ui state manager
       
   366      * Own
       
   367      */
       
   368     CPeninputUiStateMgr* iUiStateMgr;
       
   369 
       
   370     /**
       
   371      * The layout window
       
   372      * Own
       
   373      */    
       
   374     CPeninputLayoutWindowExt* iLayoutWindow;
       
   375     
       
   376     };
       
   377 
       
   378 #endif // C_CPeninputCommonLayoutExt_H