TLogicalRgb Class Reference

class TLogicalRgb : public TRgb

Provides support for system colours, in addition to literal colours, in text formatting.

The base class TRgb stores the 24-bit literal colour value using a TUint32. TLogicalRgb uses the MSB from iValue2 data member as an 8-bit index. The purpose of the index is to allow applications to use logical colours. If the index is zero, the value is not a logical colour; it is treated as an ordinary TRgb value. If the index is non zero (1-255), the colour should be translated by the application into a system colour. Indices 254 and 255 are reserved for the system foreground and background colours, respectively and should be translated into them. Translation from index to RGB colour occurs in the implementation of MFormParam::SystemColor().

All colours in the Text and Text Attributes API are stored using TLogicalRgb values and are initialised to either TLogicalRgb::ESystemForegroundColor or TLogicalRgb::ESystemBackgroundColor .

This system allows an application to set its text colours once, perhaps using the system-wide colour scheme, rather than having to set the colours each time a text object is created. It is also compatible with legacy code which expects TRgb rather than TLogicalRgb values: for example, the logical foreground and background colours have their bottom three bytes filled with black and white respectively so that code which expects TRgb values can still use them.

Inherits from

Public Member Functions
TLogicalRgb ()
TLogicalRgb ( TUint32 )
TLogicalRgb ( TSystemColor )
TLogicalRgb (const TRgb &)
void SetSystemColorIndex ( TUint )
TUint SystemColorIndex ()
Inherited Functions
TRgb::Alpha()const
TRgb::Blue()const
TRgb::Color16()const
TRgb::Color16(TInt)
TRgb::Color16M()const
TRgb::Color16M(TInt)
TRgb::Color16MA()const
TRgb::Color16MA(TUint)
TRgb::Color16MAP()const
TRgb::Color16MAP(TUint)
TRgb::Color16MU()const
TRgb::Color16MU(TInt)
TRgb::Color256()const
TRgb::Color256(TInt)
TRgb::Color4K()const
TRgb::Color4K(TInt)
TRgb::Color64K()const
TRgb::Color64K(TInt)
TRgb::Difference(const TRgb &)const
TRgb::ExternalizeL(RWriteStream &)const
TRgb::Gray16()const
TRgb::Gray16(TInt)
TRgb::Gray2()const
TRgb::Gray2(TInt)
TRgb::Gray256()const
TRgb::Gray256(TInt)
TRgb::Gray4()const
TRgb::Gray4(TInt)
TRgb::Green()const
TRgb::Internal()const
TRgb::InternalizeL(RReadStream &)
TRgb::Red()const
TRgb::SetAlpha(TInt)
TRgb::SetBlue(TInt)
TRgb::SetGreen(TInt)
TRgb::SetInternal(TUint32)
TRgb::SetRed(TInt)
TRgb::TRgb()
TRgb::TRgb(TInt,TInt,TInt)
TRgb::TRgb(TInt,TInt,TInt,TInt)
TRgb::TRgb(TUint32)
TRgb::TRgb(TUint32,TInt)
TRgb::Value()const
TRgb::_Color16M()const
TRgb::_Color16M(TInt)
TRgb::_Color16MA()const
TRgb::_Color16MA(TUint)
TRgb::_Color16MAP()const
TRgb::_Color16MAP(TUint)
TRgb::_Color16MU()const
TRgb::_Color16MU(TInt)
TRgb::_Color4K()const
TRgb::_Color4K(TInt)
TRgb::_Color64K()const
TRgb::_Color64K(TInt)
TRgb::_Gray16()const
TRgb::_Gray16(TInt)
TRgb::_Gray2()const
TRgb::_Gray2(TInt)
TRgb::_Gray256()const
TRgb::_Gray256(TInt)
TRgb::_Gray4()const
TRgb::_Gray4(TInt)
TRgb::operator!=(const TRgb &)const
TRgb::operator&(const TRgb &)
TRgb::operator&=(const TRgb &)
TRgb::operator==(const TRgb &)const
TRgb::operator^(const TRgb &)
TRgb::operator^=(const TRgb &)
TRgb::operator|(const TRgb &)
TRgb::operator|=(const TRgb &)
TRgb::operator~()const
Public Member Enumerations
enum anonymous { ESystemSelectionForegroundIndex  = 252, ESystemSelectionBackgroundIndex  = 253, ESystemForegroundIndex  = 254, ESystemBackgroundIndex  = 255 }
enum TSystemColor { ESystemSelectionForegroundColor  = ESystemSelectionForegroundIndex << 24, ESystemSelectionBackgroundColor  = ESystemSelectionBackgroundIndex << 24, ESystemForegroundColor  = ESystemForegroundIndex << 24, ESystemBackgroundColor  = (ESystemBackgroundIndex << 24) | 0xFFFFFF }
Private Attributes
TUint32 iValue2

Constructor & Destructor Documentation

TLogicalRgb()

TLogicalRgb ( ) [inline]

Constructs a new TLogicalRgb object.

TLogicalRgb(TUint32)

TLogicalRgb ( TUint32 aValue ) [inline]

Constructs the object with a 32-bit integer. The index is stored in the MSB of iValue2 data member. A TRgb value may be stored in the base TRgb class.

Parameters

TUint32 aValue Integer holding the logical colour index.

TLogicalRgb(TSystemColor)

TLogicalRgb ( TSystemColor aValue ) [inline]

Constructs the object with a TSystemColor value.

Parameters

TSystemColor aValue Identifies whether the colour is the system foreground or system background colour.

TLogicalRgb(const TRgb &)

TLogicalRgb ( const TRgb & aRgb ) [inline]

Constructs a new TLogicalRgb object from an existing one.

Parameters

const TRgb & aRgb

Member Functions Documentation

SetSystemColorIndex(TUint)

void SetSystemColorIndex ( TUint aIndex ) [inline]

Sets the logical colour's index value.

Parameters

TUint aIndex The new index value (between 1 and 253 inclusive).

SystemColorIndex()

TUint SystemColorIndex ( ) const [inline]

Returns the logical colour's index value. Zero indicates that the value is not a logical colour; it is an ordinary TRgb value. 254 and 255 indicate the system foreground and background colours, respectively.

Member Enumerations Documentation

Enum anonymous

Enumerators

ESystemSelectionForegroundIndex = 252
ESystemSelectionBackgroundIndex = 253
ESystemForegroundIndex = 254

Index reserved for the system foreground colour (=254).

ESystemBackgroundIndex = 255

Index reserved for the system background colour (=255).

Enum TSystemColor

Used to construct TLogicalRgb objects which should use either the system foreground or background colour.

Enumerators

ESystemSelectionForegroundColor = ESystemSelectionForegroundIndex << 24
ESystemSelectionBackgroundColor = ESystemSelectionBackgroundIndex << 24
ESystemForegroundColor = ESystemForegroundIndex << 24

The system foreground colour.

ESystemBackgroundColor = (ESystemBackgroundIndex << 24) | 0xFFFFFF

The system background colour.

Member Data Documentation

TUint32 iValue2

TUint32 iValue2 [private]