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