epoc32/include/frmparam.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
williamr@2
     1
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     2
// All rights reserved.
williamr@2
     3
// This component and the accompanying materials are made available
williamr@2
     4
// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
williamr@2
     5
// which accompanies this distribution, and is available
williamr@2
     6
// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
williamr@2
     7
//
williamr@2
     8
// Initial Contributors:
williamr@2
     9
// Nokia Corporation - initial contribution.
williamr@2
    10
//
williamr@2
    11
// Contributors:
williamr@2
    12
//
williamr@2
    13
// Description:
williamr@2
    14
// FORM global parameters; held in thread-local storage.
williamr@2
    15
// 
williamr@2
    16
//
williamr@2
    17
williamr@2
    18
#ifndef __FRMPARAM_H__
williamr@2
    19
#define __FRMPARAM_H__
williamr@2
    20
williamr@2
    21
#include <gdi.h>
williamr@2
    22
williamr@2
    23
williamr@2
    24
/** 
williamr@2
    25
Specifies the protocol for getting system colours for use in text views. A
williamr@2
    26
class which implements this protocol allows an application (or a thread,
williamr@2
    27
because a pointer to the object is held in thread-local storage) to use system
williamr@2
    28
colours in text views.
williamr@2
    29
williamr@2
    30
You should create an object of an MFormParam-derived class which implements the
williamr@2
    31
SystemColor() function. Then, pass a pointer to the object to the static
williamr@2
    32
function MFormParam::Set(). The MFormParam-derived object is owned by the
williamr@2
    33
caller of Set(). When system colours are no longer needed, you should cancel
williamr@2
    34
them by calling MFormParam::Set(NULL). It is the caller's responsibility to
williamr@2
    35
cause the text view to be redrawn after system colours are changed.
williamr@2
    36
williamr@2
    37
CTextLayout uses the colour translation function SystemColor() (if an
williamr@2
    38
MFormParam-derived object is present) to set the pen and brush colours for
williamr@2
    39
drawing components of the text view. It calls MFormParam::Get() before each
williamr@2
    40
draw. This enables an application to introduce system colours, change the
williamr@2
    41
parameter object, or abolish system colours, and redraw everything correctly;
williamr@2
    42
no information is left over from the last draw.
williamr@2
    43
@publishedAll
williamr@2
    44
@released
williamr@2
    45
*/
williamr@2
    46
class MFormParam
williamr@2
    47
williamr@2
    48
	{
williamr@2
    49
	public:
williamr@2
    50
williamr@2
    51
	/** Translates 8-bit logical colour indices to physical colours pure
williamr@2
    52
	virtual function.
williamr@2
    53
williamr@2
    54
	The colour index is stored in a TLogicalRgb object and is returned by
williamr@2
    55
	TLogicalRgb::SystemColorIndex().
williamr@2
    56
williamr@2
    57
	There are three reserved index values:
williamr@2
    58
williamr@2
    59
	Zero means the logical colour does not map to a system colour: the logical
williamr@2
    60
	colour is in fact an ordinary TRgb. This function should not normally be
williamr@2
    61
	called with this value.
williamr@2
    62
williamr@2
    63
	254 and 255 are default foreground and background colours respectively, and
williamr@2
    64
	should be converted to the GUI's standard foreground and background colours
williamr@2
    65
williamr@2
    66
	The values 1-253 are reserved for the use of the GUI and can be interpreted
williamr@2
    67
	as convenient. These can be interpreted as
williamr@2
    68
	TLogicalColor::EColorWindowBackground upward; this mapping can be done by
williamr@2
    69
	subtracting one from the index number aColorIndex.
williamr@2
    70
williamr@2
    71
	@param aColorIndex Logical colour index. Between 1 and 255 inclusive.
williamr@2
    72
	@param aDefaultColor The default colour. This is the colour to be used if
williamr@2
    73
	no translation is performed. This allows translation to change certain
williamr@2
    74
	indices but not others, (by passing the default colour back unchanged).
williamr@2
    75
	@return The physical colour which maps to the logical colour index. */
williamr@2
    76
	virtual TRgb SystemColor(TUint aColorIndex,TRgb aDefaultColor) const = 0;
williamr@2
    77
	IMPORT_C virtual void Reserved();
williamr@2
    78
	IMPORT_C static void Set(const MFormParam* aParam);
williamr@2
    79
	IMPORT_C static const MFormParam* Get();
williamr@2
    80
	};
williamr@2
    81
williamr@2
    82
#endif // __FRMPARAM_H__