MFormParam Class Reference

#include <frmparam.h>

class MFormParam
Public Member Functions
IMPORT_C const MFormParam *Get()
virtual IMPORT_C voidReserved()
IMPORT_C voidSet(const MFormParam *)
pure virtual TRgb SystemColor(TUint, TRgb)

Detailed Description

Specifies the protocol for getting system colours for use in text views. A class which implements this protocol allows an application (or a thread, because a pointer to the object is held in thread-local storage) to use system colours in text views.

You should create an object of an MFormParam-derived class which implements the SystemColor() function. Then, pass a pointer to the object to the static function MFormParam::Set(). The MFormParam-derived object is owned by the caller of Set(). When system colours are no longer needed, you should cancel them by calling MFormParam::Set(NULL). It is the caller's responsibility to cause the text view to be redrawn after system colours are changed.

CTextLayout uses the colour translation function SystemColor() (if an MFormParam-derived object is present) to set the pen and brush colours for drawing components of the text view. It calls MFormParam::Get() before each draw. This enables an application to introduce system colours, change the parameter object, or abolish system colours, and redraw everything correctly; no information is left over from the last draw.

Member Function Documentation

Get ( )

IMPORT_C const MFormParam *Get()[static]

Gets the thread-local storage value.

Returns: Pointer to the MFormParam implementation.

Reserved ( )

IMPORT_C voidReserved()[virtual]

Set ( const MFormParam * )

IMPORT_C voidSet(const MFormParam *aParam)[static]

Sets the thread-local storage to aParam.

ParameterDescription
aParamPointer to the MFormParam implementation, or null, to cancel using system colours.

SystemColor ( TUint, TRgb )

TRgb SystemColor(TUintaColorIndex,
TRgbaDefaultColor
)const [pure virtual]

Translates 8-bit logical colour indices to physical colours pure virtual function.

The colour index is stored in a TLogicalRgb object and is returned by TLogicalRgb::SystemColorIndex().

There are three reserved index values:

Zero means the logical colour does not map to a system colour: the logical colour is in fact an ordinary TRgb. This function should not normally be called with this value.

254 and 255 are default foreground and background colours respectively, and should be converted to the GUI's standard foreground and background colours

The values 1-253 are reserved for the use of the GUI and can be interpreted as convenient. These can be interpreted as TLogicalColor::EColorWindowBackground upward; this mapping can be done by subtracting one from the index number aColorIndex.

ParameterDescription
aColorIndexLogical colour index. Between 1 and 255 inclusive.
aDefaultColorThe default colour. This is the colour to be used if no translation is performed. This allows translation to change certain indices but not others, (by passing the default colour back unchanged).

Returns: The physical colour which maps to the logical colour index.