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