phoneuis/easydialing/inc/easydialinglistboxdata.h
branchRCL_3
changeset 62 5266b1f337bd
child 81 c26cc2a7c548
equal deleted inserted replaced
61:41a7f70b3818 62:5266b1f337bd
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Easy dialing listbox data.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef _EASYDIALINGLISTBOXDATA_H
       
    20 #define _EASYDIALINGLISTBOXDATA_H
       
    21 
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <aknlists.h>
       
    25 
       
    26 // CONSTANTS
       
    27 
       
    28 /*
       
    29  * Matching highlight separator character is used in listbox model to separate
       
    30  * matching and non-matching charaters. 0x1F is chosen for this because
       
    31  * it is a control character "INFORMATION SEPARATOR ONE" of ASCII set. 
       
    32  * User of the listbox must use this character in creating list box item 
       
    33  * strings.
       
    34  */
       
    35 // FORWARD DECLARATIONS
       
    36 class CEasyDialingListBox;
       
    37 class CEasyDialingContactDataManager;
       
    38 
       
    39 // CLASS DECLARATIONS
       
    40 
       
    41 /*
       
    42  * Easy dialing listbox data class.
       
    43  */
       
    44 
       
    45 class CEasyDialingListBoxData : public CFormattedCellListBoxData
       
    46     {
       
    47 public:
       
    48     
       
    49     class TExtendedColors : public CFormattedCellListBoxData::TColors 
       
    50         {
       
    51         public:
       
    52             
       
    53             TExtendedColors();
       
    54     
       
    55             /** The matching text colour. */
       
    56             TRgb iMatchingText;
       
    57     
       
    58             /** The matching background colour. */
       
    59             TRgb iMatchingBack;
       
    60     
       
    61         };
       
    62     
       
    63     
       
    64     /**
       
    65      * Destructor
       
    66      */
       
    67     ~CEasyDialingListBoxData();
       
    68        
       
    69     /**
       
    70     * Two phased constructor of the class.
       
    71     * @return   Pointer to the instance. 
       
    72     */
       
    73     static CEasyDialingListBoxData* NewL( CCoeEnv& aCoeEnv );
       
    74      
       
    75     /**
       
    76     * Draws selected item.
       
    77     */
       
    78     void DrawData(
       
    79         const TListItemProperties& aItemProperties, 
       
    80         CWindowGc& aGc,
       
    81         const TDesC* aText,
       
    82         const TRect& aRect,
       
    83         TBool aHighlight,
       
    84         const TExtendedColors& aColors ) const;
       
    85      
       
    86     /**
       
    87     * Draws selected item highlight.
       
    88     * @param    aGc         Graphics context.
       
    89     * @param    aItemRect   Item rectangle.
       
    90     */
       
    91     void DrawHighlight( CWindowGc &aGc, const TRect &aItemRect ) const;
       
    92     
       
    93     /**
       
    94     * Sets the contact data manager. Must be set before using the listbox.
       
    95     * @param    aContactDataManager Contact data manager.
       
    96     */
       
    97     void SetContactDataManager( CEasyDialingContactDataManager* aContactDataManager );
       
    98     
       
    99     /**
       
   100     * Sets a pointer to listbox class. Called from listbox constructor.
       
   101     * @param    aControl    Pointer to easy dialing listbox cotrol.
       
   102     */
       
   103     void SetEDLBXControl( CEasyDialingListBox* aControl );
       
   104     
       
   105     /**
       
   106      * Handle change in list item size
       
   107      */
       
   108     void HandleItemSizeChange();
       
   109     
       
   110 protected:
       
   111         
       
   112     /**
       
   113     * C++ Constructor
       
   114     */
       
   115     CEasyDialingListBoxData( CCoeEnv& aCoeEnv );
       
   116     
       
   117     /**
       
   118      * Second phase constructor 
       
   119      */
       
   120     void ConstructLD();
       
   121    
       
   122 private:
       
   123     
       
   124     /**
       
   125     * Determines fonts for contact name and company name.
       
   126     * The font sizes are determined based on list box item height.
       
   127     * This function must be called once before any drawing routines are 
       
   128     * done.
       
   129     * @param    aItemHeight List box item height
       
   130     */
       
   131     void ObtainFonts( TInt aItemHeight );
       
   132     
       
   133     /**
       
   134      * Update the color bitmap used for fallback graphics for the Action Menu arrow according to 
       
   135      * size changes in listbox control.
       
   136      * @param   aSize   New size.
       
   137      */
       
   138     void UpdateColorBitmapL( const TSize& aSize );
       
   139     
       
   140     /**
       
   141     * Draws the data for one list item.
       
   142     * @param    aProperties List item property structure.
       
   143     * @param    aGc Graphics context.
       
   144     * @param    aText   String containing  list item data information.
       
   145     * @param    aItemRect   Item rectangle.
       
   146     * @param    aHighlight  ETrue if the item has highlight, EFalse otherwise.
       
   147     * @param    aColors Structure containing used colors.
       
   148     */
       
   149     void DrawDataFormatted( 
       
   150         TListItemProperties aProperties,
       
   151         CWindowGc& aGc,
       
   152         const TDesC* aText,
       
   153         const TRect& aItemRect,
       
   154         TBool aHighlight,
       
   155         const TExtendedColors& aColors ) const;
       
   156     
       
   157     /**
       
   158      * Draws the Contact Thumbnail Icon if any, else draws the dummy contact thumbnail.
       
   159      * @param   aGc Graphics context.
       
   160      * @param   aBoundingBox    Rectangle containing bounds for contact thumbnail.
       
   161      * @param   aContactIndex   Contact index for the contact data manager
       
   162      */
       
   163     void DrawContactThumbnail(
       
   164             CWindowGc& aGc,
       
   165             TRect aBoundingBox,
       
   166             TInt aContactIndex ) const;
       
   167     
       
   168     /**
       
   169      * Draws the Action Menu.
       
   170      * @param   aGc Graphics context.
       
   171      * @param   aActionMenuArrowRect    Rectangle where arrow is to be drawn.
       
   172      */ 
       
   173     void DrawArrowIcon( CWindowGc& aGc, TRect aActionMenuArrowRect ) const;
       
   174     
       
   175     /**
       
   176      * Draws the Favourite Icon. Takes the name rect as a parameter. Name rect
       
   177      * must be unmirrored, because the mirroring is done as the last thing
       
   178      * before drawing.
       
   179      * @param   aGc Graphics context.
       
   180      * @param   aNameRectUnMirrored Name rect, after which the icon is drawn
       
   181      * @param   aEffectiveRect The whole listbox item rect. Used for mirroring.
       
   182      */
       
   183     void DrawFavouriteIcon(
       
   184             CWindowGc& aGc, 
       
   185             TRect aNameRectUnMirrored,
       
   186             TRect aEffectiveRect) const;
       
   187     
       
   188     /**
       
   189      * Draws the SIM or Service Number icon. Takes the name rect as a parameter. Name rect
       
   190      * must be unmirrored, because the mirroring is done as the last thing
       
   191      * before drawing.
       
   192      * @param   aIcon The icon to be drawn
       
   193      * @param   aGc Graphics context.
       
   194      * @param   aNameRectUnMirrored Name rect, after which the icon is drawn
       
   195      * @param   aEffectiveRect The whole listbox item rect. Used for mirroring.
       
   196      */
       
   197     void DrawSimIcon(
       
   198             CGulIcon& aIcon,
       
   199             CWindowGc& aGc, 
       
   200             TRect aNameRectUnMirrored,
       
   201             TRect aEffectiveRect) const;
       
   202     
       
   203 private:
       
   204     
       
   205     /** Control environment */
       
   206     CCoeEnv& iCoeEnv;
       
   207     
       
   208     /** Font to be used showing contact name. Not owned. */
       
   209     CFont* iContactNameFont;
       
   210     
       
   211     /** Font to be used showing company name. Not owned. */ 
       
   212     CFont* iCompanyNameFont;
       
   213     
       
   214     /** Handle for loading and storing the thumbnails. Not owned.*/ 
       
   215     CEasyDialingContactDataManager* iContactDataManager;
       
   216         
       
   217     /** Action Menu LeftPointing Arrow for mirrored layout. Owned. */
       
   218     CGulIcon* iArrowPointingRight;
       
   219     
       
   220     /** Action Menu RightPointing Arrow. Owned. */
       
   221     CGulIcon* iArrowPointingLeft;
       
   222     
       
   223     /** Action icon color bitmap. Owned. */
       
   224     CFbsBitmap* iColorBitmap;
       
   225     
       
   226     /** Default image for contacts with no own thumbnail. Owned. */
       
   227     CGulIcon* iDummyThumbnail;
       
   228     
       
   229     /** Favourite icon. Owned. */
       
   230     CGulIcon* iFavouriteIcon;
       
   231     
       
   232     /** SIM contact icon. Owned. */
       
   233     CGulIcon* iSimContactIcon;
       
   234     
       
   235     /** Service contact icon. Owned. */
       
   236     CGulIcon* iSdnContactIcon;
       
   237     
       
   238     /** Pointer to listbox. Not owned. */
       
   239     CEasyDialingListBox* iControl;
       
   240     };
       
   241 
       
   242 
       
   243 #endif // _EASYDIALINGLISTBOXDATA_H
       
   244