Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: frmparam.h
Link against:

Class MFormParam

MFormParam

Support

Supported from 6.0

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.

Defined in MFormParam:
Get(), Set(), SystemColor()

See also:


Colour translation


SystemColor()

virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const = 0;

Description

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:

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.

Parameters

TUint aColorIndex

Logical colour index. Between 1 and 255 inclusive.

TRgb aDefaultColor

The 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).

Return value

TRgb

The physical colour which maps to the logical colour index.


Set()

static void Set(const MFormParam* aParam);

Description

Sets the thread-local storage to aParam.

Parameters

const MFormParam* aParam

Pointer to the MFormParam implementation, or NULL, to cancel using system colours.


Get()

static const MFormParam* Get();

Description

Gets the thread-local storage value.

Return value

MFormParam*

Pointer to the MFormParam implementation.