phonebookui/Phonebook2/UIControls/inc/cpbk2contactviewcustomlistboxdata.h
branchRCL_3
changeset 63 f4a778e096c2
child 64 c1e8ba0c2b16
child 85 38bb213f60ba
equal deleted inserted replaced
62:5b6f26637ad3 63:f4a778e096c2
       
     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 CColumnListBoxData
       
    16 *       in EIKCLBD.CPP. 
       
    17 *       Ensure that this piece of code is in sync with Avkon EIKCLBD.CPP(CColumnListBoxData)
       
    18 *
       
    19 */
       
    20 
       
    21 #if !defined(__CPbk2ContactViewCustomListBoxData_H__)
       
    22 #define __CPbk2ContactViewCustomListBoxData_H__
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <gdi.h>
       
    26 #include <eikclbd.h>
       
    27 #include <eiklbd.h>
       
    28 #include <avkon.hrh>
       
    29 #include <babitflags.h>    // for TBitFlags32
       
    30 
       
    31 class CWindowGc;
       
    32 class CGulIcon;
       
    33 class CPbk2ContactViewCustomListBoxDataExtension;
       
    34 class MAknsControlContext;
       
    35 class CCoeControl;
       
    36 class TAknsItemID;
       
    37 class CAknsEffectAnim;
       
    38 class CAknsListBoxBackgroundControlContext;
       
    39 class CAknLayoutData;
       
    40 class TAknWindowLineLayout;
       
    41 class TAknTextLineLayout;
       
    42 class TAknWindowComponentLayout;
       
    43 class TAknTextComponentLayout;
       
    44 class MAknsSkinInstance;
       
    45 class CPbk2ContactViewListBoxModel;
       
    46 class CPSRequestHandler;
       
    47 class CPbk2PredictiveSearchFilter;
       
    48 class MPbk2UiControlCmdItem;
       
    49 
       
    50 /**
       
    51  * The @c CPbk2ContactViewCustomListBoxData class handles the data required to draw a column 
       
    52  * list box.
       
    53  *
       
    54  * The class performs drawing for @c CColumnListBoxItemDrawer. Columns are 
       
    55  * numbered from 0 from left to right, and extra column data can be set 
       
    56  * for each.
       
    57  *
       
    58  * N.B.: The standard width of a column drawn by @c CColumnListListBoxData is  
       
    59  * 0 pixels, so at the very least a column width should be set for each column 
       
    60  * in a column list box.    
       
    61  *
       
    62  * This class is not intended for user derivation. 
       
    63  */
       
    64 class CPbk2ContactViewCustomListBoxData : public CListBoxData
       
    65     {
       
    66     friend class CPbk2ContactViewCustomListBoxDataExtension;
       
    67 public:
       
    68 
       
    69     /**
       
    70      * Represents the colours used within the border and for the optional 
       
    71      * single pixel border outlines.
       
    72      *
       
    73      * These colours are stored using @c TRgb values.
       
    74      */
       
    75     class TColors
       
    76         {
       
    77     public:
       
    78 
       
    79         /**
       
    80          * C++ default constructor.
       
    81          */
       
    82         TColors();
       
    83     public:
       
    84 
       
    85         /**
       
    86          * Stores text Color.
       
    87          */
       
    88         TRgb iText;
       
    89 
       
    90         /**
       
    91          * Stores background color.
       
    92          */
       
    93         TRgb iBack;
       
    94 
       
    95         /**
       
    96          * Stores highLighted text color.
       
    97          */ 
       
    98         TRgb iHighlightedText;
       
    99 
       
   100         /**
       
   101          * Stores highlighted background colour.
       
   102          */
       
   103         TRgb iHighlightedBack;
       
   104         };
       
   105 
       
   106 public: 
       
   107     
       
   108     /**
       
   109      * Set internal data model to work with special PCS data
       
   110      * @param aDataModel PCS data model 
       
   111      */        
       
   112     void SetDataModel(CPbk2ContactViewListBoxModel* aDataModel);
       
   113     
       
   114     /**
       
   115      * Draws the text in a single row with the predictive searched characters
       
   116      * underlined
       
   117      *
       
   118      *
       
   119      * @param aItemProperties The properties of each column in the row.
       
   120      * @param aGc The graphics context to draw into.
       
   121      * @param aRect Bounding rectangle for the entire row.
       
   122      * @param aTextToDraw Parsed Text which needs to be drawn.
       
   123      * @param aText Original Text.
       
   124      * @param aTextLayout Low level drawing based on European LAF document.
       
   125      * @param aTextLineLayout A text line structure from layout.
       
   126      * @param aUseLogicalToVisualConversion
       
   127      * @param aUsedFont Font to be used in Drawing the Text
       
   128      * @param aTextColor Color of the text     
       
   129      */
       
   130     
       
   131     void DrawEnhancedTextL(
       
   132             const TListItemProperties& aItemProperties,
       
   133             CWindowGc& aGc,
       
   134             const TRect& aRect,
       
   135             const TDesC& aTextToDraw,
       
   136             const TPtrC& aText,
       
   137             TAknLayoutText &aTextLayout,
       
   138             TAknTextLineLayout &aTextLineLayout, 
       
   139             TBool aUseLogicalToVisualConversion,
       
   140             const CFont* aUsedFont,        
       
   141             TRgb aTextColor
       
   142             ) const;
       
   143     
       
   144     /**
       
   145      * Sets the commands that should appear at the top of the list.
       
   146      * @param aCommands An array of commands. NULL may be given to
       
   147      *        indicate that no commands are to be shown. 
       
   148      */
       
   149     void SetListCommands( const RPointerArray<MPbk2UiControlCmdItem>* aCommands );
       
   150     
       
   151     TBool IsContactAtListboxIndex( TInt aListboxIndex ) const;
       
   152 	
       
   153 private:    
       
   154     TInt CommandItemCount() const;
       
   155     
       
   156 public:
       
   157 
       
   158     /**
       
   159      * Two-phased constructor.
       
   160      *
       
   161      * Allocates and constructs a column list box data object.
       
   162      *
       
   163      * Constructs an array in which the column data is held.
       
   164      *
       
   165      * @param aSearchFilter PBk2 Search Filter
       
   166      * @return New @c CPbk2ContactViewCustomListBoxData.
       
   167      */
       
   168     static CPbk2ContactViewCustomListBoxData* NewL( CPbk2PredictiveSearchFilter &aSearchFilter );
       
   169     
       
   170     /**
       
   171      * Destructor.
       
   172      */
       
   173     ~CPbk2ContactViewCustomListBoxData();
       
   174 
       
   175 public:
       
   176 
       
   177     /**
       
   178      * Gets the index of the last defined column.
       
   179      *
       
   180      * @return The index of the last defined column or @c KErrNotFound if no 
       
   181      *         column has been defined.
       
   182      */
       
   183     TInt LastColumn() const;
       
   184     
       
   185     /**
       
   186      * Gets the specified column’s width in pixels.
       
   187      *
       
   188      * @param aColumn The index of the column for which the width is obtained.
       
   189      * @return The specified column’s width in pixels. Zero is returned if no 
       
   190      *         column exists at the specified index.
       
   191      */
       
   192     TInt ColumnWidthPixel(TInt aColumn) const;
       
   193 
       
   194     /**
       
   195      * Sets the specified column’s width in pixels.
       
   196      * 
       
   197      * If the column does not exist, one is added at the specified index, 
       
   198      * with the specifed width.
       
   199      *
       
   200      * @param aColumn The index of the column for which the width is to be set.
       
   201      * @param aWidth The width in pixels.
       
   202      */
       
   203     void SetColumnWidthPixelL(TInt aColumn,TInt aWidth);
       
   204     
       
   205     /**
       
   206     * Not used in S60.
       
   207     */
       
   208     TInt ColumnHorizontalGap(TInt aColumn) const;
       
   209 
       
   210     /**
       
   211     * Not used in S60.
       
   212     */
       
   213     void SetColumnHorizontalGapL(TInt aColumn,TInt aGap);
       
   214 
       
   215     /**
       
   216      * Gets column's baseline.
       
   217      *
       
   218      * @param aColumn target column.
       
   219      * @return Vertical position.
       
   220      */
       
   221     TInt ColumnBaselinePos(TInt aColumn) const;
       
   222 
       
   223     /**
       
   224      * Sets columns baseline position.
       
   225      *
       
   226      * @param aColumn Target column.
       
   227      * @param aPos Wanted position.
       
   228      */
       
   229     void SetColumnBaselinePosL(TInt aColumn,TInt aPos);
       
   230 
       
   231     /**
       
   232      * Gets column's margins.
       
   233      *
       
   234      * @param aColumn Target column.
       
   235      * @return The columns margins.
       
   236      */
       
   237     TMargins ColumnMargins(TInt aColumn) const;
       
   238     
       
   239     /**
       
   240      * Sets column's margins.
       
   241      *
       
   242      * @param aColumn Target column.
       
   243      * @param aMargins Wanted margins.
       
   244      */
       
   245     void SetColumnMarginsL(TInt aColumn,TMargins aMargins);
       
   246     
       
   247     /**
       
   248      * Gets font used by the column.
       
   249      *
       
   250      * @param aColumn Target column.
       
   251      * @return Used font.
       
   252      */
       
   253     const CFont* ColumnFont(TInt aColumn) const;
       
   254 
       
   255     /**
       
   256      * Sets column's font.
       
   257      *
       
   258      * @param aColumn Target column.
       
   259      * @param aFont Wanted font.
       
   260      */
       
   261     void SetColumnFontL(TInt aColumn,const CFont* aFont);
       
   262 
       
   263     /**
       
   264      * Gets the text alignment for the specified column.
       
   265      *
       
   266      * @param  aColumn The index of the column for which the alignment 
       
   267      *         is obtained.
       
   268      * @return The text alignment for the specified column. The default 
       
   269      *         is @c ELeft.
       
   270      */
       
   271     CGraphicsContext::TTextAlign ColumnAlignment(TInt aColumn) const;
       
   272     
       
   273     /**
       
   274      * Sets the text alignment for the specified column.
       
   275      *
       
   276      * If the column does not exist, it is added with the specified index 
       
   277      * to the array.
       
   278      *
       
   279      * @param aColumn The index of the column for which alignment is set.
       
   280      * @param aAlign The text alignment to use. The default is @c ELeft.
       
   281      */
       
   282     void SetColumnAlignmentL(TInt aColumn,
       
   283                                       CGraphicsContext::TTextAlign aAlign);
       
   284 
       
   285     /**
       
   286     * Not used in S60.
       
   287     */
       
   288     CGraphicsContext::TPenStyle ColumnSeparatorStyle(
       
   289                                                         TInt aColumn) const;
       
   290     /**
       
   291     * Not used in S60.
       
   292     */
       
   293     void SetColumnSeparatorStyleL(TInt aColumn, 
       
   294                                            CGraphicsContext::TPenStyle aStyle);
       
   295 
       
   296     /**
       
   297      * Checks whether the column is optional.
       
   298      *
       
   299      * @param aColumn Target column.
       
   300      * @return @c ETrue if the column is optional.
       
   301      */
       
   302     TBool ColumnIsOptional(TInt aColumn) const;
       
   303     
       
   304     /**
       
   305      * Sets whether the column is optional.
       
   306      *
       
   307      * @param aColumn Target column.
       
   308      * @param aIsOptional Wanted setting, @c ETrue if column is optional.
       
   309      */
       
   310     void SetOptionalColumnL(TInt aColumn,TBool aIsOptional);
       
   311 
       
   312     /**
       
   313      * Checks whether the column contains graphics.
       
   314      *
       
   315      * @param aColumn Target column.
       
   316      * @return @c ETrue if column contains graphics.
       
   317      */
       
   318     TBool ColumnIsGraphics(TInt aColumn) const;
       
   319 
       
   320     /**
       
   321      * Sets whether the column shows graphics.
       
   322      *
       
   323      * @param aColumn Target column.
       
   324      * @param aIsGraphics Wanted setting.
       
   325      */
       
   326     void SetGraphicsColumnL(TInt aColumn,TBool aIsGraphics);
       
   327 
       
   328     /**
       
   329      * Checks if the column is a number.
       
   330      *
       
   331      * @param aColumn Target column.
       
   332      * @return @c ETrue if it is a number.
       
   333      */
       
   334     TBool ColumnIsNumber(TInt aColumn) const;
       
   335 
       
   336     /**
       
   337      * Sets whether the column is a number. 
       
   338      *
       
   339      * @param aColumn Target columun.
       
   340      * @param aIsNumber Wanted setting. @c ETrue if it is a number.
       
   341      */
       
   342     void SetNumberColumnL(TInt aColumn,TBool aIsNumber);
       
   343 
       
   344     /**
       
   345      * Gets the icon array. 
       
   346      *
       
   347      * These icons contain the bitmaps that are displayed in graphical columns.
       
   348      *
       
   349      * @return Pointer to the icon array.
       
   350      */
       
   351     CArrayPtr<CGulIcon>* IconArray() const;
       
   352 
       
   353     /**
       
   354      * Sets icon array.
       
   355      *
       
   356      * @param aArray Wanted icon collection .
       
   357      */
       
   358     void SetIconArray(CArrayPtr<CGulIcon>* aArray);
       
   359 
       
   360     /**
       
   361      * Gets TextClipGap, the gap between words in a text clip, for the 
       
   362      * given column.
       
   363      *
       
   364      * @param aSubCellIndex Index to target column.
       
   365      * @return TextClipGap.
       
   366      */
       
   367     TInt ColumnTextClipGap(TInt aSubCellIndex) const;
       
   368     
       
   369     /**
       
   370      * Sets columns TextClipGap, the gap between words in a text clip.
       
   371      *
       
   372      * @param aSubCellIndex Index of the target column.
       
   373      * @param aSize Wanted TextClipGap size. 
       
   374      */
       
   375     void SetColumnTextClipGapL(TInt aSubCellIndex, TInt aSize);
       
   376     
       
   377     /**
       
   378      * Gets the specified font for the specified column.
       
   379      *
       
   380      * @param aItemProperties Whether the required font is:
       
   381      *        bold, italic, bold and italic or normal.
       
   382      * @param aColumn The index of the column for which the font is obtained.
       
   383      * @return The specified column’s, specified font. Null, the 
       
   384      *         default, if no font is set for the column.
       
   385      */
       
   386     CFont* Font(const TListItemProperties& aItemProperties, 
       
   387                          TInt aColumn) const;
       
   388 
       
   389     /**
       
   390      * Gets the specified column’s surrounding rectangle.
       
   391      *
       
   392      * @param aColumn The index of the column for which the rectangle 
       
   393      *                is obtained.
       
   394      * @param aRect On return contains the specified column’s rectangle.
       
   395      * @return @c ETrue if successful. @c EFalse if a non-existent column 
       
   396      *               was specified.
       
   397      */
       
   398     TBool MakeColumnRect( TInt aColumn, TRect& aRect );
       
   399 
       
   400     /**
       
   401      * Draws a single row.
       
   402      *
       
   403      * The text @c aText is parsed into columns and is split using 
       
   404      * @c KColumnListSeparator. Text or bitmaps are drawn according to whether 
       
   405      * the column has been set as a graphical column 
       
   406      * (see @c SetGraphicsColumnL()). Column cells within the row are drawn 
       
   407      * from left to right.
       
   408      *
       
   409      * @param aItemProperties The properties of each column in the row.
       
   410      * @param aGc The graphics context to draw into.
       
   411      * @param aText The text to parse and draw.
       
   412      * @param aRect Bounding rectangle for the entire row.
       
   413      * @param aHighlight @c ETrue to draw the item highlighted. 
       
   414      *        @c EFalse otherwise.
       
   415      * @param aColors The colours to use if the item is highlighted.
       
   416      * @param aItemIndex Index of the item to draw.
       
   417      */
       
   418     virtual void Draw(const TListItemProperties& aItemProperties, 
       
   419                                CWindowGc& aGc,
       
   420                                const TDesC* aText,
       
   421                                const TRect& aRect,
       
   422                                TBool aHighlight,
       
   423                                const TColors& aColors,
       
   424                                TInt aItemIndex) const;
       
   425                                
       
   426     /**
       
   427     * internal
       
   428     */
       
   429     void DrawSimpleL(const TListItemProperties& aItemProperties, CWindowGc& aGc,const TDesC* aText,const TRect& aRect,
       
   430                     TBool aHighlight,const TColors& aColors,TInt aItemIndex) const;
       
   431     /**
       
   432      * Sets position of listbox line.
       
   433      *
       
   434      * @param aPosition Wanted position.
       
   435      */
       
   436     void SetSeparatorLinePosition(
       
   437                                         TAknSeparatorLinePosition aPosition);
       
   438 
       
   439     /**
       
   440      * Gives out separator line position.
       
   441      *
       
   442      * @return Separator position.
       
   443      */
       
   444     TAknSeparatorLinePosition SeparatorLinePosition() const;
       
   445 
       
   446     /**
       
   447      * 
       
   448      * @deprecated
       
   449      *
       
   450      * Gives out layout data for separator line drawing.
       
   451      *
       
   452      * @return Requested layout data.
       
   453      */
       
   454     CAknLayoutData *LayoutData() const;
       
   455     
       
   456     /**
       
   457      * 
       
   458      * @deprecated
       
   459      *
       
   460      * Checks if the layout has been initialized.
       
   461      *
       
   462      * @return @c ETrue if initialized.
       
   463      */
       
   464     TBool LayoutInit() const;
       
   465     
       
   466     /**
       
   467      * 
       
   468      * @deprecated
       
   469      *
       
   470      * Sets the initialization .
       
   471      *
       
   472      * @param aValue Wanted value (@c ETrue = initialized).
       
   473      */
       
   474     void SetLayoutInit(TBool aValue) const;
       
   475 
       
   476     /**
       
   477      * Enables / disables underlining per text column,
       
   478      * if and only if @c TListItemProperties also has underlining enabled.
       
   479      * If this method is not called and @c TListItemProperties has underlining
       
   480      * enabled, drawing will revert to old style where only first text column
       
   481      * will be underlined.
       
   482      *
       
   483      * @since S60 3.0
       
   484      * @param aUnderlinedColumns Bitmask of columns to be underlined.
       
   485      */    
       
   486     void SetColumnUnderlined( TBitFlags32 aUnderlinedColumns );
       
   487 
       
   488 private:
       
   489     struct SColumn
       
   490         {
       
   491         TInt iColumn; // Must be first entry
       
   492         TInt iWidth;
       
   493         TMargins iMargins;
       
   494         TInt iVerticalCap;
       
   495         const CFont* iBaseFont;
       
   496         TInt iActualFontIndex;
       
   497         TBool iGraphics;
       
   498     TBool iOptional;
       
   499     TInt iBaseline;
       
   500         CGraphicsContext::TTextAlign iAlign;
       
   501     CGraphicsContext::TPenStyle iSeparator;
       
   502     TInt iTextClipGap;
       
   503     TBool iNumberColumn;
       
   504     // the next are for storing x-coordinates of a column for the drawing algorithm.
       
   505     __MUTABLE TInt iX;
       
   506     __MUTABLE TInt iEndX;
       
   507         };
       
   508 protected:
       
   509 
       
   510     /**
       
   511      * C++ default constructor.
       
   512      */
       
   513     CPbk2ContactViewCustomListBoxData( CPbk2PredictiveSearchFilter &aSearchFilter );
       
   514 
       
   515     /**
       
   516      * A second phase constructor. 
       
   517      *
       
   518      * Highlight animation will be created by default (if it is provided 
       
   519      * by the skin).
       
   520      */
       
   521     void ConstructLD();
       
   522 
       
   523     /**
       
   524      * Second phase constructor for subclasses that want to override highlight
       
   525      * animation creation.
       
   526      *
       
   527      * @since 3.0
       
   528      * @param aAnimationIID Skin item identifier of the constructed animation. 
       
   529      *        Passing @c KAknsIIDNone will disable highlight animation.
       
   530      */
       
   531     void ConstructLD( const TAknsItemID& aAnimationIID );
       
   532 
       
   533 private:
       
   534     
       
   535     TInt ColumnX(TInt aColumn) const;
       
   536     void SetColumnXL(TInt aColumn,TInt aX) const; // note, const! (do not affect external state)
       
   537     //
       
   538     TInt ColumnEndX(TInt aColumn) const;
       
   539     void SetColumnEndXL(TInt aColumn,TInt aEndX) const; // note, Const!
       
   540 
       
   541     void AddColumnL(TInt aColumn);
       
   542     SColumn& At(TInt aArrayIndex);
       
   543     const SColumn& At(TInt aArrayIndex) const;
       
   544     TBool FindColumnIndex(TInt& aArrayIndex,TInt aColumn) const;
       
   545     void FindColumnIndexOrAddL(TInt& aArrayIndex,TInt aColumn);
       
   546     TInt AddActualFontL(const CFont* aBaseFont);
       
   547     void SetUnderlineStyle( TListItemProperties aProperties, CWindowGc& aGc, TInt aColumn ) const;
       
   548     void DoConstructL( const TAknsItemID& aAnimationIID );
       
   549 public:
       
   550 
       
   551     /**
       
   552      * Gets @c CCoeControl for component.
       
   553      *
       
   554      * @return Pointer to the used @c CCoeControl.
       
   555      */
       
   556     CCoeControl *Control() const;
       
   557     
       
   558     /**
       
   559      * Sets @c CCoeControl for current component.
       
   560      *
       
   561      * @param aControl Current listbox control instance, cannot be any 
       
   562      *        other control.
       
   563      */
       
   564     void SetControl(CCoeControl *aControl);
       
   565     
       
   566     /**
       
   567      * Gets background skin context.
       
   568      *
       
   569      * @return Component's skin control context.
       
   570      */
       
   571     MAknsControlContext* SkinBackgroundContext() const;
       
   572     
       
   573     /**
       
   574      * Sets background skin context. Changes ownership as well.
       
   575      *
       
   576      * @param aContext Wanted background skin control context.
       
   577      */
       
   578     void SetSkinBackgroundContext(
       
   579                     CAknsListBoxBackgroundControlContext *aContext); 
       
   580                     // takes ownership
       
   581     
       
   582     /**
       
   583      * Sets style for the skin fot list tiles.
       
   584      *
       
   585      * @param aId Wanted skins item ID.
       
   586      * @param aTileRect Skin tile size. 
       
   587      */
       
   588     void SetSkinStyle(const TAknsItemID *aId, 
       
   589                                const TRect &aTileRect);
       
   590 
       
   591     /**
       
   592      * Sets skin style for the end of the list. 
       
   593      *
       
   594      * @param aId Wanted skins item ID. 
       
   595      * @param aRect Skin tile size. 
       
   596      */
       
   597     void SetListEndSkinStyle(const TAknsItemID *aId, 
       
   598                                       const TRect &aRect);
       
   599 
       
   600     /**
       
   601      * Sets skin for the highlighted frame.
       
   602      *
       
   603      * @param aFrameId Wanted skin's item ID for the frame.
       
   604      * @param aFrameCenterId Wanted skin's item ID for the center of the frame.
       
   605      */
       
   606     void SetSkinHighlightFrame(const TAknsItemID *aFrameId, 
       
   607                                         const TAknsItemID *aFrameCenterId);
       
   608 
       
   609     /**
       
   610      * Enables/Disables skin.
       
   611      *
       
   612      * @param aEnabled Sets whether the skins are enable or disabled
       
   613      *                 @c ETrue for enabling skins.
       
   614      */
       
   615     void SetSkinEnabledL(TBool aEnabled);
       
   616     
       
   617     /**
       
   618      * Creates a pictograph interface for the @c CPbk2ContactViewCustomListBoxData.
       
   619      */
       
   620     void CreatePictographInterfaceL();
       
   621 
       
   622     /**
       
   623      * Creates a marquee control for the @c CPbk2ContactViewCustomListBoxData and redraw.
       
   624      */
       
   625     void CreateMarqueeControlL();
       
   626     
       
   627     /**
       
   628      * Resets marquee control. 
       
   629      */
       
   630     void ResetMarquee();
       
   631     
       
   632     /**
       
   633      * Gets current marquee item index.
       
   634      *
       
   635      * @return Current marquee item index.
       
   636      */
       
   637     TInt CurrentMarqueeItemIndex();
       
   638     
       
   639     /**
       
   640      * Sets the index for current marquee item.
       
   641      *
       
   642      * @param aIndex Item index.
       
   643      */
       
   644     void SetCurrentMarqueeItemIndex(TInt aIndex);
       
   645     
       
   646     /**
       
   647      * Enables or disables the marquee. 
       
   648      *
       
   649      * @param aEnable @c ETrue = On. @c EFalse = Off.
       
   650      */
       
   651     void EnableMarqueeL(TBool aEnable); 
       
   652 
       
   653     /**
       
   654      * Sets the font attached to the cell for each row separately.
       
   655      *
       
   656      * @param aRow Index number of the row.
       
   657      * @param aColumn Index number of the column.
       
   658      * @param aFont Font to be used.
       
   659      */
       
   660     void SetColumnFontForRowL(TInt aRow, 
       
   661                                        TInt aColumn, 
       
   662                                        const CFont* aFont);
       
   663 
       
   664     /**
       
   665      * Gets the font attached to the row and cell.
       
   666      *
       
   667      * @param aRow Index number of the row.
       
   668      * @param aColumn Index number of the column.
       
   669      * @return Font handle.
       
   670      */
       
   671     const CFont* RowAndColumnFont(TInt aRow,TInt aColumn) const;
       
   672 
       
   673     /**
       
   674      * Sets the current list item index. Since S60 2.6 causes highlight 
       
   675      * animation tochange its background (only if the current item index 
       
   676      * changes). Do not call this method if the index is not the current 
       
   677      * item index.
       
   678      *
       
   679      * @since S60 2.6
       
   680      * @param aIndex The new index for the current item.
       
   681      */
       
   682     void SetCurrentItemIndex(TInt aIndex);
       
   683 
       
   684     /**
       
   685      * Sets the subcell icon size.
       
   686      *
       
   687      * @since S60 2.8
       
   688      * @param aIndex Index of the sub cell. 
       
   689      * @param aSize Size of the sub cell icon.
       
   690      */
       
   691     void SetSubCellIconSize(TInt aIndex, TSize aSize);
       
   692 
       
   693     /**
       
   694      * Gets subcell icon size.
       
   695      *
       
   696      * @param aIndex Index of the wanted subcell.
       
   697      * @return Size of the subcell.
       
   698      */
       
   699     TSize GetSubCellIconSize(TInt aIndex);
       
   700 
       
   701     /**
       
   702      * Gets the highlight animation .
       
   703      *
       
   704      * @since S60 3.0
       
   705      * @return @c CAknsEffectAnim that is used for when the highlighted list 
       
   706      *         is drawn. May return NULL, in this case the normal skinned
       
   707      *         highlight should be drawn. This pointer is valid only during  
       
   708      *         the draw -> you should not store it locally outside draw scope.
       
   709      */
       
   710     const CAknsEffectAnim* HighlightAnim() const;
       
   711     
       
   712     /**
       
   713      * This method should be called before drawing animated highlight. It will
       
   714      * sync the animation with the background under the current highlight (only
       
   715      * when current item index has changed).
       
   716      *
       
   717      * @since S60 3.0
       
   718      */
       
   719     void AboutToDrawHighlightAnim() const;
       
   720     
       
   721     /**
       
   722      * Sets the observer for overriding default highlight input layer drawing
       
   723      * functionality. Note that you should still call 
       
   724      * @c AboutToDrawHighlightAnim (it will call the observer if it is set).
       
   725      *
       
   726      * @since S60 3.0
       
   727      * @param aDrawer New background drawer.
       
   728      */
       
   729     void SetHighlightAnimBackgroundDrawer( 
       
   730                                 MColumnListBoxAnimBackgroundDrawer* aDrawer );
       
   731 
       
   732     /**
       
   733      * Changes item cell size & resizes highlight animation. Called by list 
       
   734      * when item cell size changes. If you are using non-standard highlight 
       
   735      * sizes make sure to sync the list item cell size.
       
   736      *
       
   737      * @since S60 3.0
       
   738      * @param aSizeInPixels New size in pixels for the Item cell.
       
   739      */
       
   740     void SetItemCellSize( const TSize& aSizeInPixels );
       
   741     
       
   742     /**
       
   743     * @return ETrue if highlight animation exists, EFalse otherwise.
       
   744     *
       
   745     * @since 3.1
       
   746     */
       
   747     TBool HasHighlightAnim() const;
       
   748     /**
       
   749     * The preferred method for drawing highlight animation in derived classes.
       
   750     * Before calling this method you should check that highlight animation
       
   751     * exists by calling HasHighlightAnim. In case of draw failure you should
       
   752     * default to normal skinned highlight drawing. For example:
       
   753     *
       
   754     * TBool drawOk = EFalse;
       
   755     *
       
   756     * if( HasHighlightAnim() )
       
   757     *     {
       
   758     *     drawOk = DrawHighlightAnim( gc, rect );
       
   759     *     }
       
   760     *
       
   761     * if( !drawOk )
       
   762     *     {
       
   763     *     ...do normal skinned draw
       
   764     *     }
       
   765     *
       
   766     * @param aGc   Graphics context for blitting animation frame
       
   767     * @param aRect Target rect for blitting animation frame
       
   768     * @return The draw status, ETrue if drawing was ok, EFalse otherwise.
       
   769     *
       
   770     * @since 3.1
       
   771     */
       
   772     TBool DrawHighlightAnim( CBitmapContext& aGc, const TRect& aRect ) const;
       
   773 
       
   774     void FocusGained();
       
   775     
       
   776     /**
       
   777      * Called when the @c CPbk2ContactViewCustomListBoxData is unselected. Informs the 
       
   778      * @c CPbk2ContactViewCustomListBoxData extension that the focus has been lost.
       
   779      */
       
   780     void FocusLost();
       
   781     
       
   782     /**
       
   783      * Handles changing of an resource. Only supports skin change.
       
   784      *
       
   785      * @param aType Defines the resource that has changed. 
       
   786      */
       
   787     void HandleResourceChange( TInt aType );
       
   788     
       
   789     /**
       
   790      * Setup skin control context for handling background skins.
       
   791      * if no skin control context is found one is created.
       
   792      */
       
   793     void SetupSkinContextL();
       
   794     
       
   795     /**
       
   796      * Sets text colour. 
       
   797      *
       
   798      * @param aTextColor Wanted colour.
       
   799      */
       
   800     void SetESSTextColor(TRgb aTextColor);
       
   801     
       
   802     /**
       
   803      * Sets text colour for highlighted text.
       
   804      *
       
   805      * @param aHighlightedTextColor Wanted colour.
       
   806      */
       
   807     void SetESSHighlightedTextColor(TRgb aHighlightedTextColor);
       
   808 
       
   809     void SetGraphicSubCellL(TInt aSubCell,const TAknWindowLineLayout &aGraphicLayout);
       
   810     void SetTextSubCellL(TInt aSubCell,const TAknTextLineLayout &aTextLayout);
       
   811     void SetConditionalSubCellL(TInt aSubCell, const TAknTextLineLayout &aTextLayout,TInt aAffectedSubCell);
       
   812     void SubCellsMightIntersect( const TBool aMightIntersect );
       
   813 
       
   814     void SetStretchableGraphicSubCellL(TInt aSubCell, 
       
   815         const TAknWindowComponentLayout& aNormalLayout, 
       
   816         const TAknWindowComponentLayout& aStretchedLayout);
       
   817     void SetStretchableTextSubCellL(TInt aSubCell,                                      
       
   818         const TAknTextComponentLayout& aNormalLayout, 
       
   819         const TAknTextComponentLayout& aStretchedLayout);
       
   820     void SetStretchableConditionalSubCellL(TInt aSubCell,
       
   821         const TAknTextComponentLayout& aNormalLayout,
       
   822         const TAknTextComponentLayout& aStretchedLayout,
       
   823         TInt aNormalSubCell,
       
   824         TInt aStretchedSubCell );
       
   825     void ResetSLSubCellArray();                                           
       
   826     TBool UsesScalableLayoutData() const;
       
   827     void EnableStretching(const TBool aEnabled);
       
   828     TBool StretchingEnabled() const;
       
   829 protected:
       
   830     
       
   831     /**
       
   832      * Wraps the text drawing functinality with & without marquee into one 
       
   833      * function, so that inherited classes can modify their own drawing 
       
   834      * behaviour more easily.
       
   835      *
       
   836      * @since S60 2.8
       
   837      * @param aGc Window graphics context controller.
       
   838      * @param aTextRect The area where the text is drawn.
       
   839      * @param aText The whole text. Not clipped.
       
   840      * @param aClippedText Clipped / truncated text.
       
   841      * @param aBaselineOffset An offset from the top of the box to the text 
       
   842      *        baseline.
       
   843      * @param aAlign The text alignment mode (default is left, rather 
       
   844      *        than centre or right). 
       
   845      * @param aFont Wanted font.
       
   846      * @param aHighlight Does the current item have highlight.
       
   847      * @param aIsTextClipped Is the current item clipped.
       
   848      */
       
   849     void DrawText(CWindowGc& aGc, 
       
   850                            const TRect& aTextRect, 
       
   851                            const TDesC& aText, 
       
   852                            const TDesC& aClippedText, 
       
   853                            const TInt aBaselineOffset,
       
   854                            const CGraphicsContext::TTextAlign aAlign, 
       
   855                            const CFont& aFont,
       
   856                            const TBool aHighlight, 
       
   857                            const TBool aIsTextClipped) const;
       
   858 
       
   859 public:
       
   860     /**
       
   861      * Customizes marquee default behaviour. 
       
   862      *
       
   863      * Use this before enabling marquee ( @c EnableMarqueeL() ), otherwise 
       
   864      * marquee behaviour will change during animation.
       
   865      *
       
   866      * @since S60 2.8
       
   867      * @param aLoops Max number of loops to be executed.
       
   868      * @param aScrollAmount The amount of pixels scrolled per 
       
   869      *        iteration.
       
   870      * @param aScrollDelay The interval between iterations.
       
   871      */
       
   872     void SetMarqueeParams(const TInt aLoops, 
       
   873                                    const TInt aScrollAmount, 
       
   874                                    const TInt aScrollDelay);
       
   875 
       
   876     /**
       
   877      * Customizes marquee default behaviour. 
       
   878      *
       
   879      * @since S60 2.8
       
   880      * @param aLoops Max number of loops to be executed.
       
   881      * @param aScrollAmount The amount of pixels scrolled per iteration. 
       
   882      * @param aScrollDelay The interval between iterations.
       
   883      * @param aInterval The interval between frame updates.
       
   884      */
       
   885     void SetMarqueeParams(const TInt aLoops, 
       
   886                                    const TInt aScrollAmount, 
       
   887                                    const TInt aScrollDelay, 
       
   888                                    const TInt aInterval);                        
       
   889     /**
       
   890     * Tells whether current item has clipped text cells
       
   891     * @since S60 3.2
       
   892     * @return bitfield of clipped columns
       
   893     */
       
   894     TUint32 CurrentItemTextWasClipped() const;
       
   895         
       
   896     /**
       
   897     * Returns ETrue if kinetic scrolling is enabled.
       
   898     * @internal
       
   899     * @since S60 5.0
       
   900     * @return ETrue if kinetic scrolling feature is enabled.
       
   901     */
       
   902     TBool KineticScrollingEnabled() const;
       
   903 
       
   904 private:
       
   905     void DrawHighLight( CWindowGc& aGc, const TRect& aRect,
       
   906                         TBool aHighlight,
       
   907                         MAknsSkinInstance* aSkin ) const;
       
   908         
       
   909     void CheckIfSubCellsIntersectL( TAknTextLineLayout* aLayouts,
       
   910                                    TBool* aResults, const TDesC& aText,
       
   911                                    const TRect& aItemRect ) const;
       
   912     /**
       
   913     * @internal helper
       
   914     */
       
   915     void BitBltColored( CWindowGc&      aGc,
       
   916                         TBool           aHighlight,
       
   917                         const CGulIcon* aIcon,
       
   918                         TInt            aSubcell,
       
   919                         TBool           aColorIcon,
       
   920                         const TRect&    aGraphicRect ) const;
       
   921 
       
   922         
       
   923 private:
       
   924     CArrayFix<SColumn>* iColumnArray;
       
   925     CPbk2ContactViewCustomListBoxDataExtension *iExtension;
       
   926     
       
   927 //Start of Code Added for PhoneBook2
       
   928     
       
   929     //Doesn't Own - Added for PhoneBook2    
       
   930     CPbk2ContactViewListBoxModel* iDataModel;
       
   931     
       
   932     //Doesn't Own - Added for PhoneBook2
       
   933     CPSRequestHandler* iPsHandler;
       
   934     
       
   935     ///Ref : Search Pane Filter
       
   936     CPbk2PredictiveSearchFilter &iSearchFilter;
       
   937     
       
   938     // Ref: The commands
       
   939     const RPointerArray<MPbk2UiControlCmdItem>* iCommandItems;
       
   940     
       
   941 //End of Code Added for PhoneBook2
       
   942     };
       
   943 
       
   944 #endif // __CPbk2ContactViewCustomListBoxData_H__
       
   945 
       
   946 // End of File