textinput/peninputvkbcn/inc/peninputvkbcnlafdatamgr.h
changeset 0 eb1f2e154e89
child 3 f5a1e66df979
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_PENINPUTVKBCNLAFDATAMGR_H
       
    20 #define C_PENINPUTVKBCNLAFDATAMGR_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 TPeninputCnQwtLayoutType
       
    32 	{
       
    33 	ELayoutNone = -1,
       
    34 	ELayout10x3,
       
    35 	ELayout11x3,
       
    36 	ELayout11x4,
       
    37 	ELayout10x3_withCandi,
       
    38 	ELayout10x4
       
    39 	};
       
    40 
       
    41 enum TPeninputCnCellType
       
    42 	{
       
    43 	EVkbCangjieAndPinying,			// 10
       
    44 	EVkbStroke,						// 10
       
    45 	EVkbZhuyin,		 				// 11 
       
    46 	EVkbLatin_Zhuyin,				// 11
       
    47 	EVkbLatin,						// 10
       
    48 	EVkbAccent,						
       
    49 	EVkbNumber,						// 10
       
    50 	EVkbNumber_Zhuyin,				// 11
       
    51 	EVkbCangjieAndPinying_FSQ,		// 10
       
    52 	EVkbStroke_FSQ,					// 10
       
    53 	EVkbZhuyin_FSQ,					// 11
       
    54 	EVkbLatin_FSQ,					// 10
       
    55 	EVkbNumber_FSQ,					// 10
       
    56 	EVkbLatin_Zhuyin_FSQ,			// 11
       
    57 	EVkbNumber_Zhuyin_FSQ			// 11
       
    58 	};
       
    59 	
       
    60 enum TPeninputCnVkbLafOption
       
    61 	{
       
    62 	EOptionNone,					// Default option setting	
       
    63 	EOption3CellRange = 0x0001,
       
    64 	EOptionWithSmily  = 0x0002
       
    65 	};
       
    66 
       
    67 struct TPeninputCnButtonLayoutData
       
    68 	{
       
    69 	TRect iRect;
       
    70 	TRect iInnerRect;
       
    71 	};
       
    72 	
       
    73 struct TPeninputCnKeyLayoutData
       
    74 	{
       
    75 	TRect iKaypadRect;
       
    76 	RArray<TRect> iRects;
       
    77 	RArray<TRect> iCharRects;
       
    78 	TAknTextLineLayout iTextLayout;
       
    79 	const CFont* iFont;
       
    80 	};
       
    81 
       
    82 struct TPeninputCnEntryLayoutData
       
    83 	{
       
    84 	TRect iRect;
       
    85 	TRect iPromptTextRect;
       
    86 	TRect iTextRect;
       
    87 	const CFont* iPromptTextFont;
       
    88 	const CFont* iTextFont;
       
    89 	};
       
    90 	
       
    91 struct TPeninputCnICFConfig
       
    92 	{
       
    93 	TInt iLeftMargin;
       
    94 	TInt iRightMargin;
       
    95 	TInt iTopMargin;
       
    96 	TInt iTextLineHeight;
       
    97 	TInt iLineSpaceMargin;
       
    98 	};
       
    99 
       
   100 
       
   101 struct TPeninputCnRangeBarLayoutData
       
   102 	{
       
   103 	TRect iRect;
       
   104 	RArray<TPeninputCnButtonLayoutData> iCellDataArray;
       
   105 	};
       
   106 	
       
   107 struct TPeninputCnSpaceIconLayoutDataEx
       
   108 	{
       
   109 	TSize iIconOffset;		// The offset to the left and top border of frame
       
   110 	TInt  iSideIconWidth; 	// The width of two sizes'subicon
       
   111 	};
       
   112 
       
   113 /*
       
   114 * Store LAF data for candidate list
       
   115 */
       
   116 struct TPeninputCnCandidateListLayoutData
       
   117     {
       
   118     TSize iSelectionItemSize;    
       
   119     TInt iSelectionHorMargin;
       
   120     TInt iSelectionVerMargin;
       
   121     TSize iSelectionNaviSize;
       
   122     TSize iSelectionNaviInnerSize;
       
   123     TAknTextLineLayout iSelectionTextLine;
       
   124     TAknTextLineLayout iSelectionPageTextLine;
       
   125     const CFont* iFont;
       
   126     };
       
   127 
       
   128 /*
       
   129 * Stroe LAF data for tooltip box
       
   130 */
       
   131 struct TPeninputCnTooltipBoxLayoutData
       
   132     {
       
   133     TRect iRect;
       
   134     TAknTextLineLayout iTooltipTextLayout;
       
   135     };
       
   136 
       
   137 class CPeninputCnQwtLayoutDataInfo : public CBase
       
   138 	{
       
   139 public:
       
   140 	virtual ~CPeninputCnQwtLayoutDataInfo();
       
   141 	TPeninputCnButtonLayoutData 	iCloseButton;
       
   142 	TPeninputCnButtonLayoutData 	iOptionButton;
       
   143 	TPeninputCnEntryLayoutData  	iICF;
       
   144 	TPeninputCnButtonLayoutData	iMoveButton;	
       
   145 	TPeninputCnButtonLayoutData	iLeftButton;
       
   146 	TPeninputCnButtonLayoutData	iRightButton;
       
   147 	TPeninputCnButtonLayoutData	iClearButton;
       
   148 	TPeninputCnKeyLayoutData		iKeypad;
       
   149 	TPeninputCnButtonLayoutData 	iShiftButton;	
       
   150 	TPeninputCnRangeBarLayoutData	iRangbar;
       
   151 	TPeninputCnButtonLayoutData 	iSmillyButton;
       
   152 	TPeninputCnButtonLayoutData	iSpaceButton;
       
   153 	TPeninputCnButtonLayoutData	iEnterButton;
       
   154 	TPeninputCnButtonLayoutData	iSwitchButton;
       
   155 	TRect iTitlebarRect;
       
   156 	TRect iClientRect;
       
   157 	TRect iQwtRect;
       
   158 	TRect iPreviewWndRect;
       
   159 	TRect iPreviewWndInnerRect;
       
   160 	TAknTextLineLayout iPreviewWndText;
       
   161 	CFont* iPreviewFont;
       
   162 	TPeninputCnSpaceIconLayoutDataEx iSpaceIconLayout;
       
   163 	
       
   164 	/*
       
   165 	* LAF data for candidate list
       
   166 	*/
       
   167 	TPeninputCnCandidateListLayoutData iCandidateList;
       
   168 	
       
   169 	/*
       
   170 	* LAF data for tooltip box
       
   171 	*/
       
   172 	TPeninputCnTooltipBoxLayoutData iTooltipBox;
       
   173 	};	
       
   174 
       
   175 class MPeninputCnLafDataBase
       
   176 	{
       
   177 public:
       
   178 	virtual const TPeninputCnButtonLayoutData& ButtonLayoutData( TInt aButtonID ) const = 0;
       
   179 	virtual const TPeninputCnEntryLayoutData& ICFLayoutData() const = 0;
       
   180 	virtual const TPeninputCnKeyLayoutData& KeypadLayoutData() const = 0;
       
   181 	virtual const TPeninputCnRangeBarLayoutData& RangbarLayoutData() const = 0;
       
   182 	
       
   183 	virtual const CPeninputCnQwtLayoutDataInfo& QwtLayoutData() const = 0;
       
   184 	virtual void SetLayoutType( TInt aLayoutType ) = 0;
       
   185 	virtual TInt LayoutType() const = 0;
       
   186 	};
       
   187 	
       
   188 class MPeninputCnLafDataCommon : public MPeninputCnLafDataBase
       
   189 	{
       
   190 public:
       
   191     virtual ~MPeninputCnLafDataCommon();
       
   192 	void  DestoryDataCommon();
       
   193 	const TPeninputCnButtonLayoutData& ButtonLayoutData( TInt aButtonID ) const;
       
   194 	const TPeninputCnEntryLayoutData& ICFLayoutData() const ;
       
   195 	const TPeninputCnKeyLayoutData& KeypadLayoutData() const ;
       
   196 	const TPeninputCnRangeBarLayoutData& RangbarLayoutData() const;
       
   197 	const CPeninputCnQwtLayoutDataInfo& QwtLayoutData() const;
       
   198 	
       
   199 	/*
       
   200 	* Return layout data for candidate list;
       
   201 	*
       
   202 	* @return The layout data for candidate list
       
   203 	*/	
       
   204 	const TPeninputCnCandidateListLayoutData& CandidateListLayoutData() const;
       
   205 	
       
   206 	/*
       
   207 	* Return layout data for tooltip box;
       
   208 	*
       
   209 	* @return The layout data for tooltip box
       
   210 	*/	
       
   211 	const TPeninputCnTooltipBoxLayoutData& TooltipBoxLayoutData() const;
       
   212 	
       
   213 	inline void SetLayoutType( TInt aLayoutType );
       
   214 	inline TInt LayoutType() const;
       
   215 	inline void SetLafOption( TPeninputCnVkbLafOption aLafOption );
       
   216 	inline TPeninputCnVkbLafOption LafOption() const;
       
   217 	void ConstructL();
       
   218 	TBool IsValid() const;
       
   219 protected:
       
   220 	void GetTopAndBottomPaneInfo( const TRect& aParentWndRect, 
       
   221 								  TInt aLayoutType,
       
   222 								  TInt aLayoutParam,
       
   223 								  CPeninputCnQwtLayoutDataInfo& aDataInfo );
       
   224 	virtual void ReadLafInfoL() = 0;
       
   225 	
       
   226 	TInt iLayoutType;
       
   227 	TPeninputCnVkbLafOption iLafOption;
       
   228 	RPointerArray<CPeninputCnQwtLayoutDataInfo> iLayoutDataInfo;
       
   229 	}; 
       
   230 	
       
   231 class CPeninputCnLafDataVKB : public CBase, 
       
   232 							public MPeninputCnLafDataCommon
       
   233 					
       
   234 	{
       
   235 public:	
       
   236     static CPeninputCnLafDataVKB* NewL( TInt aLayoutType );
       
   237 	static CPeninputCnLafDataVKB* NewLC( TInt aLayoutType );	
       
   238 	virtual ~CPeninputCnLafDataVKB();
       
   239 	
       
   240 protected:
       
   241 	CPeninputCnLafDataVKB( TInt aLayoutType );
       
   242 
       
   243 	void ReadLafInfoL();
       
   244 	};
       
   245 	
       
   246 class CPeninputCnLafDataFSQ : public CBase, 
       
   247 							public MPeninputCnLafDataCommon
       
   248 
       
   249 	{
       
   250 public:	
       
   251     static CPeninputCnLafDataFSQ* NewL( TInt aLayoutType );
       
   252 	static CPeninputCnLafDataFSQ* NewLC( TInt aLayoutType );
       
   253 	virtual ~CPeninputCnLafDataFSQ();
       
   254 
       
   255 protected:
       
   256 	CPeninputCnLafDataFSQ( TInt aLayoutType );
       
   257 
       
   258 	void ReadLafInfoL();
       
   259 	
       
   260 private:
       
   261 
       
   262     /**
       
   263      * Read LAF data for candidate list 
       
   264      *  
       
   265      * @param aRect the parent window's rect
       
   266      * @return candidate list layout data
       
   267      */	
       
   268 	TPeninputCnCandidateListLayoutData ReadLafForCandidateList( const TRect& aRect );
       
   269 
       
   270     /**
       
   271      * Read LAF data for tooltip box
       
   272      *  
       
   273      * @param aRect the parent window's rect
       
   274      * @return tooltip box layout data
       
   275      */	
       
   276 	TPeninputCnTooltipBoxLayoutData ReadLafForTooltipBox( const TRect& aRect );
       
   277 	};	
       
   278 	
       
   279 /**
       
   280  *  Peninput VKB data management class
       
   281  *  This class manager the data of VKB
       
   282  *  
       
   283  *  @lib peninputgenericvkb.lib
       
   284  *  @since S60 v3.2
       
   285  */
       
   286 class CPeninputCnGenericVkbLafMgr : public CBase 
       
   287     {   
       
   288 
       
   289 public:
       
   290 
       
   291     /**
       
   292      * Two-phased constructor
       
   293      *
       
   294      * @since S60 v3.2
       
   295      * @return The pointer to CPeninputCnGenericVkbLafMgr object
       
   296      */
       
   297     static CPeninputCnGenericVkbLafMgr* NewL();
       
   298 
       
   299     /**
       
   300      * Two-phased constructor
       
   301      *
       
   302      * @since S60 v3.2
       
   303      * @return The pointer to CPeninputCnGenericVkbLafMgr object
       
   304      */
       
   305     static CPeninputCnGenericVkbLafMgr* NewLC();
       
   306 
       
   307     /**
       
   308      * Destructor
       
   309      *
       
   310      * @since S60 v3.2
       
   311      * @return None
       
   312      */
       
   313     virtual ~CPeninputCnGenericVkbLafMgr();
       
   314 
       
   315   	/**
       
   316      * ConstructL
       
   317      *
       
   318      * @since S60 v3.2
       
   319      * @return None
       
   320      */
       
   321 	void ConstructL();
       
   322 	
       
   323 	/**
       
   324      * Set layout type
       
   325      *
       
   326      * @since S60 v3.2
       
   327      * @param aLayoutType Layout type index
       
   328      * @return None
       
   329      */
       
   330     void SetInputModeL( TPluginInputMode aInputMode );
       
   331     
       
   332 	/**
       
   333      * Get layout type
       
   334      *
       
   335      * @since S60 v3.2
       
   336      * @return Input mode
       
   337      */    
       
   338 	TPluginInputMode InputMode() const;
       
   339 	
       
   340 	/**
       
   341      * Set layout type
       
   342      *
       
   343      * @since S60 v3.2
       
   344      * @param aLayoutType Layout type index
       
   345      * @return None
       
   346      */
       
   347 	void SetLayoutType( TPeninputCnQwtLayoutType aLayoutType );
       
   348 	
       
   349 	/**
       
   350      * Set option ( option change will cause reloading laf )
       
   351      *
       
   352      * @since S60 v3.2
       
   353      * @param aOption option type
       
   354      * @return None
       
   355      */
       
   356      void SetLafOption( TPeninputCnVkbLafOption aOption );
       
   357      TPeninputCnVkbLafOption OptionType() const;
       
   358      
       
   359 	/**
       
   360      * Get button laf data
       
   361      *
       
   362      * @since S60 v3.2
       
   363      * @param aButtonID 	button id
       
   364      * @param aOutterRect	button rect
       
   365      * @param aInnerRect	button forground rect
       
   366      * @return None
       
   367      */	
       
   368 	void GetButtonRect( TPeninputCommonCtrlID aButtonID, 
       
   369 						TRect& aOutterRect,
       
   370 						TRect& aInnerRect );
       
   371 	
       
   372 	/**
       
   373      * Get key laf data
       
   374      *
       
   375      * @since S60 v3.2
       
   376      * @param aColume 		the colume index of the key
       
   377      * @param aRow			the row index of the key
       
   378      * @return Key rect
       
   379      */								
       
   380 	void GetKeyRect( TInt aColume, TInt aRow, TRect& aKeyRect, TRect& aCharRect ) const;
       
   381 	const CFont* KeyTextFont() const;
       
   382 	const TRect& KeypadRect() const;
       
   383 	const TRect& ICFRect() const;
       
   384 	const CFont* ICFPromptTextFont() const;
       
   385 	const CFont* ICFTextFont() const;
       
   386 	TAknTextLineLayout KeyTextLayout() const;
       
   387 	void GetICFConfig( TPeninputCnICFConfig& aICFConfig );
       
   388 	const TRect& EntirePaneRect() const;
       
   389 	const TRect& RangbarRect() const;
       
   390 	TInt RangbarCellCount() const;
       
   391 	void RangbarCellAt( TInt aIndex, TRect& aOutterRect, TRect& aInnerRect );
       
   392 	
       
   393 	TPeninputCnQwtLayoutType LayoutTypeFromRowsColumns(const TInt aRows, const TInt aColumns);
       
   394 	const TRect& TitlebarRect() const;
       
   395 	
       
   396 	TBool IsValid();
       
   397 	const TRect& ClientRect() const;
       
   398 	
       
   399 	/**
       
   400      * Get gap value for cell calc 
       
   401      *
       
   402      * @since S60 v3.2
       
   403      * @return gap value
       
   404      */		
       
   405 	static TSize GetCellSize( TPeninputCnCellType aCellType );
       
   406 	
       
   407 	/**
       
   408      * Get gap value for cell calc 
       
   409      *
       
   410      * @since S60 v3.2
       
   411      * @return gap value
       
   412      */		
       
   413 	TInt CellAidGap( TPeninputCnCellType aCellType ) const;
       
   414 	
       
   415 	inline void GetPreviewWndRect( TRect& aOutRect, TRect& aInnerRect ) const;
       
   416 	inline TAknTextLineLayout PreviewWndText() const;
       
   417 	inline CFont* PreviewFont() const;
       
   418 	inline TSize GetSpaceIconOffset() const;
       
   419 	inline TInt GetSpaceSideIconWidth() const;
       
   420     
       
   421 	/**
       
   422      * Return layout data for candidate list
       
   423      *
       
   424      * @return The layout data for candidate list
       
   425      */
       
   426 	const TPeninputCnCandidateListLayoutData& CandidateListLayoutData() const;
       
   427 	
       
   428 	/*
       
   429 	* Return layout data for candidate list
       
   430 	*
       
   431 	* @return The layout data for tooltip box	
       
   432 	*/	
       
   433 	const TPeninputCnTooltipBoxLayoutData& TooltipBoxLayoutData() const;
       
   434 protected:
       
   435 
       
   436 	/**
       
   437      * Set laf data base type
       
   438      *
       
   439      * @since S60 v3.2
       
   440      * @param aLafData The exact laf data
       
   441      * @return None
       
   442      */
       
   443 	void SetLafData( MPeninputCnLafDataBase* aLafData );
       
   444 	
       
   445     /**
       
   446      * Constructor
       
   447      *
       
   448      * @since S60 v3.2
       
   449      * @param aContext The layout context
       
   450      * @return None
       
   451      */
       
   452     CPeninputCnGenericVkbLafMgr();
       
   453     
       
   454 private:
       
   455 	MPeninputCnLafDataCommon* iLafData;
       
   456 	TPluginInputMode iInputMode;
       
   457     };
       
   458    
       
   459 inline void CPeninputCnGenericVkbLafMgr::GetPreviewWndRect( TRect& aOutRect, 
       
   460                                                             TRect& aInnerRect ) const
       
   461 	{
       
   462 	aOutRect = iLafData->QwtLayoutData().iPreviewWndRect;
       
   463 	aInnerRect = iLafData->QwtLayoutData().iPreviewWndInnerRect;
       
   464 	}
       
   465 	
       
   466 inline TAknTextLineLayout CPeninputCnGenericVkbLafMgr::PreviewWndText() const
       
   467 	{
       
   468 	return iLafData->QwtLayoutData().iPreviewWndText;
       
   469 	}
       
   470 	
       
   471 inline CFont* CPeninputCnGenericVkbLafMgr::PreviewFont() const
       
   472 	{
       
   473 	return iLafData->QwtLayoutData().iPreviewFont;
       
   474 	}	
       
   475 	
       
   476 inline TSize CPeninputCnGenericVkbLafMgr::GetSpaceIconOffset() const
       
   477 	{
       
   478 	return iLafData->QwtLayoutData().iSpaceIconLayout.iIconOffset;	
       
   479 	}	
       
   480 	
       
   481 inline TInt CPeninputCnGenericVkbLafMgr::GetSpaceSideIconWidth() const
       
   482 	{
       
   483 	return iLafData->QwtLayoutData().iSpaceIconLayout.iSideIconWidth;	
       
   484 	}	   
       
   485 #endif // C_PENINPUTVKBCNLAFDATAMGR_H