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