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