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