epoc32/include/mw/eiklbi.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 eiklbi.h
     1 /*
       
     2 * Copyright (c) 1997-1999 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 the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #if !defined(__EIKLBI_H__)
       
    22 #define __EIKLBI_H__  
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <gdi.h>
       
    26 
       
    27 
       
    28 class CWindowGc;
       
    29 class CListBoxData;
       
    30 class TListItemProperties;
       
    31 class TListFontBoundValues;
       
    32 class MAknsControlContext;
       
    33 
       
    34 
       
    35 /**
       
    36  * The @c CListItemDrawer class is the base class for the list box item drawers 
       
    37  * which handle drawing of the contents of list box items.
       
    38  * The items may optionally be markable.
       
    39  *
       
    40  * @since Symbian 5.0
       
    41  */
       
    42 class CListItemDrawer : public CBase
       
    43     {
       
    44 
       
    45 public:
       
    46 
       
    47     /**
       
    48      * Destructor.
       
    49      */
       
    50     IMPORT_C ~CListItemDrawer();
       
    51 
       
    52     /**
       
    53      * Draws the entire item.
       
    54      *
       
    55      * This function is called by the list box view. As implemented
       
    56      * in @c CListItemDrawer, this function draws the item text using 
       
    57      * @c DrawActualItem(), and an item mark using @c DrawItemMark().
       
    58      * 
       
    59      * @param aItemIndex Index of the item to draw. 
       
    60      * @param aItemRectPos Position of the rectangle to draw. 
       
    61      * @param aItemIsSelected Whether the item is selected. 
       
    62      * @param aItemIsCurrent Whether the item is current. 
       
    63      * @param aViewIsEmphasized Whether the list box view has the emphasised
       
    64      *        flag set (see @c CListBoxView::SetEmphasized()). 
       
    65      * @param aViewIsDimmed Whether the list box view has its dimmed flag set
       
    66      *        (see @c CListBoxView::SetDimmed()). 
       
    67      */
       
    68     IMPORT_C virtual void DrawItem(TInt aItemIndex, 
       
    69                                    TPoint aItemRectPos, 
       
    70                                    TBool aItemIsSelected, 
       
    71                                    TBool aItemIsCurrent, 
       
    72                                    TBool aViewIsEmphasized, 
       
    73                                    TBool aViewIsDimmed) const;
       
    74 
       
    75     /**
       
    76      * Clears the specified rectangle of this object's graphics context.
       
    77      *
       
    78      * @param aRect Rectangle to clear.
       
    79      */
       
    80     IMPORT_C virtual void ClearRect(const TRect& aRect) const;
       
    81 
       
    82     /**
       
    83      * Gets the width of the specified item.
       
    84      *
       
    85      * @param aItemIndex The index of the item whose width is to be returned. 
       
    86      * @return The width of the item. This is 0 in @c CListItemDrawer
       
    87      */
       
    88     IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
       
    89 
       
    90     /**
       
    91      * Gets the minimum cell size.
       
    92      *
       
    93      * @return The minimum size for a cell. This is @c TSize(0, 0) 
       
    94      *         in @c CListItemDrawer.
       
    95      */
       
    96     IMPORT_C virtual TSize MinimumCellSize() const;
       
    97 
       
    98     /**
       
    99      * Sets the graphics context which this object uses for drawing.
       
   100      *
       
   101      * @param aGc Pointer to the context to use.
       
   102      */
       
   103     IMPORT_C virtual void SetGc(CWindowGc* aGc);
       
   104 
       
   105     /**
       
   106      * Gets graphics context which is used for drawing.
       
   107      *
       
   108      * @return Pointer to the graphics context used for drawing.
       
   109      */
       
   110     IMPORT_C CWindowGc* Gc() const;
       
   111 
       
   112     /**
       
   113      * Sets the width of the column containing the mark.
       
   114      *
       
   115      * @param aWidthInPixels New width for the mark column.
       
   116      */
       
   117     IMPORT_C virtual void SetMarkColumnWidth(TInt aWidthInPixels);
       
   118 
       
   119     /**
       
   120      * Sets the width of the gap between the column containing the lists item 
       
   121      * marks and the text column.
       
   122      *
       
   123      * @param aGapInPixels New gap size.
       
   124      */
       
   125     IMPORT_C virtual void SetMarkGutter(TInt aGapInPixels);
       
   126 
       
   127     /**
       
   128      * Gets mark column width.
       
   129      *
       
   130      * @return Mark column width.
       
   131      */
       
   132     IMPORT_C TInt MarkColumn() const;
       
   133 
       
   134     /**
       
   135      * Gets the width of the gap between the column containig the lists item
       
   136      * marks and the text column.
       
   137      *
       
   138      * @return Size of the inter-column gutter.
       
   139      */
       
   140     IMPORT_C TInt MarkGutter() const;
       
   141 
       
   142     /**
       
   143      * Sets the item cell size.
       
   144      * The cell size is the on-screen size of the entire item, including 
       
   145      * its text and its item mark.
       
   146      *
       
   147      * @param aSizeInPixels New size for the item cell.
       
   148      */
       
   149     IMPORT_C virtual void SetItemCellSize(const TSize& aSizeInPixels);
       
   150 
       
   151     /**
       
   152      * Gets current item cell size.
       
   153      *
       
   154      * @since Symbian 3.0
       
   155      * @return Item cell size
       
   156      */
       
   157     IMPORT_C TSize ItemCellSize() const;
       
   158 
       
   159     /**
       
   160      * Sets the viewing rectangle for this item drawer.
       
   161      * This value is not used by the @c CListItemViewer, but may be used by its 
       
   162      * derived classes.
       
   163      *
       
   164      * @param aRect New value for @c iViewRect.
       
   165      */
       
   166     IMPORT_C virtual void SetViewRect(const TRect& aRect);
       
   167 
       
   168     /**
       
   169      * Sets whether item tick marks are drawn. 
       
   170      * 
       
   171      * If the draw mark flag iDrawMark is set, @c DrawItem() leaves space for 
       
   172      * the marks column to the left of the text column, and @c DrawItemMark()
       
   173      * draws the item marks.
       
   174      *
       
   175      * @param aDrawMark New value for iDrawMark.
       
   176      */
       
   177     IMPORT_C void SetDrawMark(TBool aDrawMark);
       
   178 
       
   179     /**
       
   180      * Gets a rectangle describing where the matcher cursor should be drawn.
       
   181      * The default behavious is to return uninitialised @c TRect.
       
   182      *
       
   183      * @deprecated
       
   184      * @param aMatchableText The text of the currently matched string.
       
   185      * @param aCharPos The position in the string of the character just matched
       
   186      *        in the current incremental match.
       
   187      * @param aItemCellYPos Y position of the item cell.
       
   188      * @param aCurrentItemIndex Item index for the current item.
       
   189      * @return Where the cursor should be drawn.
       
   190      */
       
   191     IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, 
       
   192                                              TInt aCharPos, 
       
   193                                              TInt aItemCellYPos, 
       
   194                                              TInt aCurrentItemIndex ) const;
       
   195 
       
   196     /**
       
   197      * Gets the ascent of the matcher cursor.
       
   198      * 
       
   199      * This is obtained for the item at index @c aCurrentItemIndex.
       
   200      * The function returns 0 by default.
       
   201      *
       
   202      * @deprecated
       
   203      * @param aCurrentItemIndex Item index of the target item.
       
   204      * @return The height of the matcher cursor.
       
   205      */
       
   206     IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
       
   207 
       
   208     /**
       
   209      * Not Used in S60.
       
   210      */
       
   211     IMPORT_C virtual void DrawItemMark(TBool aItemIsSelected, 
       
   212                                        TBool aViewIsDimmed, 
       
   213                                        const TPoint& aMarkPos) const;
       
   214 
       
   215     /**
       
   216      * Sets symbol font for the item drawer.
       
   217      * The symbol font is used to draw the standard tick item marks.
       
   218      *
       
   219      * @param aFont The font to be used.
       
   220      */
       
   221     IMPORT_C void SetSymbolFont(const CFont* aFont);
       
   222 
       
   223     /**
       
   224      * Sets the vertical gap between items in the list.
       
   225      *
       
   226      * @param aGapInPixels New value for the vertical gap between items 
       
   227      *        in pixels.
       
   228      */
       
   229     IMPORT_C void SetVerticalInterItemGap(TInt aGapInPixels);
       
   230 
       
   231     /**
       
   232      * Sets the font storage data for the item drawer and transfer ownership
       
   233      * of that data.
       
   234      *
       
   235      * @param aData Font storage data .
       
   236      */
       
   237     IMPORT_C void SetData(CListBoxData* aData);
       
   238 
       
   239     /**
       
   240      * Gets the font for the specified item.
       
   241      * 
       
   242      * The function returns @c NULL if no font storage data has been set.
       
   243      *
       
   244      * @param aItemIndex The index of the item for which the font is returned.
       
   245      * @return The item's font.
       
   246      */
       
   247     IMPORT_C CFont* Font(TInt aItemIndex) const;
       
   248 
       
   249     /**
       
   250      * Gets the colour and style properties of the specified item.
       
   251      *
       
   252      * @param aItemIndex The index of the item for which properties
       
   253      *        are obtained (Not Used).
       
   254      * @return The item's properties.
       
   255      */
       
   256     IMPORT_C virtual TListItemProperties Properties(TInt aItemIndex) const;
       
   257 
       
   258     /**
       
   259      * Draws the frame.
       
   260      * 
       
   261      * Uses the colours set with the fonts and colour functions described above.
       
   262      *
       
   263      * @deprecated
       
   264      * @param aGc The graphics context used to draw the frame.
       
   265      * @param aRect The frame's rectangle.
       
   266      * @param aFlags The item drawer flags.
       
   267      */
       
   268     IMPORT_C void DrawFrame(CWindowGc& aGc,
       
   269                             const TRect& aRect,
       
   270                             TInt aFlags) const;
       
   271 
       
   272 public:
       
   273 
       
   274     /**
       
   275      * Provides list box attributes for handling multiple selections. These 
       
   276      * flags can be set using the @c CListItemDrawer::SetFlags function.
       
   277      */ 
       
   278     enum TFlags
       
   279         {
       
   280         /**
       
   281          * If set, specifies the inclusion of a gap into which a tick mark can
       
   282          * be drawn if the item is selected. This is used in the following 
       
   283          * @c CListItemDrawer class functions:
       
   284          *   @c DrawItem(),
       
   285          *   @c DrawItemMark(),
       
   286          *   @c SetDrawMark()
       
   287          */
       
   288         EDrawMarkSelection          = 0x0001,
       
   289         
       
   290         /**
       
   291          * If set, draws a highlight over a selected list item. This is used 
       
   292          * in the @c CTextListItemDrawer::DoDrawItemText() function.
       
   293          */
       
   294         EPaintedSelection           = 0x0002,
       
   295         
       
   296         /** This flag is not supported. */ 
       
   297         EDrawOnlyActiveSelection    = 0x0004,
       
   298         
       
   299         /** If set highlight is disabled. */
       
   300         EDisableHighlight = 0x0008,
       
   301 
       
   302         /** This flag indicates @c CListboxData to draw pressed down state 
       
   303          *  rather than normal highlight on item. Make sure checking this 
       
   304          *  flag in subclass's Draw method, if using a custom @c CListboxData 
       
   305          *  inheriting from @c CColumnListBoxData or @c CFormattedCellListBoxData.
       
   306          */
       
   307         EPressedDownState = 0x0010,
       
   308 
       
   309         /** This flag indicates the marquee is disabled. If it is set, @c CColumnListBoxData 
       
   310          *  or @c CFormattedCellListBoxData would disable maquee temporarily for 
       
   311          *  performance reason.
       
   312          */
       
   313         EDisableMarquee = 0x0020
       
   314         };
       
   315 
       
   316 public:
       
   317 
       
   318     /**
       
   319      * Provides attributes for list items
       
   320      */
       
   321     enum TListItemAttribute
       
   322 
       
   323         {
       
   324         /** Highlight for current text. */
       
   325         ECurrent    = 0x0001,       // may be drawn with a frame
       
   326 
       
   327         /**
       
   328          * Highlight for text when the listbox view is emphasized.
       
   329          *
       
   330          * This is used in the following @c CListBoxView class functions:
       
   331          * @c DrawItem(), @c DrawMatcherCursor(), @c SetEmphasized().
       
   332          */
       
   333         EEmphasized = 0x0002,       // special highlight (not selected)
       
   334         
       
   335         /**
       
   336          * Highlight for text that is selected. This is used in the following 
       
   337          * functions: @c CColumnListBoxItemDrawer::DrawItemText(), 
       
   338          * @c CHierarchicalListItemDrawer::DrawActualItem(), 
       
   339          * @c CDirContentsListItemDrawer::DrawActualItem().
       
   340          */
       
   341         ESelected   = 0x0004,       // usually different than emphasized
       
   342         
       
   343         /**
       
   344          * Sum of all the above attributes.
       
   345          * This last attribute is used to control that one can use only
       
   346          * valid attributes above. So do not use it at all.         
       
   347          */
       
   348         EMask       = 0x0007 // sum of all others attributes
       
   349 
       
   350         };
       
   351 
       
   352 public:
       
   353 
       
   354     /**
       
   355      * Sets the colour used to draw non-highlighted text.
       
   356      *
       
   357      * @param aColor The text colour.
       
   358      */
       
   359     inline void SetTextColor(TRgb aColor);
       
   360 
       
   361     /**
       
   362      * Sets the colour used to draw the background for non-highlighted items.
       
   363      *
       
   364      * @param aColor The background colour.
       
   365      */
       
   366     inline void SetBackColor(TRgb aColor);
       
   367 
       
   368     /**
       
   369      * Sets the colour used to draw highlighted text.
       
   370      *
       
   371      * @param aColor The highlighted text colour.
       
   372      */
       
   373     inline void SetHighlightedTextColor(TRgb aColor);
       
   374 
       
   375     /**
       
   376      * Sets the colour used to draw the background for highlighted items.
       
   377      *
       
   378      * @param aColor The highlighted background colour.
       
   379      */
       
   380     inline void SetHighlightedBackColor(TRgb aColor);
       
   381 
       
   382     /**
       
   383      * Sets the colour used to draw dimmed text.
       
   384      *
       
   385      * @param aColor The dimmed text colour.
       
   386      */
       
   387     inline void SetDimmedTextColor(TRgb aColor);
       
   388 
       
   389     /**
       
   390      * Sets the colour used to draw the background for dimmed items.
       
   391      *
       
   392      * @param aColor The background colour for dimmed items.
       
   393      */
       
   394     inline void SetDimmedBackColor(TRgb aColor);
       
   395 
       
   396     /**
       
   397      * Gets the colour used to draw non-highlighted text.
       
   398      *
       
   399      * @return The text colour.
       
   400      */
       
   401     inline TRgb TextColor() const;
       
   402 
       
   403     /**
       
   404      * Gets the colour used to draw the background for non-highlighted items.
       
   405      *
       
   406      * @return Background colour.
       
   407      */
       
   408     inline TRgb BackColor() const;
       
   409 
       
   410     /**
       
   411      * Gets the colour used to draw highlighted text.
       
   412      *
       
   413      * @return The highlighted text colour.
       
   414      */
       
   415     inline TRgb HighlightedTextColor() const;
       
   416 
       
   417     /**
       
   418      * Gets the colour used to draw the background for highlighted items.
       
   419      *
       
   420      * @return The highlighted background colour.
       
   421      */
       
   422     inline TRgb HighlightedBackColor() const;
       
   423 
       
   424     /**
       
   425      * Gets the colour used to draw dimmed text.
       
   426      *
       
   427      * @return The dimmed text colour. 
       
   428      */
       
   429     inline TRgb DimmedTextColor() const;
       
   430 
       
   431     /**
       
   432      * Gets the colour used to draw the background for dimmed items.
       
   433      *
       
   434      * @return The background colour for dimmed items.
       
   435      */
       
   436     inline TRgb DimmedBackColor() const;
       
   437 
       
   438     /**
       
   439      * Gets the item drawer flags.
       
   440      *
       
   441      * @return The item drawer flags.
       
   442      */
       
   443     inline TInt Flags() const;
       
   444 
       
   445     /**
       
   446      * Sets the item drawer flags.
       
   447      *
       
   448      * @param aFlags The new item drawer flags.
       
   449      */
       
   450     IMPORT_C void SetFlags(TInt aFlags);
       
   451 
       
   452     /**
       
   453      * Sets the item drawer flags.
       
   454      *
       
   455      * @param aFlags The new item drawer flags.
       
   456      */
       
   457     IMPORT_C void ClearFlags(TInt aFlags);
       
   458 
       
   459     /**
       
   460      * Access to skin contexts.
       
   461      *
       
   462      * @since S60 2.0
       
   463      * @return Pointer to skin background control context.
       
   464      */
       
   465     IMPORT_C MAknsControlContext  *SkinBackgroundControlContext() const;
       
   466     /**
       
   467      * Ability to enable skins in listboxes.
       
   468      *
       
   469      * @since S60 2.0
       
   470      * @param aEnabled parameter for enabling/disabling skin.
       
   471      *        @c ETrue enables skin,
       
   472      *        @c EFalse disables skin
       
   473      */
       
   474     IMPORT_C void SetSkinEnabledL(TBool aEnabled);
       
   475 
       
   476 protected:
       
   477 
       
   478     /**
       
   479      * C++ default constructor.
       
   480      */
       
   481     IMPORT_C CListItemDrawer();
       
   482 
       
   483     /**
       
   484      * Draws item text.
       
   485      * 
       
   486      * This function is called by @c CListItemDrawer::DrawItem() with 
       
   487      * appropriate arguments. Its purpose is to draw the actual item 
       
   488      * - everything other than the item mark - into the graphics context.
       
   489      *
       
   490      * @param aItemIndex Which item to draw. 
       
   491      * @param aActualItemRect Where the item should be drawn. 
       
   492      * @param aItemIsCurrent Whether the item is current. 
       
   493      * @param aViewIsEmphasized Whether the list box view is emphasised. 
       
   494      * @param aViewIsDimmed Whether the list box view is dimmed. 
       
   495      * @param aItemIsSelected Whether the list box item is selected.
       
   496      */
       
   497     virtual void DrawActualItem(TInt aItemIndex, 
       
   498                                 const TRect& aActualItemRect, 
       
   499                                 TBool aItemIsCurrent, 
       
   500                                 TBool aViewIsEmphasized, 
       
   501                                 TBool aViewIsDimmed, 
       
   502                                 TBool aItemIsSelected) const = 0;
       
   503 
       
   504     /**
       
   505      * Resets the pen style, brush style, brush colour etc. to suitable 
       
   506      * starting values for this class. 
       
   507      * 
       
   508      * This function is called after every drawing operation.
       
   509      */
       
   510     IMPORT_C virtual void ResetGc() const;
       
   511 
       
   512     /**
       
   513      * Gets the colour used to draw tick marks. 
       
   514      *
       
   515      * A tick mark usually indicates that an item is selected.
       
   516      *
       
   517      * @return The tick mark colour.
       
   518      */
       
   519     inline TRgb MarkColor() const;
       
   520 
       
   521     /**
       
   522      * Gets the vertical gap between items in pixels.
       
   523      *
       
   524      * @return The vertical gap between items in pixels.
       
   525      */
       
   526     IMPORT_C TInt VerticalInterItemGap() const;
       
   527     
       
   528     /**
       
   529      * Sets up the graphics context for the specified item.
       
   530      *
       
   531      * @param aItemIndex The item for which the graphics context 
       
   532      *        will be set up.
       
   533      */
       
   534     IMPORT_C void SetupGc(TInt aItemIndex) const;
       
   535 
       
   536 private:
       
   537 
       
   538     IMPORT_C virtual TAny* Reserved_1();
       
   539 
       
   540     inline TInt& VerticalInterItemGap();
       
   541 
       
   542     inline const CFont* SymbolFont() const;
       
   543 
       
   544     inline const CFont*& SymbolFont();
       
   545 
       
   546 protected:
       
   547     
       
   548     /** Item's cell size. */
       
   549     TSize iItemCellSize;
       
   550 
       
   551     /** Mark gutter. */
       
   552     TInt iMarkGutter;
       
   553 
       
   554     /** Mark column width. */
       
   555     TInt iMarkColumnWidth;
       
   556 
       
   557     /** View area. */
       
   558     TRect iViewRect;
       
   559 
       
   560     /** Draw mark. */
       
   561     TBool iDrawMark;
       
   562 
       
   563     /** Graphics context controller. */
       
   564     CWindowGc* iGc;
       
   565 
       
   566     /** Color of text. */ 
       
   567     TRgb iTextColor;
       
   568     
       
   569     /** Background color. */
       
   570     TRgb iBackColor;
       
   571 
       
   572     /** Color of highlighted text. */
       
   573     TRgb iHighlightedTextColor; 
       
   574 
       
   575     /** Highlighted background color. */
       
   576     TRgb iHighlightedBackColor;
       
   577 
       
   578     /** Color of dimmed text. */
       
   579     TRgb iDimmedTextColor;
       
   580 
       
   581     /** Color of dimmed background. */
       
   582     TRgb iDimmedBackColor;
       
   583 
       
   584     /** Mark color. */
       
   585     TRgb iMarkColor;
       
   586 
       
   587     /** Data model. */
       
   588     CListBoxData* iData;
       
   589 
       
   590 private:
       
   591 
       
   592     const CFont* iSymbolFont;
       
   593 
       
   594     TInt iVerticalInterItemGap;
       
   595 
       
   596     TInt iSpare;
       
   597 
       
   598     TUint iFlags;
       
   599 
       
   600     };
       
   601 
       
   602 
       
   603 
       
   604 
       
   605 class MTextListBoxModel;
       
   606 
       
   607 
       
   608 /**
       
   609  * Item drawer which can handle text.
       
   610  * 
       
   611  * Used by @c CListBoxView to draw individual list box items 
       
   612  * for a @c CEikTextListBox
       
   613  */
       
   614 class CTextListItemDrawer : public CListItemDrawer
       
   615     {
       
   616 
       
   617 public:
       
   618 
       
   619     /**
       
   620      * C++ default constructor.
       
   621      */
       
   622     IMPORT_C CTextListItemDrawer();
       
   623     
       
   624     /**
       
   625      * Destructor.
       
   626      */
       
   627     IMPORT_C ~CTextListItemDrawer();
       
   628 
       
   629     /**
       
   630      * C++ default constructor.
       
   631      *
       
   632      * Constructs a new text item drawer which draws the data of the specified 
       
   633      * model using the supplied font.
       
   634      *
       
   635      * @param aTextListBoxModel The model whose items will be drawn. 
       
   636      * @param aFont The font in which the items will be drawn.
       
   637      */
       
   638     IMPORT_C CTextListItemDrawer(MTextListBoxModel* aTextListBoxModel, 
       
   639                                  const CFont* aFont);
       
   640 
       
   641     /**
       
   642      * Handles 2nd phase construction.
       
   643      *
       
   644      * @param aFont The font in which the list box items will be drawn.
       
   645      */
       
   646     IMPORT_C void ConstructL(const CFont* aFont);
       
   647 
       
   648     /**
       
   649      * Draws the actual item contents for the specified item in the specified 
       
   650      * rectangle.
       
   651      *
       
   652      * @param aItemIndex Index of the item to draw. 
       
   653      * @param aActualItemRect Area to draw into. 
       
   654      * @param aItemIsCurrent @c ETrue if the item is current. 
       
   655      * @param aViewIsEmphasized @c ETrue if the view is emphasised. 
       
   656      * @param aViewIsDimmed Ignored
       
   657      * @param aItemIsSelected @c ETrue if the item is selected.
       
   658      */
       
   659     IMPORT_C virtual void DrawActualItem(TInt aItemIndex, 
       
   660                                          const TRect& aActualItemRect, 
       
   661                                          TBool aItemIsCurrent, 
       
   662                                          TBool aViewIsEmphasized, 
       
   663                                          TBool aViewIsDimmed,
       
   664                                          TBool aItemIsSelected) const;
       
   665 
       
   666     /**
       
   667      * Gets the width in pixels of the specified item.
       
   668      *
       
   669      * @param aItemIndex The index of the item for which the width is obtained.
       
   670      * @return The specified item’s width in pixels.
       
   671      */ 
       
   672     IMPORT_C virtual TInt ItemWidthInPixels(TInt aItemIndex) const;
       
   673 
       
   674     /**
       
   675      * Gets the minimum size of a cell based on the font and the number of 
       
   676      * characters in the cell.
       
   677      *
       
   678      * @return The minimum size for a cell, in pixels.
       
   679      */
       
   680     IMPORT_C virtual TSize MinimumCellSize() const;
       
   681 
       
   682     /**
       
   683      * Sets the graphics context.
       
   684      *
       
   685      * @param aGc The graphics context to use.
       
   686      */
       
   687     IMPORT_C virtual void SetGc(CWindowGc* aGc);
       
   688 
       
   689     /**
       
   690      * Sets the number of characters in a cell. 
       
   691      * This value affects only @c MinimumCellSize().
       
   692      *
       
   693      * @param aNumOfCharsToDisplayInCell Number of characters to 
       
   694      *        display in a cell.
       
   695      */
       
   696     IMPORT_C void SetCellWidthInChars(TInt aNumOfCharsToDisplayInCell);
       
   697 
       
   698     /**
       
   699      * Gets the position and size of the matcher cursor.
       
   700      *
       
   701      * @deprecated
       
   702      * @param aMatchableText String currently being matched. Not Used.
       
   703      * @param aCharPos Position within the string. Not Used.
       
   704      * @param aItemCellYPos Y position of the item cell in pixels. Not Used.
       
   705      * @param aCurrentItemIndex Item index for the current item. Not Used.
       
   706      * @return The rectangle covered by the matcher cursor, in pixels.
       
   707      */
       
   708     IMPORT_C virtual TRect MatcherCursorRect(const TDesC& aMatchableText, 
       
   709                                              TInt aCharPos, 
       
   710                                              TInt aItemCellYPos, 
       
   711                                              TInt aCurrentItemIndex ) const;
       
   712 
       
   713     /**
       
   714      * No Implementation. 
       
   715      *
       
   716      * Derived classes that deal with text and want to support incremental 
       
   717      * matching in listboxes need to redefine this function.
       
   718      * Should be used to get the ascent of the matcher cursor in pixels.
       
   719      *
       
   720      * @deprecated
       
   721      * @param aCurrentItemIndex Index of the current item. Not Used.
       
   722      * @return Always returns 0;
       
   723      */
       
   724     IMPORT_C virtual TInt MatcherCursorAscent( TInt aCurrentItemIndex ) const;
       
   725 
       
   726     /**
       
   727      * Sets the font.
       
   728      *
       
   729      * @param aFont The new font.
       
   730      */
       
   731     IMPORT_C void SetFont(const CFont* aFont);
       
   732 
       
   733     /**
       
   734      * Sets the search string.
       
   735      *
       
   736      * @param aSearchString The new search string.
       
   737      */
       
   738     IMPORT_C void SetSearchStringL(const TDesC* aSearchString);
       
   739 
       
   740     /**
       
   741      * Gets font for the specified item.
       
   742      *
       
   743      * @param aIndex The index of the target item.
       
   744      * @return Specified item's font.
       
   745      */
       
   746     IMPORT_C const CFont* Font(TInt aIndex) const;
       
   747 
       
   748     // SAPLAF new methods.
       
   749 
       
   750 
       
   751     /**
       
   752      * Sets item mark position.
       
   753      *
       
   754      * @param aPos The new position.
       
   755      */
       
   756     inline void SetItemMarkPosition(TInt aPos);
       
   757 
       
   758     /**
       
   759      * Gets item mark position.
       
   760      *
       
   761      * @return Position of the Item mark.
       
   762      */
       
   763     inline TInt ItemMarkPosition() const;
       
   764 
       
   765     /**
       
   766      * Sets the item mark replacement.
       
   767      *
       
   768      * @param aReplacement The new replacement descriptor.
       
   769      */
       
   770     inline void SetItemMarkReplacement(const TDesC &aReplacement);
       
   771 
       
   772     /**
       
   773      * Gets item mark replacement.
       
   774      *
       
   775      * @return Pointer to the replacement string.
       
   776      */
       
   777     inline TPtrC ItemMarkReplacement() const;
       
   778 
       
   779     /**
       
   780      * Sets item mark reverse to be active or not.
       
   781      *
       
   782      * @param aReverse The new setting.
       
   783      *        @c ETrue if item is marked reversed.
       
   784      */
       
   785     inline void SetItemMarkReverse(TBool aReverse);
       
   786 
       
   787     /**
       
   788      * Check if the item has been marked reversed is active.
       
   789      *
       
   790      * @return Indicates if active or not.
       
   791      *         @c ETrue if active
       
   792      */
       
   793     inline TBool ItemMarkReverse() const;
       
   794 
       
   795 
       
   796 protected:
       
   797 
       
   798     /**
       
   799      * Draws text.
       
   800      *
       
   801      * This function is invoked by @c DrawItemText() to draw a string into a 
       
   802      * rectangular area of @c iGc.
       
   803      *
       
   804      * @param aDes The string to draw. 
       
   805      * @param aItemTextRect Area to draw into. 
       
   806      * @param aItemIsCurrent @c ETrue if the item is current. 
       
   807      * @param aViewIsEmphasized @c ETrue if the view is emphasised. 
       
   808      * @param aItemIsSelected @c ETrue if the item is selected. 
       
   809      * @param aItemIndex The item’s index.
       
   810      */
       
   811     IMPORT_C virtual void DoDrawItemText(const TDesC& aDes, 
       
   812                                          const TRect& aItemTextRect, 
       
   813                                          TBool aItemIsCurrent, 
       
   814                                          TBool aViewIsEmphasized, 
       
   815                                          TBool aItemIsSelected, 
       
   816                                          TInt aItemIndex) const;
       
   817 
       
   818     /**
       
   819      * Draw item text.
       
   820      * 
       
   821      * This function is invoked by @c DrawActualItem() to draw the item text.
       
   822      *
       
   823      * @param aItemIndex Index of the item to draw. 
       
   824      * @param aItemTextRect Area to draw into. 
       
   825      * @param aItemIsCurrent @c ETrue if the item is current. 
       
   826      * @param aViewIsEmphasized @c ETrue if the view is emphasised.
       
   827      * @param aItemIsSelected @c ETrue if the item is selected. 
       
   828      */
       
   829     IMPORT_C virtual void DrawItemText(TInt aItemIndex, 
       
   830                                        const TRect& aItemTextRect, 
       
   831                                        TBool aItemIsCurrent, 
       
   832                                        TBool aViewIsEmphasized, 
       
   833                                        TBool aItemIsSelected) const;
       
   834 
       
   835     /**
       
   836      * Resets the graphics context.
       
   837      * This function invokes @c CListItemDrawer::ResetGc() and resets the pen 
       
   838      * colour to @c iTextColor.
       
   839      */
       
   840     IMPORT_C virtual void ResetGc() const;
       
   841 
       
   842 private:
       
   843 
       
   844     IMPORT_C virtual TAny* Reserved_1();
       
   845 
       
   846 protected:
       
   847 
       
   848     /** List box model for the drawer. */
       
   849     MTextListBoxModel* iModel;
       
   850 
       
   851     /** Font used by the drawer. */
       
   852     const CFont* iFont;
       
   853 
       
   854 private:
       
   855     
       
   856     TInt iNumOfCharsInCell;
       
   857 
       
   858     // AVKON LAF 
       
   859 
       
   860     TInt iItemMarkPos;
       
   861 
       
   862     TPtrC iItemMarkReplacement;
       
   863 
       
   864     TBool iItemMarkReverse;
       
   865 
       
   866     // AVKON LAF ENDS 
       
   867 
       
   868     };
       
   869 
       
   870 
       
   871 
       
   872 
       
   873 /**
       
   874  * The @c TListItemProperties class packages together the color and 
       
   875  * style properties which can be applied when drawing the contents 
       
   876  * of list box items.
       
   877  *
       
   878  * @since Symbian ER5U
       
   879  */
       
   880 
       
   881 class TListItemProperties
       
   882 
       
   883     {
       
   884 
       
   885 public:
       
   886 
       
   887     /**
       
   888      * C++ default constructor.
       
   889      */
       
   890     IMPORT_C TListItemProperties();
       
   891 
       
   892 public:
       
   893 
       
   894     /**
       
   895      * Sets whether the list item is drawn bold or not bold.
       
   896      *
       
   897      * @deprecated
       
   898      * @param aBold @c ETrue to draw the list item bold. 
       
   899      *        @c EFalse otherwise.
       
   900      */
       
   901     inline void SetBold(TBool aBold);
       
   902 
       
   903     /**
       
   904      * Tests whether the list item is drawn bold.
       
   905      *
       
   906      * @deprecated
       
   907      * @return @c ETrue if the list item is drawn bold. 
       
   908      *         @c EFalse otherwise.
       
   909      */
       
   910     inline TBool IsBold() const;
       
   911 
       
   912     /**
       
   913      * Sets whether or not the list item is drawn in italics.
       
   914      *
       
   915      * @deprecated
       
   916      * @param aItalics @c ETrue to draw the list item in italics. 
       
   917      *        @c EFalse otherwise.
       
   918      */
       
   919     inline void SetItalics(TBool aItalics);
       
   920 
       
   921     /**
       
   922      * Tests whether the list item is italicised.
       
   923      *
       
   924      * @deprecated
       
   925      * @return @c ETrue if the list item is drawn in italics. 
       
   926      *         @c EFalse otherwise.
       
   927      */
       
   928     inline TBool IsItalics() const;
       
   929 
       
   930     /**
       
   931      * Sets whether or not the list item is drawn with an underline.
       
   932      *
       
   933      * @param aUnderlined @c ETrue to draw the list item with an underline. 
       
   934      *        @c EFalse otherwise.
       
   935      */
       
   936     inline void SetUnderlined(TBool aUnderlined);
       
   937 
       
   938     /**
       
   939      * Test whether the list item is drawn with an underline.
       
   940      *
       
   941      * @return @c ETrue if the list item is drawn with an underline. 
       
   942      *         @c EFalse otherwise.
       
   943      */
       
   944     inline TBool IsUnderlined() const;
       
   945 
       
   946     /**
       
   947      * Sets list item dim state. 
       
   948      * 
       
   949      * An item is usually drawn dimmed to indicate that it cannot accept 
       
   950      * user input.
       
   951      *
       
   952      * @param aDimmed @c ETrue to draw the list item dimmed. @c EFalse otherwise.
       
   953      */
       
   954     inline void SetDimmed(TBool aDimmed);
       
   955 
       
   956     /**
       
   957      * Tests list item dim state. 
       
   958      *
       
   959      * An item is usually drawn dimmed to indicate that it cannot accept 
       
   960      * user input.
       
   961      *
       
   962      * @return @c ETrue if the list item is dimmed. 
       
   963      *         @c EFalse otherwise.
       
   964      */
       
   965     inline TBool IsDimmed() const;
       
   966 
       
   967     /**
       
   968      * Sets the list item’s colour.
       
   969      *
       
   970      * @param aColor The list item’s colour.
       
   971      */
       
   972     inline void SetColor(TRgb aColor);
       
   973 
       
   974     /**
       
   975      * Gets the list item’s colour.
       
   976      *
       
   977      * @return The list item’s colour.
       
   978      */
       
   979     inline TRgb Color() const;
       
   980 
       
   981     /**
       
   982      * Activate/deactivate separator after item.
       
   983      *
       
   984      * @deprecated
       
   985      * @param aSeparator Active/deactive selector.
       
   986      *        @c ETrue = Active.
       
   987      *        @c EFalse = Deactivated.
       
   988      */
       
   989     inline void SetSeparatorAfter(TBool aSeparator);
       
   990 
       
   991     /**
       
   992      * Check if separator after item is active.
       
   993      *
       
   994      * @deprecated
       
   995      * @return @c ETrue if Active.
       
   996      *         @c EFalse if Deactivated.
       
   997      */
       
   998     inline TBool IsSeparatorAfter() const;
       
   999 
       
  1000     /**
       
  1001      * Select to hide the item .
       
  1002      *
       
  1003      * @param aHidden Defines whether the item is hidden.
       
  1004      *        @c ETrue = Hidden
       
  1005      */
       
  1006     inline void SetHiddenSelection(TBool aHidden);
       
  1007 
       
  1008     /**
       
  1009      * Check if the item is hidden.
       
  1010      *
       
  1011      * @return @c ETrue if item is hidden.
       
  1012      */
       
  1013     inline TBool IsSelectionHidden() const;
       
  1014 
       
  1015 private:
       
  1016 
       
  1017     TUint iFlags;
       
  1018 
       
  1019     TRgb iColor;
       
  1020 
       
  1021 private:
       
  1022 
       
  1023     enum
       
  1024 
       
  1025         {
       
  1026 
       
  1027         ELbxItemBold        = 0x0001,
       
  1028 
       
  1029         ELbxItemItalics     = 0x0002,
       
  1030 
       
  1031         ELbxItemUnderlined  = 0x0004,
       
  1032 
       
  1033     ELbxItemDimmed      = 0x0008,
       
  1034 
       
  1035     ELbxItemSeparatorAfter  = 0x0010,
       
  1036     
       
  1037     ELbxItemSelectionHidden = 0x0020
       
  1038     
       
  1039         };
       
  1040 
       
  1041     };
       
  1042 
       
  1043 
       
  1044 
       
  1045 //
       
  1046 
       
  1047 // Inlines
       
  1048 
       
  1049 //
       
  1050 
       
  1051 
       
  1052 
       
  1053 inline void CListItemDrawer::SetTextColor(TRgb aColor)
       
  1054 
       
  1055     {iTextColor=aColor;}
       
  1056 
       
  1057 inline void CListItemDrawer::SetBackColor(TRgb aColor)
       
  1058 
       
  1059     {iBackColor=aColor;}
       
  1060 
       
  1061 inline void CListItemDrawer::SetHighlightedTextColor(TRgb aColor)
       
  1062 
       
  1063     {iHighlightedTextColor=aColor;}
       
  1064 
       
  1065 inline void CListItemDrawer::SetHighlightedBackColor(TRgb aColor)
       
  1066 
       
  1067     {iHighlightedBackColor=aColor;}
       
  1068 
       
  1069 inline void CListItemDrawer::SetDimmedTextColor(TRgb aColor)
       
  1070 
       
  1071     {iDimmedTextColor=aColor;}
       
  1072 
       
  1073 inline void CListItemDrawer::SetDimmedBackColor(TRgb aColor)
       
  1074 
       
  1075     {iDimmedBackColor=aColor;}
       
  1076 
       
  1077 inline TRgb CListItemDrawer::TextColor() const
       
  1078 
       
  1079     {return iTextColor;}
       
  1080 
       
  1081 inline TRgb CListItemDrawer::BackColor() const
       
  1082 
       
  1083     {return iBackColor;}
       
  1084 
       
  1085 inline TRgb CListItemDrawer::HighlightedTextColor() const
       
  1086 
       
  1087     {return iHighlightedTextColor;}
       
  1088 
       
  1089 inline TRgb CListItemDrawer::HighlightedBackColor() const
       
  1090 
       
  1091     {return iHighlightedBackColor;}
       
  1092 
       
  1093 inline TRgb CListItemDrawer::DimmedTextColor() const
       
  1094 
       
  1095     {return iDimmedTextColor;}
       
  1096 
       
  1097 inline TRgb CListItemDrawer::DimmedBackColor() const
       
  1098 
       
  1099     {return iDimmedBackColor;}
       
  1100 
       
  1101 inline TRgb CListItemDrawer::MarkColor() const
       
  1102 
       
  1103     {return iMarkColor;}
       
  1104 
       
  1105 inline TInt CListItemDrawer::Flags() const
       
  1106 
       
  1107     {return iFlags;}
       
  1108 
       
  1109 
       
  1110 
       
  1111 inline TBool TListItemProperties::IsItalics() const
       
  1112 
       
  1113     {return iFlags&ELbxItemItalics;}
       
  1114 
       
  1115 inline TBool TListItemProperties::IsBold() const
       
  1116 
       
  1117     {return iFlags&ELbxItemBold;}
       
  1118 
       
  1119 inline TBool TListItemProperties::IsUnderlined() const
       
  1120 
       
  1121     {return iFlags&ELbxItemUnderlined;}
       
  1122 
       
  1123 inline TBool TListItemProperties::IsDimmed() const
       
  1124 
       
  1125     {return iFlags&ELbxItemDimmed;}
       
  1126 
       
  1127 inline TBool TListItemProperties::IsSeparatorAfter() const
       
  1128 
       
  1129     {return iFlags&ELbxItemSeparatorAfter;}
       
  1130 
       
  1131 inline TBool TListItemProperties::IsSelectionHidden() const
       
  1132 
       
  1133     {return iFlags&ELbxItemSelectionHidden;}
       
  1134 
       
  1135 
       
  1136 
       
  1137 inline void TListItemProperties::SetColor(TRgb aColor)
       
  1138 
       
  1139     {iColor=aColor;}
       
  1140 
       
  1141 inline TRgb TListItemProperties::Color() const
       
  1142 
       
  1143     {return iColor;}
       
  1144 
       
  1145 inline void TListItemProperties::SetBold(TBool aBold)
       
  1146 
       
  1147     {
       
  1148 
       
  1149     if (aBold) 
       
  1150 
       
  1151         iFlags|=ELbxItemBold;
       
  1152 
       
  1153     else
       
  1154 
       
  1155         iFlags&=(~ELbxItemBold);
       
  1156 
       
  1157     }
       
  1158 
       
  1159 inline void TListItemProperties::SetItalics(TBool aItalics)
       
  1160 
       
  1161     {
       
  1162 
       
  1163     if (aItalics)
       
  1164 
       
  1165         iFlags|=ELbxItemItalics;
       
  1166 
       
  1167     else
       
  1168 
       
  1169         iFlags&=(~ELbxItemItalics);
       
  1170 
       
  1171     }
       
  1172 
       
  1173 inline void TListItemProperties::SetUnderlined(TBool aUnderlined)
       
  1174 
       
  1175     {
       
  1176 
       
  1177     if (aUnderlined)
       
  1178 
       
  1179         iFlags|=ELbxItemUnderlined;
       
  1180 
       
  1181     else
       
  1182 
       
  1183         iFlags&=(~ELbxItemUnderlined);
       
  1184 
       
  1185     }
       
  1186 
       
  1187 inline void TListItemProperties::SetDimmed(TBool aDimmed)
       
  1188 
       
  1189     {
       
  1190 
       
  1191     if (aDimmed)
       
  1192 
       
  1193         iFlags|=ELbxItemDimmed;
       
  1194 
       
  1195     else
       
  1196 
       
  1197         iFlags&=(~ELbxItemDimmed);
       
  1198 
       
  1199     }
       
  1200 
       
  1201 
       
  1202 
       
  1203 inline void TListItemProperties::SetSeparatorAfter(TBool aSeparator)
       
  1204 
       
  1205     {
       
  1206 
       
  1207     if (aSeparator) 
       
  1208 
       
  1209         iFlags|=ELbxItemSeparatorAfter;
       
  1210 
       
  1211     else
       
  1212 
       
  1213         iFlags&=(~ELbxItemSeparatorAfter);
       
  1214 
       
  1215     }
       
  1216 
       
  1217 
       
  1218 inline void TListItemProperties::SetHiddenSelection(TBool aBlocked)
       
  1219 
       
  1220     {
       
  1221 
       
  1222     if (aBlocked) 
       
  1223 
       
  1224         iFlags|=ELbxItemSelectionHidden;
       
  1225 
       
  1226     else
       
  1227 
       
  1228         iFlags&=(~ELbxItemSelectionHidden);
       
  1229 
       
  1230     }
       
  1231 
       
  1232 
       
  1233 
       
  1234 
       
  1235  
       
  1236 
       
  1237 // AVKON LAF 
       
  1238 
       
  1239 inline void CTextListItemDrawer::SetItemMarkPosition(TInt aPos) { iItemMarkPos = aPos; }
       
  1240 
       
  1241 inline TInt CTextListItemDrawer::ItemMarkPosition() const { return iItemMarkPos; }
       
  1242 
       
  1243 inline void CTextListItemDrawer::SetItemMarkReplacement(const TDesC & aReplacement) { iItemMarkReplacement.Set(aReplacement); }
       
  1244 
       
  1245 inline TPtrC CTextListItemDrawer::ItemMarkReplacement() const { return iItemMarkReplacement; }
       
  1246 
       
  1247 inline void CTextListItemDrawer::SetItemMarkReverse(TBool aReverse) { iItemMarkReverse = aReverse; }
       
  1248 inline TBool CTextListItemDrawer::ItemMarkReverse() const { return iItemMarkReverse; }
       
  1249 
       
  1250 // END OF AVKON LAF 
       
  1251 
       
  1252 
       
  1253 
       
  1254 #endif  // __EIKLBI_H__
       
  1255 
       
  1256 // End of File