textinput/peninputcommonctrls/inc/peninputselectionlist/peninputcommonchoicelist.h
changeset 27 694fa80c203c
parent 24 fc42a86c98e3
child 35 0f326f2e628e
equal deleted inserted replaced
24:fc42a86c98e3 27:694fa80c203c
     1 /*
       
     2 * Copyright (c) 2005-2006 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:  header file of choice list window
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef C_PENINPUTCOMMONCHOICELIST_H
       
    19 #define C_PENINPUTCOMMONCHOICELIST_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <w32std.h>
       
    23 #include <e32base.h>
       
    24 #include <peninputlayoutchoicelist.h>
       
    25 #include <AknsConstants.h>
       
    26 
       
    27 /** class forward decalaration */
       
    28 class CFepUiLayout;
       
    29 
       
    30 enum ECommonChoiceListStyle
       
    31 	{
       
    32 	EFixedLength,
       
    33 	EAutoFitLength
       
    34 	};
       
    35 	
       
    36 /**
       
    37  *  CPeninputCommonChoiceList class 
       
    38  *
       
    39  *  This class for touch input common choice list. The prop. of 
       
    40  *  this control is depend on laf data.
       
    41  *
       
    42  *  @lib 
       
    43  *  @since S60 v5.0
       
    44  */
       
    45 class CPeninputCommonChoiceList : public CFepLayoutChoiceList
       
    46     {
       
    47 public: 
       
    48 
       
    49     /**
       
    50      * Symbian Constructor
       
    51      *
       
    52      * @since S60 v5.0
       
    53      * @param aUiLayout 		Pointer to uilayout
       
    54      * @param aControlId 		Choice list id
       
    55      * @param aItemSkinID 		Item skin id
       
    56      * @param aBackgroundSkinID Background skin id
       
    57      * @return Pointer to created CPeninputCommonChoiceList object
       
    58      */
       
    59     IMPORT_C static CPeninputCommonChoiceList* NewL( CFepUiLayout* aUiLayout, 
       
    60     											     TInt aControlId,
       
    61     											     TAknsItemID aItemSkinID,
       
    62     											     TAknsItemID aBackgroundSkinID,
       
    63     											     ECommonChoiceListStyle aListStyle = EAutoFitLength);
       
    64 
       
    65     /**
       
    66      * Destructor
       
    67      *
       
    68      * @since S60 v5.0
       
    69      * @return None
       
    70      */
       
    71     IMPORT_C virtual ~CPeninputCommonChoiceList();
       
    72     
       
    73     /**
       
    74      * Add rect of item to the end of list
       
    75      *
       
    76      * @param aRect 	The rect of the item
       
    77      * @since S60 v5.0
       
    78      * @return None
       
    79      */    
       
    80     IMPORT_C void AddItemRectL( const TRect& aRect );
       
    81     
       
    82     /**
       
    83      * Remove all the rects of item
       
    84      *
       
    85      * @since S60 v5.0
       
    86      * @return None
       
    87      */    
       
    88     IMPORT_C void RemoveAllItemsRect();
       
    89     
       
    90     /**
       
    91      * Set text layout data
       
    92      *
       
    93      * @param aTextLayout 	Text layout from laf data
       
    94      * @since S60 v5.0
       
    95      * @return None
       
    96      */    
       
    97     IMPORT_C void SetTextLayout( const TAknTextLineLayout& aTextLayout );
       
    98     
       
    99     /**
       
   100      * Set list column count. The maxium column of the control is based on the laf
       
   101      * Any number exceeds the maxium will be ignored.
       
   102      *
       
   103      * @param aMaxCount 
       
   104      * @since S60 v5.0
       
   105      * @return None
       
   106      */   
       
   107     IMPORT_C void SetListColumnNumWithLafL( TInt aMaxCount);
       
   108     
       
   109     /**
       
   110      * Set skin ID
       
   111      *
       
   112      * @param aItemSkinID  			item skin ID
       
   113      * @param aBackgroundSkinID  	background skin ID
       
   114      * @since S60 v5.0
       
   115      * @return None
       
   116      */   
       
   117     IMPORT_C void SetListSkinID( TAknsItemID aItemSkinID, TAknsItemID aBackgroundSkinID );
       
   118     /**
       
   119      * Hit Test
       
   120      *
       
   121      * @param aPoint  			touched point
       
   122      * @return Index of list.
       
   123      */       
       
   124     IMPORT_C TInt HitTest(const TPoint& aPoint);    							 
       
   125 protected:
       
   126     /**
       
   127      * Constructor.        
       
   128      *
       
   129      * @since S60 V4.0        
       
   130      * @param aUiLayout Ui layout who contains this control.Ownership not transferred
       
   131      * @param aControlId control Id
       
   132      * @param aItemSkinID 		Item skin id
       
   133      * @param aBackgroundSkinID Background skin id
       
   134      */  
       
   135 	IMPORT_C CPeninputCommonChoiceList( CFepUiLayout* aUiLayout, 
       
   136 							   TInt aControlId,
       
   137 							   TAknsItemID aItemSkinID,
       
   138 							   TAknsItemID aBackgroundSkinID,
       
   139 							   ECommonChoiceListStyle aListStyle );
       
   140 
       
   141 	TInt MaxWidthOfListItem();
       
   142 private:
       
   143 	/**
       
   144      * Choice list draw function
       
   145      *
       
   146      * @since S60 V4.0
       
   147      * @return None.     
       
   148      */
       
   149     IMPORT_C virtual void Draw();
       
   150     
       
   151 	/**
       
   152      * Calculate rect based on item count. (only length, suppose the count is fixed)
       
   153      *
       
   154      * @since S60 V4.0
       
   155      * @return None.     
       
   156      */
       
   157     IMPORT_C virtual void ReCalcLayout();  
       
   158      
       
   159     void DrawBackground();
       
   160     void DrawItem( TInt aIndex, TBool aIsFocus );
       
   161 private: // data
       
   162     /**
       
   163      * Item rect array.
       
   164      */
       
   165 	RArray<TRect> iItemRects;
       
   166 	
       
   167     /**
       
   168      * Item text layout
       
   169      */	
       
   170 	TAknTextLineLayout iTextLayout;
       
   171 	
       
   172     /**
       
   173      * The skin ID of sub item and background
       
   174      */
       
   175     TAknsItemID iItemSkinID;
       
   176     TAknsItemID iBackgroundSkinID;
       
   177     
       
   178     /**
       
   179      * The style of the list
       
   180      */
       
   181 	ECommonChoiceListStyle iListStyle;
       
   182 	
       
   183     /**
       
   184      * The last column number of the list
       
   185      */
       
   186 	TInt iLastColumnNum;
       
   187     };
       
   188 
       
   189 #endif //C_PENINPUTCOMMONCHOICELIST_H
       
   190 //End Of File