CListItemDrawer Class Reference

class CListItemDrawer : public CBase

The CListItemDrawer class is the base class for the list box item drawers which handle drawing of the contents of list box items. The items may optionally be markable.

Since
Symbian 5.0

Inherits from

Public Member Functions
~CListItemDrawer ()
TRgb BackColor ()
IMPORT_C void ClearFlags ( TInt )
IMPORT_C void ClearRect (const TRect &)
TRgb DimmedBackColor ()
TRgb DimmedTextColor ()
IMPORT_C void DrawFrame ( CWindowGc &, const TRect &, TInt )
IMPORT_C void DrawItem ( TInt , TPoint , TBool , TBool , TBool , TBool )
IMPORT_C void DrawItemMark ( TBool , TBool , const TPoint &)
TInt Flags ()
IMPORT_C CFont * Font ( TInt )
IMPORT_C CWindowGc * Gc ()
TRgb HighlightedBackColor ()
TRgb HighlightedTextColor ()
IMPORT_C TSize ItemCellSize ()
IMPORT_C TInt ItemWidthInPixels ( TInt )
IMPORT_C TInt MarkColumn ()
IMPORT_C TInt MarkGutter ()
IMPORT_C TInt MatcherCursorAscent ( TInt )
IMPORT_C TRect MatcherCursorRect (const TDesC &, TInt , TInt , TInt )
IMPORT_C TSize MinimumCellSize ()
IMPORT_C TListItemProperties Properties ( TInt )
void SetBackColor ( TRgb )
IMPORT_C void SetData ( CListBoxData *)
void SetDimmedBackColor ( TRgb )
void SetDimmedTextColor ( TRgb )
IMPORT_C void SetDrawMark ( TBool )
IMPORT_C void SetFlags ( TInt )
IMPORT_C void SetGc ( CWindowGc *)
void SetHighlightedBackColor ( TRgb )
void SetHighlightedTextColor ( TRgb )
IMPORT_C void SetItemCellSize (const TSize &)
IMPORT_C void SetMarkColumnWidth ( TInt )
IMPORT_C void SetMarkGutter ( TInt )
IMPORT_C void SetSkinEnabledL ( TBool )
IMPORT_C void SetSymbolFont (const CFont *)
void SetTextColor ( TRgb )
IMPORT_C void SetVerticalInterItemGap ( TInt )
IMPORT_C void SetViewRect (const TRect &)
IMPORT_C MAknsControlContext * SkinBackgroundControlContext ()
TRgb TextColor ()
Protected Member Functions
CListItemDrawer ()
void DrawActualItem ( TInt , const TRect &, TBool , TBool , TBool , TBool )
TRgb MarkColor ()
IMPORT_C void ResetGc ()
IMPORT_C void SetupGc ( TInt )
IMPORT_C TInt VerticalInterItemGap ()
Private Member Functions
IMPORT_C TAny * Reserved_1 ()
const CFont * SymbolFont ()
const CFont *& SymbolFont ()
TInt & VerticalInterItemGap ()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TFlags {
EDrawMarkSelection  = 0x0001, EPaintedSelection  = 0x0002, EDrawOnlyActiveSelection  = 0x0004, EDisableHighlight  = 0x0008, EPressedDownState  = 0x0010, EDisableMarquee  = 0x0020, ESingleClickDisabledHighlight  = 0x0040, ESingleClickEnabled  = 0x0080, EDrawSmileyIcon  = 0x0100, EMarkingModeEnabled  = 0x0200, EDrawWholeBackground  = 0x0400, ENativeImplementation  = 0x0800, EBackgroundDrawn  = 0x1000
}
enum TListItemAttribute { ECurrent  = 0x0001, EEmphasized  = 0x0002, ESelected  = 0x0004, EMask  = 0x0007 }
Protected Attributes
TRgb iBackColor
CListBoxData * iData
TRgb iDimmedBackColor
TRgb iDimmedTextColor
TBool iDrawMark
CWindowGc * iGc
TRgb iHighlightedBackColor
TRgb iHighlightedTextColor
TSize iItemCellSize
TRgb iMarkColor
TInt iMarkColumnWidth
TInt iMarkGutter
TRgb iTextColor
TRect iViewRect
Private Attributes
TUint iFlags
TInt iSpare
const CFont * iSymbolFont
TInt iVerticalInterItemGap

Constructor & Destructor Documentation

CListItemDrawer()

IMPORT_C CListItemDrawer ( ) [protected]

C++ default constructor.

~CListItemDrawer()

IMPORT_C ~CListItemDrawer ( )

Destructor.

Member Functions Documentation

BackColor()

TRgb BackColor ( ) const [inline]

Gets the colour used to draw the background for non-highlighted items.

ClearFlags(TInt)

IMPORT_C void ClearFlags ( TInt aFlags )

Sets the item drawer flags.

Clears the item drawer flags aFlags, masking off all but the lower 3 bits.

Parameters

TInt aFlags The new item drawer flags.

ClearRect(const TRect &)

IMPORT_C void ClearRect ( const TRect & aRect ) const [virtual]

Clears the specified rectangle of this object's graphics context.

Parameters

const TRect & aRect Rectangle to clear.

DimmedBackColor()

TRgb DimmedBackColor ( ) const [inline]

Gets the colour used to draw the background for dimmed items.

DimmedTextColor()

TRgb DimmedTextColor ( ) const [inline]

Gets the colour used to draw dimmed text.

DrawActualItem(TInt, const TRect &, TBool, TBool, TBool, TBool)

void DrawActualItem ( TInt aItemIndex,
const TRect & aActualItemRect,
TBool aItemIsCurrent,
TBool aViewIsEmphasized,
TBool aViewIsDimmed,
TBool aItemIsSelected
) const [protected, pure virtual]

Draws item text.

This function is called by CListItemDrawer::DrawItem() with appropriate arguments. Its purpose is to draw the actual item
  • everything other than the item mark - into the graphics context.

Parameters

TInt aItemIndex Which item to draw.
const TRect & aActualItemRect Where the item should be drawn.
TBool aItemIsCurrent Whether the item is current.
TBool aViewIsEmphasized Whether the list box view is emphasised.
TBool aViewIsDimmed Whether the list box view is dimmed.
TBool aItemIsSelected Whether the list box item is selected.

DrawFrame(CWindowGc &, const TRect &, TInt)

IMPORT_C void DrawFrame ( CWindowGc & aGc,
const TRect & aRect,
TInt aFlags
) const

Draws the frame.

Uses the colours set with the fonts and colour functions described above.

Parameters

CWindowGc & aGc The graphics context used to draw the frame.
const TRect & aRect The frame's rectangle.
TInt aFlags The item drawer flags.

DrawItem(TInt, TPoint, TBool, TBool, TBool, TBool)

IMPORT_C void DrawItem ( TInt aItemIndex,
TPoint aItemRectPos,
TBool aItemIsSelected,
TBool aItemIsCurrent,
TBool aViewIsEmphasized,
TBool aViewIsDimmed
) const [virtual]

Draws the entire item.

This function is called by the list box view. As implemented in CListItemDrawer , this function draws the item text using DrawActualItem() , and an item mark using DrawItemMark() .

Parameters

TInt aItemIndex Index of the item to draw.
TPoint aItemRectPos Position of the rectangle to draw.
TBool aItemIsSelected Whether the item is selected.
TBool aItemIsCurrent Whether the item is current.
TBool aViewIsEmphasized Whether the list box view has the emphasised flag set (see CListBoxView::SetEmphasized()).
TBool aViewIsDimmed Whether the list box view has its dimmed flag set (see CListBoxView::SetDimmed()).

DrawItemMark(TBool, TBool, const TPoint &)

IMPORT_C void DrawItemMark ( TBool aItemIsSelected,
TBool aViewIsDimmed,
const TPoint & aMarkPos
) const [virtual]

Not Used in S60.

Parameters

TBool aItemIsSelected
TBool aViewIsDimmed
const TPoint & aMarkPos

Flags()

TInt Flags ( ) const [inline]

Gets the item drawer flags.

Font(TInt)

IMPORT_C CFont * Font ( TInt aItemIndex ) const

Gets the font for the specified item.

The function returns NULL if no font storage data has been set.

Returns the font for the item at index aItemIndex. Returns NULL if no font storage data has been set.

Since
ER5U

Parameters

TInt aItemIndex The index of the item for which the font is returned.

Gc()

IMPORT_C CWindowGc * Gc ( ) const

Gets graphics context which is used for drawing.

HighlightedBackColor()

TRgb HighlightedBackColor ( ) const [inline]

Gets the colour used to draw the background for highlighted items.

HighlightedTextColor()

TRgb HighlightedTextColor ( ) const [inline]

Gets the colour used to draw highlighted text.

ItemCellSize()

IMPORT_C TSize ItemCellSize ( ) const

Gets current item cell size.

Since
Symbian 3.0

ItemWidthInPixels(TInt)

IMPORT_C TInt ItemWidthInPixels ( TInt aItemIndex ) const [virtual]

Gets the width of the specified item.

Parameters

TInt aItemIndex The index of the item whose width is to be returned.

MarkColor()

TRgb MarkColor ( ) const [protected, inline]

Gets the colour used to draw tick marks.

A tick mark usually indicates that an item is selected.

MarkColumn()

IMPORT_C TInt MarkColumn ( ) const

Gets mark column width.

MarkGutter()

IMPORT_C TInt MarkGutter ( ) const

Gets the width of the gap between the column containig the lists item marks and the text column.

MatcherCursorAscent(TInt)

IMPORT_C TInt MatcherCursorAscent ( TInt aCurrentItemIndex ) const [virtual]

Gets the ascent of the matcher cursor.

This is obtained for the item at index aCurrentItemIndex . The function returns 0 by default.

Returns the ascent of the matcher cursor for the item at index aCurrentItemIndex determined from the ascent of the font used for that item.

Returns 0 by default.

Parameters

TInt aCurrentItemIndex Item index of the target item.

MatcherCursorRect(const TDesC &, TInt, TInt, TInt)

IMPORT_C TRect MatcherCursorRect ( const TDesC & aMatchableText,
TInt aCharPos,
TInt aItemCellYPos,
TInt aCurrentItemIndex
) const [virtual]

Gets a rectangle describing where the matcher cursor should be drawn. The default behavious is to return uninitialised TRect .

Returns the rectangle occupied by the matcher cursor in the text aMatchableText. The pixel position of the rectangle is determined by specifying the character position of the cursor in the text aCharPos and the vertical position of the item cell aItemCellYPos. The size of the rectangle can be determined by giving the index of the current item aCurrentItemIndex.

Returns the rectangle occupied by the item drawer by default.

Parameters

const TDesC & aMatchableText The text of the currently matched string.
TInt aCharPos The position in the string of the character just matched in the current incremental match.
TInt aItemCellYPos Y position of the item cell.
TInt aCurrentItemIndex Item index for the current item.

MinimumCellSize()

IMPORT_C TSize MinimumCellSize ( ) const [virtual]

Gets the minimum cell size.

Properties(TInt)

IMPORT_C TListItemProperties Properties ( TInt aItemIndex ) const [virtual]

Gets the colour and style properties of the specified item.

Returns the properties of the item at index aItemIndex.

Since
ER5U

Parameters

TInt aItemIndex The index of the item for which properties are obtained (Not Used).

Reserved_1()

IMPORT_C TAny * Reserved_1 ( ) [private, virtual]

ResetGc()

IMPORT_C void ResetGc ( ) const [protected, virtual]

Resets the pen style, brush style, brush colour etc. to suitable starting values for this class.

This function is called after every drawing operation.

SetBackColor(TRgb)

void SetBackColor ( TRgb aColor ) [inline]

Sets the colour used to draw the background for non-highlighted items.

Parameters

TRgb aColor The background colour.

SetData(CListBoxData *)

IMPORT_C void SetData ( CListBoxData * aData )

Sets the font storage data for the item drawer and transfer ownership of that data.

Sets the font storage data for the item drawer to aFontStorage and transfers ownership.

Since
ER5U

Parameters

CListBoxData * aData Font storage data .

SetDimmedBackColor(TRgb)

void SetDimmedBackColor ( TRgb aColor ) [inline]

Sets the colour used to draw the background for dimmed items.

Parameters

TRgb aColor The background colour for dimmed items.

SetDimmedTextColor(TRgb)

void SetDimmedTextColor ( TRgb aColor ) [inline]

Sets the colour used to draw dimmed text.

Parameters

TRgb aColor The dimmed text colour.

SetDrawMark(TBool)

IMPORT_C void SetDrawMark ( TBool aDrawMark )

Sets whether item tick marks are drawn.

If the draw mark flag iDrawMark is set, DrawItem() leaves space for the marks column to the left of the text column, and DrawItemMark() draws the item marks.

Parameters

TBool aDrawMark New value for iDrawMark.

SetFlags(TInt)

IMPORT_C void SetFlags ( TInt aFlags )

Sets the item drawer flags.

Sets the item drawer flags to aFlags, masking off all but the lower 3 bits.

Parameters

TInt aFlags The new item drawer flags.

SetGc(CWindowGc *)

IMPORT_C void SetGc ( CWindowGc * aGc ) [virtual]

Sets the graphics context which this object uses for drawing.

Parameters

CWindowGc * aGc Pointer to the context to use.

SetHighlightedBackColor(TRgb)

void SetHighlightedBackColor ( TRgb aColor ) [inline]

Sets the colour used to draw the background for highlighted items.

Parameters

TRgb aColor The highlighted background colour.

SetHighlightedTextColor(TRgb)

void SetHighlightedTextColor ( TRgb aColor ) [inline]

Sets the colour used to draw highlighted text.

Parameters

TRgb aColor The highlighted text colour.

SetItemCellSize(const TSize &)

IMPORT_C void SetItemCellSize ( const TSize & aSizeInPixels ) [virtual]

Sets the item cell size. The cell size is the on-screen size of the entire item, including its text and its item mark.

Parameters

const TSize & aSizeInPixels New size for the item cell.

SetMarkColumnWidth(TInt)

IMPORT_C void SetMarkColumnWidth ( TInt aWidthInPixels ) [virtual]

Sets the width of the column containing the mark.

Parameters

TInt aWidthInPixels New width for the mark column.

SetMarkGutter(TInt)

IMPORT_C void SetMarkGutter ( TInt aGapInPixels ) [virtual]

Sets the width of the gap between the column containing the lists item marks and the text column.

Parameters

TInt aGapInPixels New gap size.

SetSkinEnabledL(TBool)

IMPORT_C void SetSkinEnabledL ( TBool aEnabled )

Ability to enable skins in listboxes.

Since
S60 2.0

Parameters

TBool aEnabled parameter for enabling/disabling skin. ETrue enables skin, EFalse disables skin

SetSymbolFont(const CFont *)

IMPORT_C void SetSymbolFont ( const CFont * aFont )

Sets symbol font for the item drawer. The symbol font is used to draw the standard tick item marks.

Parameters

const CFont * aFont The font to be used.

SetTextColor(TRgb)

void SetTextColor ( TRgb aColor ) [inline]

Sets the colour used to draw non-highlighted text.

Parameters

TRgb aColor The text colour.

SetVerticalInterItemGap(TInt)

IMPORT_C void SetVerticalInterItemGap ( TInt aGapInPixels )

Sets the vertical gap between items in the list.

Parameters

TInt aGapInPixels New value for the vertical gap between items in pixels.

SetViewRect(const TRect &)

IMPORT_C void SetViewRect ( const TRect & aRect ) [virtual]

Sets the viewing rectangle for this item drawer. This value is not used by the CListItemViewer , but may be used by its derived classes.

Parameters

const TRect & aRect New value for iViewRect.

SetupGc(TInt)

IMPORT_C void SetupGc ( TInt aItemIndex ) const [protected]

Sets up the graphics context for the specified item.

Parameters

TInt aItemIndex The item for which the graphics context will be set up.

SkinBackgroundControlContext()

IMPORT_C MAknsControlContext * SkinBackgroundControlContext ( ) const

Access to skin contexts.

Since
S60 2.0

SymbolFont()

const CFont * SymbolFont ( ) const [private, inline]

SymbolFont()

const CFont *& SymbolFont ( ) [private, inline]

TextColor()

TRgb TextColor ( ) const [inline]

Gets the colour used to draw non-highlighted text.

VerticalInterItemGap()

IMPORT_C TInt VerticalInterItemGap ( ) const [protected]

Gets the vertical gap between items in pixels.

VerticalInterItemGap()

TInt & VerticalInterItemGap ( ) [private, inline]

Member Enumerations Documentation

Enum TFlags

Provides list box attributes for handling multiple selections. These flags can be set using the CListItemDrawer::SetFlags function.

Enumerators

EDrawMarkSelection = 0x0001

If set, specifies the inclusion of a gap into which a tick mark can be drawn if the item is selected. This is used in the following CListItemDrawer class functions: DrawItem() , DrawItemMark() , SetDrawMark()

EPaintedSelection = 0x0002

If set, draws a highlight over a selected list item. This is used in the CTextListItemDrawer::DoDrawItemText() function.

EDrawOnlyActiveSelection = 0x0004

This flag is not supported.

EDisableHighlight = 0x0008

If set highlight is disabled.

EPressedDownState = 0x0010

This flag indicates CListboxData to draw pressed down state rather than normal highlight on item. Make sure checking this flag in subclass's Draw method, if using a custom CListboxData inheriting from CColumnListBoxData or CFormattedCellListBoxData .

EDisableMarquee = 0x0020

This flag indicates the marquee is disabled. If it is set, CColumnListBoxData or CFormattedCellListBoxData would disable maquee temporarily for performance reason.

ESingleClickDisabledHighlight = 0x0040

This flag indicates that highlight is disabled in list because of single click style.

ESingleClickEnabled = 0x0080

This flag indicates that single click mode is enabled.

EDrawSmileyIcon = 0x0100

This flag indicates that simley icon is enabled.

EMarkingModeEnabled = 0x0200

This flag indicates that marking mode is enabled.

EDrawWholeBackground = 0x0400

If set then itemdrawer draws the whole list area's background in one frame while scrolling. Normally background is drawn separately for each list item.

ENativeImplementation = 0x0800

Always set unless client application has implemented a custom item drawer that overrides background drawing code.

EBackgroundDrawn = 0x1000

This flag is used during scrolling to indicate that background has been already drawn.

Enum TListItemAttribute

Provides attributes for list items

Enumerators

ECurrent = 0x0001

Highlight for current text.

EEmphasized = 0x0002

Highlight for text when the listbox view is emphasized.

This is used in the following CListBoxView class functions: DrawItem() , DrawMatcherCursor() , SetEmphasized() .

ESelected = 0x0004

Highlight for text that is selected. This is used in the following functions: CColumnListBoxItemDrawer::DrawItemText() , CHierarchicalListItemDrawer::DrawActualItem() , CDirContentsListItemDrawer::DrawActualItem() .

EMask = 0x0007

Sum of all the above attributes. This last attribute is used to control that one can use only valid attributes above. So do not use it at all.

Member Data Documentation

TRgb iBackColor

TRgb iBackColor [protected]

Background color.

CListBoxData * iData

CListBoxData * iData [protected]

Data model.

TRgb iDimmedBackColor

TRgb iDimmedBackColor [protected]

Color of dimmed background.

TRgb iDimmedTextColor

TRgb iDimmedTextColor [protected]

Color of dimmed text.

TBool iDrawMark

TBool iDrawMark [protected]

Draw mark.

TUint iFlags

TUint iFlags [private]

CWindowGc * iGc

CWindowGc * iGc [protected]

Graphics context controller.

TRgb iHighlightedBackColor

TRgb iHighlightedBackColor [protected]

Highlighted background color.

TRgb iHighlightedTextColor

TRgb iHighlightedTextColor [protected]

Color of highlighted text.

TSize iItemCellSize

TSize iItemCellSize [protected]

Item's cell size.

TRgb iMarkColor

TRgb iMarkColor [protected]

Mark color.

TInt iMarkColumnWidth

TInt iMarkColumnWidth [protected]

Mark column width.

TInt iMarkGutter

TInt iMarkGutter [protected]

Mark gutter.

TInt iSpare

TInt iSpare [private]

const CFont * iSymbolFont

const CFont * iSymbolFont [private]

TRgb iTextColor

TRgb iTextColor [protected]

Color of text.

TInt iVerticalInterItemGap

TInt iVerticalInterItemGap [private]

TRect iViewRect

TRect iViewRect [protected]

View area.