Location:
frmparam.h
Link against:
MFormParam
Supported from 6.0
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()
virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const = 0;
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
.
|
|
static void Set(const MFormParam* aParam);
Sets the thread-local storage to
aParam
.
|
static const MFormParam* Get();
Gets the thread-local storage value.
|