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 voidClearFlags(TInt)
IMPORT_C voidClearRect(const TRect &)
TRgb DimmedBackColor()
TRgb DimmedTextColor()
IMPORT_C voidDrawFrame(CWindowGc &, const TRect &, TInt)
IMPORT_C voidDrawItem(TInt, TPoint, TBool, TBool, TBool, TBool)
IMPORT_C voidDrawItemMark(TBool, TBool, const TPoint &)
TInt Flags()
IMPORT_C CFont *Font(TInt)
IMPORT_C CWindowGc *Gc()
TRgb HighlightedBackColor()
TRgb HighlightedTextColor()
IMPORT_C TSizeItemCellSize()
IMPORT_C TIntItemWidthInPixels(TInt)
IMPORT_C TIntMarkColumn()
IMPORT_C TIntMarkGutter()
IMPORT_C TIntMatcherCursorAscent(TInt)
IMPORT_C TRectMatcherCursorRect(const TDesC &, TInt, TInt, TInt)
IMPORT_C TSizeMinimumCellSize()
IMPORT_C TListItemPropertiesProperties(TInt)
voidSetBackColor(TRgb)
IMPORT_C voidSetData(CListBoxData *)
voidSetDimmedBackColor(TRgb)
voidSetDimmedTextColor(TRgb)
IMPORT_C voidSetDrawMark(TBool)
IMPORT_C voidSetFlags(TInt)
IMPORT_C voidSetGc(CWindowGc *)
voidSetHighlightedBackColor(TRgb)
voidSetHighlightedTextColor(TRgb)
IMPORT_C voidSetItemCellSize(const TSize &)
IMPORT_C voidSetMarkColumnWidth(TInt)
IMPORT_C voidSetMarkGutter(TInt)
IMPORT_C voidSetSkinEnabledL(TBool)
IMPORT_C voidSetSymbolFont(const CFont *)
voidSetTextColor(TRgb)
IMPORT_C voidSetVerticalInterItemGap(TInt)
IMPORT_C voidSetViewRect(const TRect &)
IMPORT_C MAknsControlContext *SkinBackgroundControlContext()
TRgb TextColor()
Protected Member Functions
CListItemDrawer()
voidDrawActualItem(TInt, const TRect &, TBool, TBool, TBool, TBool)
TRgb MarkColor()
IMPORT_C voidResetGc()
IMPORT_C voidSetupGc(TInt)
IMPORT_C TIntVerticalInterItemGap()
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
enumTFlags {
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
}
enumTListItemAttribute { 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_CCListItemDrawer()[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 voidClearFlags(TIntaFlags)

Sets the item drawer flags.

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

Parameters

TInt aFlagsThe new item drawer flags.

ClearRect(const TRect &)

IMPORT_C voidClearRect(const TRect &aRect)const [virtual]

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

Parameters

const TRect & aRectRectangle 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)

voidDrawActualItem(TIntaItemIndex,
const TRect &aActualItemRect,
TBoolaItemIsCurrent,
TBoolaViewIsEmphasized,
TBoolaViewIsDimmed,
TBoolaItemIsSelected
)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 aItemIndexWhich item to draw.
const TRect & aActualItemRectWhere the item should be drawn.
TBool aItemIsCurrentWhether the item is current.
TBool aViewIsEmphasizedWhether the list box view is emphasised.
TBool aViewIsDimmedWhether the list box view is dimmed.
TBool aItemIsSelectedWhether the list box item is selected.

DrawFrame(CWindowGc &, const TRect &, TInt)

IMPORT_C voidDrawFrame(CWindowGc &aGc,
const TRect &aRect,
TIntaFlags
)const

Draws the frame.

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

Parameters

CWindowGc & aGcThe graphics context used to draw the frame.
const TRect & aRectThe frame's rectangle.
TInt aFlagsThe item drawer flags.

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

IMPORT_C voidDrawItem(TIntaItemIndex,
TPointaItemRectPos,
TBoolaItemIsSelected,
TBoolaItemIsCurrent,
TBoolaViewIsEmphasized,
TBoolaViewIsDimmed
)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 aItemIndexIndex of the item to draw.
TPoint aItemRectPosPosition of the rectangle to draw.
TBool aItemIsSelectedWhether the item is selected.
TBool aItemIsCurrentWhether the item is current.
TBool aViewIsEmphasizedWhether the list box view has the emphasised flag set (see CListBoxView::SetEmphasized()).
TBool aViewIsDimmedWhether the list box view has its dimmed flag set (see CListBoxView::SetDimmed()).

DrawItemMark(TBool, TBool, const TPoint &)

IMPORT_C voidDrawItemMark(TBoolaItemIsSelected,
TBoolaViewIsDimmed,
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(TIntaItemIndex)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 aItemIndexThe 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 TSizeItemCellSize()const

Gets current item cell size.

Since
Symbian 3.0

ItemWidthInPixels(TInt)

IMPORT_C TIntItemWidthInPixels(TIntaItemIndex)const [virtual]

Gets the width of the specified item.

Parameters

TInt aItemIndexThe 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 TIntMarkColumn()const

Gets mark column width.

MarkGutter()

IMPORT_C TIntMarkGutter()const

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

MatcherCursorAscent(TInt)

IMPORT_C TIntMatcherCursorAscent(TIntaCurrentItemIndex)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 aCurrentItemIndexItem index of the target item.

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

IMPORT_C TRectMatcherCursorRect(const TDesC &aMatchableText,
TIntaCharPos,
TIntaItemCellYPos,
TIntaCurrentItemIndex
)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 & aMatchableTextThe text of the currently matched string.
TInt aCharPosThe position in the string of the character just matched in the current incremental match.
TInt aItemCellYPosY position of the item cell.
TInt aCurrentItemIndexItem index for the current item.

MinimumCellSize()

IMPORT_C TSizeMinimumCellSize()const [virtual]

Gets the minimum cell size.

Properties(TInt)

IMPORT_C TListItemPropertiesProperties(TIntaItemIndex)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 aItemIndexThe index of the item for which properties are obtained (Not Used).

Reserved_1()

IMPORT_C TAny *Reserved_1()[private, virtual]

ResetGc()

IMPORT_C voidResetGc()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)

voidSetBackColor(TRgbaColor)[inline]

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

Parameters

TRgb aColorThe background colour.

SetData(CListBoxData *)

IMPORT_C voidSetData(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 * aDataFont storage data .

SetDimmedBackColor(TRgb)

voidSetDimmedBackColor(TRgbaColor)[inline]

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

Parameters

TRgb aColorThe background colour for dimmed items.

SetDimmedTextColor(TRgb)

voidSetDimmedTextColor(TRgbaColor)[inline]

Sets the colour used to draw dimmed text.

Parameters

TRgb aColorThe dimmed text colour.

SetDrawMark(TBool)

IMPORT_C voidSetDrawMark(TBoolaDrawMark)

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 aDrawMarkNew value for iDrawMark.

SetFlags(TInt)

IMPORT_C voidSetFlags(TIntaFlags)

Sets the item drawer flags.

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

Parameters

TInt aFlagsThe new item drawer flags.

SetGc(CWindowGc *)

IMPORT_C voidSetGc(CWindowGc *aGc)[virtual]

Sets the graphics context which this object uses for drawing.

Parameters

CWindowGc * aGcPointer to the context to use.

SetHighlightedBackColor(TRgb)

voidSetHighlightedBackColor(TRgbaColor)[inline]

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

Parameters

TRgb aColorThe highlighted background colour.

SetHighlightedTextColor(TRgb)

voidSetHighlightedTextColor(TRgbaColor)[inline]

Sets the colour used to draw highlighted text.

Parameters

TRgb aColorThe highlighted text colour.

SetItemCellSize(const TSize &)

IMPORT_C voidSetItemCellSize(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 & aSizeInPixelsNew size for the item cell.

SetMarkColumnWidth(TInt)

IMPORT_C voidSetMarkColumnWidth(TIntaWidthInPixels)[virtual]

Sets the width of the column containing the mark.

Parameters

TInt aWidthInPixelsNew width for the mark column.

SetMarkGutter(TInt)

IMPORT_C voidSetMarkGutter(TIntaGapInPixels)[virtual]

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

Parameters

TInt aGapInPixelsNew gap size.

SetSkinEnabledL(TBool)

IMPORT_C voidSetSkinEnabledL(TBoolaEnabled)

Ability to enable skins in listboxes.

Since
S60 2.0

Parameters

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

SetSymbolFont(const CFont *)

IMPORT_C voidSetSymbolFont(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 * aFontThe font to be used.

SetTextColor(TRgb)

voidSetTextColor(TRgbaColor)[inline]

Sets the colour used to draw non-highlighted text.

Parameters

TRgb aColorThe text colour.

SetVerticalInterItemGap(TInt)

IMPORT_C voidSetVerticalInterItemGap(TIntaGapInPixels)

Sets the vertical gap between items in the list.

Parameters

TInt aGapInPixelsNew value for the vertical gap between items in pixels.

SetViewRect(const TRect &)

IMPORT_C voidSetViewRect(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 & aRectNew value for iViewRect.

SetupGc(TInt)

IMPORT_C voidSetupGc(TIntaItemIndex)const [protected]

Sets up the graphics context for the specified item.

Parameters

TInt aItemIndexThe 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 TIntVerticalInterItemGap()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.