textinput/peninputvkbkr/inc/peninputgenericvkblafdatamgr.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:  peninput vkb laf manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPENINPUTGENERICLAFDATAMGR_H
       
    20 #define C_CPENINPUTGENERICLAFDATAMGR_H
       
    21 
       
    22 // System includes
       
    23 #include <e32base.h>
       
    24 #include <w32std.h>
       
    25 #include <AknFepGlobalEnums.h>
       
    26 // User includes
       
    27 
       
    28 // Forward decalaration
       
    29 
       
    30 // laf type definition
       
    31 enum TPeninputQwtLayoutType
       
    32 	{
       
    33 	ELayoutNone = -1,
       
    34 	ELayout10x3,
       
    35 	ELayout11x3,
       
    36 	ELayout11x4,
       
    37 	ELayout9x3,
       
    38     ELayout3x3,
       
    39 	};
       
    40 
       
    41 enum TPeninputVkbLafOption
       
    42 	{
       
    43 	EOptionNone,					// Default option setting	
       
    44 	EOption3CellRange = 0x0001,
       
    45 	EOptionWithSmily  = 0x0002
       
    46 	};
       
    47 
       
    48 struct TPeninputButtonLayoutData
       
    49 	{
       
    50 	TRect iRect;
       
    51 	TRect iInnerRect;
       
    52 	};
       
    53 
       
    54 // with 3 pieces icon as it's graphics
       
    55 struct TPeninputButtonLayoutDataEx
       
    56 	{
       
    57 	TRect iIconsFrameRect;			// The frame rect contains all the icons
       
    58 	TRect iMiddleIconRect;			// Middle icon rect
       
    59 	};	
       
    60 	
       
    61 struct TPeninputKeyLayoutData
       
    62 	{
       
    63 	TRect iKaypadRect;
       
    64 	RArray<TRect> iRects;
       
    65 	RArray<TRect> iCharRects;
       
    66 	TAknTextLineLayout iTextLayout;
       
    67 	const CFont* iFont;
       
    68 	};
       
    69 
       
    70 struct TPeninputEntryLayoutData
       
    71 	{
       
    72 	TRect iRect;
       
    73 	TRect iPromptTextRect;
       
    74 	TRect iTextRect;
       
    75 	const CFont* iPromptTextFont;
       
    76 	const CFont* iTextFont;
       
    77 	};
       
    78 
       
    79 struct TPeninputRangeBarLayoutData
       
    80 	{
       
    81 	TRect iRect;
       
    82 	RArray<TPeninputButtonLayoutData> iCellDataArray;
       
    83 	};
       
    84 
       
    85 struct TPeninputICFConfig
       
    86 	{
       
    87 	TInt iLeftMargin;
       
    88 	TInt iRightMargin;
       
    89 	TInt iTopMargin;
       
    90 	TInt iTextLineHeight;
       
    91 	TInt iLineSpaceMargin;
       
    92 	};
       
    93 	
       
    94 class CPeninputQwtLayoutDataInfo : public CBase
       
    95 	{
       
    96 public:
       
    97 	virtual ~CPeninputQwtLayoutDataInfo();
       
    98 	TPeninputButtonLayoutData 	iCloseButton;
       
    99 	TPeninputButtonLayoutData 	iOptionButton;
       
   100 	TPeninputEntryLayoutData  	iICF;
       
   101 	TPeninputButtonLayoutData	iMoveButton;	
       
   102 	TPeninputButtonLayoutData	iLeftButton;
       
   103 	TPeninputButtonLayoutData	iRightButton;
       
   104 	TPeninputButtonLayoutData	iClearButton;
       
   105 	TPeninputKeyLayoutData		iKeypad;
       
   106 	TPeninputButtonLayoutData 	iShiftButton;	
       
   107 	TPeninputRangeBarLayoutData	iRangbar;
       
   108 	TPeninputButtonLayoutData 	iSmillyButton;
       
   109 	TPeninputButtonLayoutData	iSpaceButton;
       
   110 	TPeninputButtonLayoutDataEx iSpaceButtonEx;	
       
   111 	TPeninputButtonLayoutData	iEnterButton;
       
   112 	TPeninputButtonLayoutData	iSwitchButton;
       
   113 	TRect iTitlebarRect;
       
   114 	TRect iClientRect;
       
   115 	TRect iQwtRect;
       
   116 	TRect iPreviewWndRect;
       
   117 	TRect iPreviewWndInnerRect;
       
   118 	TAknTextLineLayout iPreviewWndText;
       
   119     TPeninputButtonLayoutData   iTableUpButton;
       
   120     TPeninputButtonLayoutData   iTableDownButton;
       
   121     TPeninputButtonLayoutData   iTablePageLabel;
       
   122 	};
       
   123 
       
   124 class MPeninputLafDataBase
       
   125 	{
       
   126 public:
       
   127 	virtual const TPeninputButtonLayoutData& ButtonLayoutData( TInt aButtonID ) const = 0;
       
   128 	virtual const TPeninputEntryLayoutData& ICFLayoutData() const = 0;
       
   129 	virtual const TPeninputKeyLayoutData& KeypadLayoutData() const = 0;
       
   130 	virtual const TPeninputRangeBarLayoutData& RangbarLayoutData() const = 0;
       
   131 	
       
   132 	virtual const CPeninputQwtLayoutDataInfo& QwtLayoutData() const = 0;
       
   133 	virtual void SetLayoutType( TInt aLayoutType ) = 0;
       
   134 	virtual TInt LayoutType() const = 0;
       
   135 	};
       
   136 	
       
   137 class MPeninputLafDataCommon : public MPeninputLafDataBase
       
   138 	{
       
   139 public:
       
   140     virtual ~MPeninputLafDataCommon();
       
   141 	void  DestoryDataCommon();
       
   142 	const TPeninputButtonLayoutData& ButtonLayoutData( TInt aButtonID ) const;
       
   143 	const TPeninputEntryLayoutData& ICFLayoutData() const ;
       
   144 	const TPeninputKeyLayoutData& KeypadLayoutData() const ;
       
   145 	const TPeninputRangeBarLayoutData& RangbarLayoutData() const;
       
   146 	const CPeninputQwtLayoutDataInfo& QwtLayoutData() const;
       
   147 	
       
   148 	inline void SetLayoutType( TInt aLayoutType );
       
   149 	inline TInt LayoutType() const;
       
   150 	inline void SetLafOption( TPeninputVkbLafOption aLafOption );
       
   151 	inline TPeninputVkbLafOption LafOption() const;
       
   152 	void ConstructL();
       
   153 	TBool IsValid() const;
       
   154 protected:
       
   155 	void GetTopAndBottomPaneInfo( const TRect& aParentWndRect, 
       
   156 								  TInt aLayoutType,
       
   157 								  TInt aLayoutParam,
       
   158 								  CPeninputQwtLayoutDataInfo& aDataInfo );
       
   159 	virtual void ReadLafInfoL() = 0;
       
   160 	
       
   161 	TInt iLayoutType;
       
   162 	TPeninputVkbLafOption iLafOption;
       
   163 	RPointerArray<CPeninputQwtLayoutDataInfo> iLayoutDataInfo;
       
   164 	}; 
       
   165 	
       
   166 class CPeninputLafDataVKB : public CBase, 
       
   167 							public MPeninputLafDataCommon
       
   168 					
       
   169 	{
       
   170 public:	
       
   171     static CPeninputLafDataVKB* NewL( TInt aLayoutType );
       
   172 	static CPeninputLafDataVKB* NewLC( TInt aLayoutType );	
       
   173 	virtual ~CPeninputLafDataVKB();
       
   174 	
       
   175 protected:
       
   176 	CPeninputLafDataVKB( TInt aLayoutType );
       
   177 
       
   178 	void ReadLafInfoL();
       
   179 	};
       
   180 	
       
   181 class CPeninputLafDataFSQ : public CBase, 
       
   182 							public MPeninputLafDataCommon
       
   183 
       
   184 	{
       
   185 public:	
       
   186     static CPeninputLafDataFSQ* NewL( TInt aLayoutType );
       
   187 	static CPeninputLafDataFSQ* NewLC( TInt aLayoutType );
       
   188 	virtual ~CPeninputLafDataFSQ();
       
   189 
       
   190 protected:
       
   191 	CPeninputLafDataFSQ( TInt aLayoutType );
       
   192 
       
   193 	void ReadLafInfoL();
       
   194 	};	
       
   195 	
       
   196 /**
       
   197  *  Peninput VKB data management class
       
   198  *  This class manager the data of VKB
       
   199  *  
       
   200  *  @lib peninputgenericvkb.lib
       
   201  *  @since S60 v3.2
       
   202  */
       
   203 class CPeninputGenericVkbLafMgr : public CBase 
       
   204     {   
       
   205 
       
   206 public:
       
   207 
       
   208     /**
       
   209      * Two-phased constructor
       
   210      *
       
   211      * @since S60 v3.2
       
   212      * @return The pointer to CPeninputGenericVkbLafMgr object
       
   213      */
       
   214     static CPeninputGenericVkbLafMgr* NewL();
       
   215 
       
   216     /**
       
   217      * Two-phased constructor
       
   218      *
       
   219      * @since S60 v3.2
       
   220      * @return The pointer to CPeninputGenericVkbLafMgr object
       
   221      */
       
   222     static CPeninputGenericVkbLafMgr* NewLC();
       
   223 
       
   224     /**
       
   225      * Destructor
       
   226      *
       
   227      * @since S60 v3.2
       
   228      * @return None
       
   229      */
       
   230     virtual ~CPeninputGenericVkbLafMgr();
       
   231 
       
   232   	/**
       
   233      * ConstructL
       
   234      *
       
   235      * @since S60 v3.2
       
   236      * @return None
       
   237      */
       
   238 	void ConstructL();
       
   239 	
       
   240 	/**
       
   241      * Set layout type
       
   242      *
       
   243      * @since S60 v3.2
       
   244      * @param aLayoutType Layout type index
       
   245      * @return None
       
   246      */
       
   247     void SetInputModeL( TPluginInputMode aInputMode );
       
   248     
       
   249 	/**
       
   250      * Get layout type
       
   251      *
       
   252      * @since S60 v3.2
       
   253      * @return Input mode
       
   254      */    
       
   255 	TPluginInputMode InputMode() const;
       
   256 	
       
   257 	/**
       
   258      * Set layout type
       
   259      *
       
   260      * @since S60 v3.2
       
   261      * @param aLayoutType Layout type index
       
   262      * @return None
       
   263      */
       
   264 	void SetLayoutType( TPeninputQwtLayoutType aLayoutType );
       
   265 	
       
   266 	/**
       
   267      * Set option ( option change will cause reloading laf )
       
   268      *
       
   269      * @since S60 v3.2
       
   270      * @param aOption option type
       
   271      * @return None
       
   272      */
       
   273      void SetLafOption( TPeninputVkbLafOption aOption );
       
   274      TPeninputVkbLafOption OptionType() const;
       
   275      
       
   276 	/**
       
   277      * Get button laf data
       
   278      *
       
   279      * @since S60 v3.2
       
   280      * @param aButtonID 	button id
       
   281      * @param aOutterRect	button rect
       
   282      * @param aInnerRect	button forground rect
       
   283      * @return None
       
   284      */	
       
   285 	void GetButtonRect( TPeninputCommonCtrlID aButtonID, 
       
   286 						TRect& aOutterRect,
       
   287 						TRect& aInnerRect );
       
   288 	
       
   289 	/**
       
   290      * reload laf data
       
   291      *
       
   292      * @since S60 v3.2
       
   293      * @return None
       
   294      */
       
   295 	inline void UpdateLafDataL();
       
   296 	
       
   297 	/**
       
   298      * Get key laf data
       
   299      *
       
   300      * @since S60 v3.2
       
   301      * @param aColume 		the colume index of the key
       
   302      * @param aRow			the row index of the key
       
   303      * @return Key rect
       
   304      */								
       
   305 	void GetKeyRect( TInt aColume, TInt aRow, TRect& aKeyRect, TRect& aCharRect ) const;
       
   306 	const CFont* KeyTextFont() const;
       
   307 	const TRect& KeypadRect() const;
       
   308 	const TRect& ICFRect() const;
       
   309 	const CFont* ICFPromptTextFont() const;
       
   310 	const CFont* ICFTextFont() const;
       
   311 	TAknTextLineLayout KeyTextLayout() const;
       
   312 	void GetICFConfig( TPeninputICFConfig& aICFConfig );
       
   313 	const TRect& EntirePaneRect() const;
       
   314 	const TRect& RangbarRect() const;
       
   315 	TInt RangbarCellCount() const;
       
   316 	void RangbarCellAt( TInt aIndex, TRect& aOutterRect, TRect& aInnerRect );
       
   317 	
       
   318 	TPeninputQwtLayoutType LayoutTypeFromRowsColumns(const TInt aRows, const TInt aColumns);
       
   319 	const TRect& TitlebarRect() const;
       
   320 	
       
   321 	TBool IsValid();
       
   322 	const TRect& ClientRect() const;
       
   323 	
       
   324 	inline void GetPreviewWndRect( TRect& aOutRect, TRect& aInnerRect ) const;
       
   325 	inline TAknTextLineLayout PreviewWndText() const;
       
   326 	void GetSpaceButtonExLayoutInfo( TRect& aIconsFrameRect, TRect& aMiddleIconRect ) const;
       
   327 protected:
       
   328 
       
   329 	/**
       
   330      * Set laf data base type
       
   331      *
       
   332      * @since S60 v3.2
       
   333      * @param aLafData The exact laf data
       
   334      * @return None
       
   335      */
       
   336 	void SetLafData( MPeninputLafDataBase* aLafData );
       
   337 	
       
   338     /**
       
   339      * Constructor
       
   340      *
       
   341      * @since S60 v3.2
       
   342      * @param aContext The layout context
       
   343      * @return None
       
   344      */
       
   345     CPeninputGenericVkbLafMgr();
       
   346     
       
   347 private:
       
   348 	MPeninputLafDataCommon* iLafData;
       
   349 	TPluginInputMode iInputMode;
       
   350     };
       
   351    
       
   352 inline void CPeninputGenericVkbLafMgr::UpdateLafDataL()
       
   353 	{
       
   354 	iLafData->ConstructL();	
       
   355 	}
       
   356 	
       
   357 inline void CPeninputGenericVkbLafMgr::GetPreviewWndRect( TRect& aOutRect, 
       
   358                                                           TRect& aInnerRect ) const
       
   359 	{
       
   360 	aOutRect = iLafData->QwtLayoutData().iPreviewWndRect;
       
   361 	aInnerRect = iLafData->QwtLayoutData().iPreviewWndInnerRect;
       
   362 	}
       
   363 	
       
   364 inline TAknTextLineLayout CPeninputGenericVkbLafMgr::PreviewWndText() const
       
   365 	{
       
   366 	return iLafData->QwtLayoutData().iPreviewWndText;
       
   367 	}
       
   368 	
       
   369 #endif // C_CPENINPUTGENERICLAFDATAMGR_H