textinput/peninputcommonlayout/inc/peninputcommonlayout.h
changeset 40 2cb9bae34d17
parent 31 f1bdd6b078d1
child 49 37f5d84451bd
equal deleted inserted replaced
31:f1bdd6b078d1 40:2cb9bae34d17
     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_CPENINPUTCOMMONLAYOUT_H
       
    20 #define C_CPENINPUTCOMMONLAYOUT_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 CPeninputLayoutWindow;
       
    35 
       
    36 /**
       
    37  *  Peninput common layout
       
    38  *
       
    39  *  @lib peninputcommonlayout.lib
       
    40  *  @since S60 v3.2
       
    41  */
       
    42 class CPeninputCommonLayout : 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 ~CPeninputCommonLayout();
       
    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 CPeninputLayoutWindow* 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                                   
       
   142 // From MKeyRawEventHandler
       
   143 
       
   144     /**
       
   145      * From CFepUiLayout
       
   146      * Handle raw event key
       
   147      *
       
   148      * @since S60 v3.2
       
   149      * @param aKeyEvent The key raw event data
       
   150      * @return ETrue if the key was handled, otherwise EFalse
       
   151      */
       
   152     IMPORT_C TBool HandleRawKeyEventL( const TRawEvent& aKeyEvent );
       
   153 
       
   154 // From MPeninputLayoutContext
       
   155 
       
   156     /**
       
   157      * Send event to window
       
   158      *
       
   159      * @since S60 v3.2
       
   160      * @param aEventType The event type
       
   161      * @param aCtrl The sender
       
   162      * @param aEventData The event data
       
   163      * @return None
       
   164      */
       
   165     IMPORT_C void SendEventToWindow( TInt aEventType, 
       
   166                                      CFepUiBaseCtrl* aCtrl, 
       
   167                                      const TDesC& aEventData = KNullDesC );
       
   168 
       
   169     /**
       
   170      * Send event to layout
       
   171      *
       
   172      * @since S60 v3.2
       
   173      * @param aEventType The event type
       
   174      * @param aCtrl The sender
       
   175      * @param aEventData The event data
       
   176      * @return None
       
   177      */
       
   178     IMPORT_C void SendEventToLayout( TInt aEventType, 
       
   179                                      CFepUiBaseCtrl* aCtrl, 
       
   180                                      const TDesC& aEventData = KNullDesC );
       
   181 
       
   182 
       
   183     IMPORT_C TBool IsShiftPermitted();
       
   184     
       
   185     IMPORT_C TBool IsCapsLockPermitted();
       
   186     /**
       
   187      * Request data from data provider
       
   188      *
       
   189      * @since S60 v3.2
       
   190      * @param aDataType The data request 
       
   191      * @return The data you request
       
   192      */
       
   193     IMPORT_C TAny* RequestData( TPeninputDataType aDataType );
       
   194 
       
   195     /**
       
   196      * Set resource utils
       
   197      *
       
   198      * @since S60 v3.2
       
   199      * @param aDataType Data type
       
   200      * @param aData Data value
       
   201      * @return None
       
   202      */
       
   203     IMPORT_C void SetData( TPeninputDataType aDataType, TAny* aData );
       
   204 
       
   205     /**
       
   206      * Sendkey to fep
       
   207      *
       
   208      * @since S60 v3.2
       
   209      * @param aEventType Event type
       
   210      * @param aEventData Event data
       
   211      * @return None
       
   212      */
       
   213     IMPORT_C void Sendkey( TInt aEventType, 
       
   214                            const TDesC& aEventData = KNullDesC );
       
   215                            
       
   216     IMPORT_C void SetPositionFromOutside(const TPoint& aNewPos);
       
   217 
       
   218 protected:
       
   219 
       
   220    /**
       
   221      * 2nd phase construction - constructor
       
   222      *
       
   223      * @since S60 v3.2
       
   224      * @param aLafEnv The LAF enviroment
       
   225      * @param aLayoutOwner The owner of layout
       
   226      * @return None
       
   227      */ 
       
   228     IMPORT_C CPeninputCommonLayout( MLayoutOwner* aLayoutOwner );
       
   229 
       
   230     /**
       
   231      * 2nd phase construction - second constructor
       
   232      *
       
   233      * @since S60 v3.2
       
   234      * @param aInitData Init data of layout
       
   235      * @return None
       
   236      */
       
   237     IMPORT_C void ConstructL( const TAny* aInitData );
       
   238 
       
   239     /**
       
   240      * From CFepUiLayout
       
   241      * Test whether the position is valid
       
   242      * This is used to test the target position when draging controls 
       
   243      * to some place
       
   244      *
       
   245      * @since S60 v4.0
       
   246      * @param aRect The rect to be checked
       
   247      * @param aDragbar The dragbar being dragged
       
   248      * @param aVInfo The valid information in vertial dirtection. ETrue is 
       
   249      *        vertical moving is valid.It's only used when aRect is not 
       
   250      *        valid but moving in vertical direction is valid
       
   251      * @param aHInfo The valid information in horizontal dirtection
       
   252      *        ETrue is horizontal moving is valid.It's only used when aRect 
       
   253      *        is not valid but moving in vertical direction is valid
       
   254      * @param aFlag ETrue if whole layout is moving, otherwise, only 
       
   255      *        components moving
       
   256      * @return ETrue if aRect is a valid position. Otherwise, EFalse
       
   257      */       
       
   258     IMPORT_C TBool IsValidDestination( const TRect& aRect, 
       
   259                                        CDragBar* aDragBar, 
       
   260                                        TBool& aVInfo, 
       
   261                                        TBool& aHInfo, 
       
   262                                        TBool aFlag );
       
   263 
       
   264     /**
       
   265      * Init layout owner
       
   266      *
       
   267      * @since S60 v3.2
       
   268      * @return The rect of the layout
       
   269      */
       
   270     IMPORT_C virtual TRect Init();
       
   271 
       
   272     /**
       
   273      * Save a virtual keybroad key to the repository
       
   274      * 
       
   275      * @since S60 v3.2
       
   276      * @param aKey The key name in repository
       
   277      * @param aValue The unicode of key
       
   278      * @return None
       
   279      */
       
   280     IMPORT_C virtual void SaveKey( TInt aKey, TInt aValue );
       
   281 
       
   282     /**
       
   283      * Factory method for creation of layout window. The decision which 
       
   284      * layout window(VKB or HWR) is created will be postboned in subclasses 
       
   285      * of this class.
       
   286      *
       
   287      * @since S60 v3.2
       
   288      * @return None
       
   289      */
       
   290     virtual void CreateLayoutWindowL() = 0;
       
   291 
       
   292     /**
       
   293      * Factory method for creation resource config. It is enough at present 
       
   294      * to create and initialize resource config. Any necessary extension 
       
   295      * will be implemented in subclasses.
       
   296      * 
       
   297      * @since S60 v3.2
       
   298      * @return None
       
   299      */
       
   300     virtual void CreateDataMgrL( const TAny* aInitData ) = 0;
       
   301 
       
   302     /**
       
   303      * Get the layout type, vkb or hwr, child class must rewrite the function.
       
   304      * 
       
   305      * @since S60 v3.2
       
   306      * @return The layout type
       
   307      */
       
   308      virtual TInt LayoutType() = 0;
       
   309 
       
   310 private: // New method
       
   311 	
       
   312     /**
       
   313      * Change input language
       
   314      *
       
   315      * @since S60 v3.2
       
   316      * @param aLangID The language id you want to change to
       
   317      * @return None
       
   318      */
       
   319     void ChangeInputLanguage( TInt aLangID );
       
   320 
       
   321     /**
       
   322      * Change current range
       
   323      *
       
   324      * @since S60 v3.2
       
   325      * @param aRange The range need to set
       
   326      * @return None
       
   327      */
       
   328     void ChangeRange( TInt aRange );
       
   329     
       
   330     /**
       
   331      * Translate range for some languages
       
   332      *
       
   333      * @since S60 v3.2
       
   334      * @param aRange The range need to set
       
   335      * @return New range
       
   336      */    
       
   337     TInt TranslateRange(TInt aRange);
       
   338     
       
   339     /**
       
   340      * Set if enable switch to hwr
       
   341      *
       
   342      * @since S60 v3.2
       
   343      * @param aEnable The enable flag
       
   344      * @return None
       
   345      */ 
       
   346     void SetEnableSwitchToHwr(TBool aEnable);
       
   347     
       
   348     /**
       
   349      * Set if enable option button and language switch button
       
   350      *
       
   351      * @since S60 v3.2
       
   352      * @param aEnable The enable flag
       
   353      * @return None
       
   354      */ 
       
   355     void SetEnableSettingBtn(TBool aEnable);
       
   356     
       
   357 protected:
       
   358 	
       
   359     /**
       
   360      * The data manager
       
   361      * Own
       
   362      */
       
   363     CPeninputDataMgr* iDataMgr;
       
   364     
       
   365     /**
       
   366      * The ui state manager
       
   367      * Own
       
   368      */
       
   369     CPeninputUiStateMgr* iUiStateMgr;
       
   370 
       
   371     /**
       
   372      * The layout window
       
   373      * Own
       
   374      */    
       
   375     CPeninputLayoutWindow* iLayoutWindow;
       
   376     
       
   377     };
       
   378 
       
   379 #endif // C_CPENINPUTCOMMONLAYOUT_H