phonebookui/Phonebook2/UIControls/inc/cpbk2contactviewcustomlistboxitemdrawer.h
changeset 0 e686773b3f54
child 32 2828b4d142c0
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     1 /*
       
     2 * Copyright (c) 2009 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: PhoneBook2 custom control. Code has been modified to
       
    15 *       suit PhoneBook2 requirements. See CColumnListBoxItemDrawer
       
    16 *       in EIKCLB.CPP
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #if !defined(__CPbk2ContactViewCustomListBoxItemDrawer_H__)
       
    22 #define __CPbk2ContactViewCustomListBoxItemDrawer_H__
       
    23 
       
    24 
       
    25 #include <eiklbi.h>
       
    26 #include <eiktxlbx.h>
       
    27 #include <eiklbed.h>
       
    28 
       
    29 class CPbk2ContactViewCustomListBoxData;
       
    30 
       
    31 /**
       
    32  * Draws the contents of list box items.
       
    33  * Ensure that this piece of code is in sync with Avkon EIKCLB.CPP(CColumnListBoxItemDrawer)
       
    34  * @since 5.0
       
    35  */
       
    36 class CPbk2ContactViewCustomListBoxItemDrawer : public CTextListItemDrawer
       
    37     {
       
    38 
       
    39 public:
       
    40     /* C++ default constructor.
       
    41     *
       
    42     *  @since 3.2
       
    43     */
       
    44             
       
    45     CPbk2ContactViewCustomListBoxItemDrawer();
       
    46             
       
    47     /**
       
    48      * C++ default constructor.
       
    49      *
       
    50      * Initialises the list box item drawer with the specified model, 
       
    51      * font and data.
       
    52      *
       
    53      * @param aTextListBoxModel The model whose items will be drawn. 
       
    54      *        This provides the item text that is drawn using 
       
    55      *        @c DrawItemText().
       
    56      * @param aFont The font in which the items will be drawn. 
       
    57      * @param aColumnData The column list box data. This comprises: 
       
    58      *        the column widths, gaps, fonts, aligments and bitmaps.
       
    59      */
       
    60 
       
    61     CPbk2ContactViewCustomListBoxItemDrawer(MTextListBoxModel* aTextListBoxModel, 
       
    62                                       const CFont* aFont, 
       
    63                                       CPbk2ContactViewCustomListBoxData* aColumnData );
       
    64  
       
    65     /**
       
    66      * Destructor.
       
    67      */
       
    68     ~CPbk2ContactViewCustomListBoxItemDrawer();
       
    69 
       
    70     /**
       
    71      * Gets a pointer to the column list box data as set during construction.
       
    72      * Does not transfer ownership.
       
    73      *
       
    74      * @return The column list box data.
       
    75      */
       
    76     CPbk2ContactViewCustomListBoxData* ColumnData() const;
       
    77 
       
    78 public:
       
    79 
       
    80 
       
    81     /** 
       
    82      * The structure holding given item properties. 
       
    83      *
       
    84      * Used for storing information given through @c SetProperties() method.
       
    85      */
       
    86     struct SListProperties 
       
    87         {
       
    88         /** Item identifier. */
       
    89         TInt iItem; // must be first
       
    90 
       
    91         /** Properties of the item. */
       
    92         TListItemProperties iProperties;
       
    93         };
       
    94 
       
    95     /**
       
    96      * Clears all properties from the @c CPbk2ContactViewCustomListBoxItemDrawer.
       
    97      */
       
    98     void ClearAllPropertiesL();
       
    99     
       
   100    
       
   101     /**
       
   102      * Set the property for an item with @c aItemIndex 
       
   103      *
       
   104      * @param aItemIndex Item index
       
   105      * @param aProperty The new property setting
       
   106      * The SetProperties is convinience method for normal cases.
       
   107      * NOTE that it does NOT work correctly if you can insert/delete
       
   108      * items from the list -- You need to update all properties if
       
   109      * any changes to the item text array happen! Often it is convinient
       
   110      * to override the Properties() method. Further, use this only
       
   111      * for small lists as it causes O(n) time if you need to set
       
   112      * all properties.
       
   113      */
       
   114     void SetPropertiesL(TInt aItemIndex, 
       
   115                                  TListItemProperties aProperty);
       
   116 
       
   117     /**
       
   118      * Get properties for an item. 
       
   119      *
       
   120      * @param aItemIndex Item's index for identifying.
       
   121      * @return Wanted property set.
       
   122      */
       
   123     virtual TListItemProperties Properties(TInt aItemIndex) const;
       
   124 
       
   125 public: // from CTextListItemDrawer
       
   126 
       
   127     /**
       
   128      * From @c CTextListItemDrawer.
       
   129      * 
       
   130      * Draw item text.
       
   131      *
       
   132      * @param aItemIndex Index of the item to draw. 
       
   133      * @param aItemTextRect Area to draw into. 
       
   134      * @param aItemIsCurrent @c ETrue if the item is current. 
       
   135      * @param aViewIsEmphasized @c ETrue if the view is emphasised.
       
   136      * @param aItemIsSelected @c ETrue if the item is selected.
       
   137      */
       
   138     void DrawItemText(TInt aItemIndex,
       
   139                                const TRect& aItemTextRect,
       
   140                                TBool aItemIsCurrent,
       
   141                                TBool aViewIsEmphasized, 
       
   142                                TBool aItemIsSelected) const;
       
   143     // the next one is for avkon
       
   144 
       
   145     /**
       
   146      * Not used in S60.
       
   147      */
       
   148     void DrawItemMark(TBool aItemIsSelected, 
       
   149                                TBool aViewIsDimmed, 
       
   150                                const TPoint& aMarkPos) const;
       
   151 
       
   152 public: // from CListItemDrawer
       
   153 
       
   154     /**
       
   155      * From @c CListItemDrawer.
       
   156      *
       
   157      * Gets the minimum cell size.
       
   158      *
       
   159      * @return The minimum size for a cell. This is 
       
   160      *         TSize(0, 0) in @c CListItemDrawer.
       
   161      */
       
   162     TSize MinimumCellSize() const;
       
   163     
       
   164     /**
       
   165      * From @c CListItemDrawer.
       
   166      *
       
   167      * Gets the width of the specified item.
       
   168      *
       
   169      * @param aItemIndex The index of the item whose width is to be returned. 
       
   170      * @return The width of the item. This is 0 in @c CListItemDrawer
       
   171      */
       
   172     TInt ItemWidthInPixels(TInt aItemIndex) const; 
       
   173     
       
   174     /**
       
   175      * From @c CListItemDrawer.
       
   176      *
       
   177      * Sets the item cell size. 
       
   178      *
       
   179      * The cell size is the on-screen size of the entire item, including its 
       
   180      * text and its item mark.
       
   181      *
       
   182      * @param aSizeInPixels New size for the item cell.
       
   183      */
       
   184     void SetItemCellSize(const TSize& aSizeInPixels);
       
   185     
       
   186     /**
       
   187      * Get Item Cell Size.
       
   188      *
       
   189      * @return Cell size of an item.
       
   190      */
       
   191     TSize LafItemSize() { return iItemCellSize; }
       
   192 
       
   193 private: // from CListItemDrawer
       
   194 
       
   195     TAny* Reserved_1();
       
   196 
       
   197 private: // defining reserved method.
       
   198 
       
   199     void CPbk2ContactViewCustomListBoxItemDrawer_Reserved();
       
   200 
       
   201 protected:
       
   202 
       
   203     /**
       
   204      * Draw the item background.
       
   205      *
       
   206      * Internal member, not intended for use.
       
   207      *
       
   208      * @param aRect Drawing area. 
       
   209      */
       
   210     void DrawCurrentItemRect(const TRect& aRect) const;
       
   211     
       
   212     /** 
       
   213      * Array of properties.
       
   214      */
       
   215     CArrayFix<SListProperties>* iPropertyArray;
       
   216     
       
   217     /** 
       
   218      * Not used. 
       
   219      */ 
       
   220     TInt iSpare;
       
   221     
       
   222     };
       
   223 
       
   224 
       
   225 
       
   226 
       
   227 #endif // __CPbk2ContactViewCustomListBoxItemDrawer_H__
       
   228 
       
   229 // End of File