1 gulcolor.h |
1 // Copyright (c) 1997-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 // |
|
15 |
|
16 #if !defined(__GULCOLOR_H__) |
|
17 #define __GULCOLOR_H__ |
|
18 |
|
19 #if !defined(__W32STD_H__) |
|
20 #include <w32std.h> |
|
21 #endif |
|
22 |
|
23 #if !defined(__E32BASE_H__) |
|
24 #include <e32base.h> |
|
25 #endif |
|
26 |
|
27 #if !defined(__GDI_H__) |
|
28 #include <gdi.h> |
|
29 #endif |
|
30 |
|
31 /** Logical colours. |
|
32 |
|
33 Logical colours are used to specify the colour scheme for the controls in |
|
34 an application. |
|
35 |
|
36 Many controls have one logical colour for text and another logical colour |
|
37 for the background. Some logical colours have a dimmed variant for when the |
|
38 control becomes inactive or disabled. Highlighted and pressed variants exist |
|
39 for controls that support selection or which can be pressed. |
|
40 |
|
41 @publishedAll |
|
42 @released */ |
|
43 enum TLogicalColor |
|
44 { |
|
45 // Windows |
|
46 /** The colour of a window's background. */ |
|
47 EColorWindowBackground, |
|
48 /** The colour of text in a window. */ |
|
49 EColorWindowText, |
|
50 // Controls |
|
51 /** The colour of the background contents of a control. */ |
|
52 EColorControlBackground, |
|
53 /** The colour of the text inside a control. */ |
|
54 EColorControlText, |
|
55 /** The background colour of a control's border. */ |
|
56 EColorControlSurroundBackground, |
|
57 /** The colour of text in a control's border. */ |
|
58 EColorControlSurroundText, |
|
59 /** The colour of a control's background when highlighted for selection. */ |
|
60 EColorControlHighlightBackground, |
|
61 /** The colour of the text in a control when highlighted for selection. */ |
|
62 EColorControlHighlightText, |
|
63 /** The colour of a control's background when dimmed. */ |
|
64 EColorControlDimmedBackground, |
|
65 /** The colour of the text in a control when dimmed. */ |
|
66 EColorControlDimmedText, |
|
67 /** The colour of a control's background when dimmed and highlighted for selection. */ |
|
68 EColorControlDimmedHighlightBackground, |
|
69 /** The colour of the text in a control when dimmed and highlighted for selection. */ |
|
70 EColorControlDimmedHighlightText, |
|
71 // Dialogs |
|
72 /** The colour of a dialog's background. */ |
|
73 EColorDialogBackground, |
|
74 /** The colour of text inside a dialog. */ |
|
75 EColorDialogText, |
|
76 /** A dialog title's background colour. */ |
|
77 EColorDialogTitle, |
|
78 /** A dialog title's background colour when pressed. */ |
|
79 EColorDialogTitlePressed, |
|
80 /** The text colour in a dialog's title. */ |
|
81 EColorDialogTitleText, |
|
82 /** The text colour in a dialog's title when pressed. */ |
|
83 EColorDialogTitleTextPressed, |
|
84 // Menus |
|
85 /** The colour of the menubar's background. */ |
|
86 EColorMenubarBackground, |
|
87 /** The colour of text in the menubar. */ |
|
88 EColorMenubarText, |
|
89 /** The colour of the menubar title's background. */ |
|
90 EColorMenubarTitleBackground, |
|
91 /** The colour of text in the menubar title. */ |
|
92 EColorMenubarTitleText, |
|
93 /** The colour of the menu pane background. */ |
|
94 EColorMenuPaneBackground, |
|
95 /** The colour of text in the menu pane. */ |
|
96 EColorMenuPaneText, |
|
97 /** The colour of the menu pane background when highlighted for selection. */ |
|
98 EColorMenuPaneHighlight, |
|
99 /** The colour of text in the menu pane when highlighted for selection. */ |
|
100 EColorMenuPaneTextHighlight, |
|
101 /** The colour of the menu pane background when dimmed and highlighted. */ |
|
102 EColorMenuPaneDimmedHighlight, |
|
103 /** The colour of text in the menu pane when dimmed. */ |
|
104 EColorMenuPaneDimmedText, |
|
105 /** The colour of text in the menu pane when dimmed and highlighted for selection. */ |
|
106 EColorMenuPaneDimmedTextHighlight, |
|
107 // Command buttons |
|
108 /** The colour of the button background, when the button is in the unset state. */ |
|
109 EColorButtonFaceClear, |
|
110 /** The colour of the button background when the button is in the set state. */ |
|
111 EColorButtonFaceSet, |
|
112 /** The colour of the button background when the button is in the set state and |
|
113 is pressed. */ |
|
114 EColorButtonFaceSetPressed, |
|
115 /** The colour of the button background when the button is in the unset state and |
|
116 is pressed. */ |
|
117 EColorButtonFaceClearPressed, |
|
118 /** The colour of the button text. */ |
|
119 EColorButtonText, |
|
120 /** The colour of the button text when the button is pressed. */ |
|
121 EColorButtonTextPressed, |
|
122 /** The colour of the button text when the button is dimmed. */ |
|
123 EColorButtonTextDimmed, |
|
124 // Message windows |
|
125 /** The colour of the message window foreground. */ |
|
126 EColorMsgWinForeground, |
|
127 EColorMsgWinBackground, |
|
128 // Scrollbars |
|
129 /** The colour of the scroll bar border. */ |
|
130 EColorScrollBarBorder, |
|
131 EColorScrollBarShaft, |
|
132 /** The colour of the scroll bar shaft background when dimmed. */ |
|
133 EColorScrollBarShaftDimmed, |
|
134 /** The colour of the scroll bar shaft background when pressed. */ |
|
135 EColorScrollBarShaftPressed, |
|
136 /** The colour of the background for scroll bars with no thumb and no shaft. */ |
|
137 EColorScrollBarNoShaftOrThumb, |
|
138 /** The colour of scroll bar buttons. */ |
|
139 EColorScrollButtonIcon, |
|
140 /** The colour of scroll bar buttons when pressed. */ |
|
141 EColorScrollButtonIconPressed, |
|
142 /** The colour of scroll bar buttons when dimmed. */ |
|
143 EColorScrollButtonIconDimmed, |
|
144 /** The colour of a scroll bar thumb's background. */ |
|
145 EColorScrollButtonThumbBackground, |
|
146 /** The colour of a scroll bar thumb's background when pressed. */ |
|
147 EColorScrollButtonThumbBackgroundPressed, |
|
148 /** The colour of a scroll bar thumb's background when dimmed. */ |
|
149 EColorScrollThumbDimmed, |
|
150 /** The colour of a scroll bar thumb's edge. */ |
|
151 EColorScrollThumbEdge, |
|
152 // Toolbars |
|
153 /** The colour of a toolbar's background. */ |
|
154 EColorToolbarBackground, |
|
155 /** The colour of the text in a toolbar. */ |
|
156 EColorToolbarText, |
|
157 // Status pane |
|
158 /** The colour of a status pane's background. */ |
|
159 EColorStatusPaneBackground, |
|
160 /** The colour of the text in a status pane. */ |
|
161 EColorStatusPaneText, |
|
162 // Labels |
|
163 /** The colour of the text in a label. */ |
|
164 EColorLabelText, |
|
165 /** The colour of emphasised text in a label. */ |
|
166 EColorLabelTextEmphasis, |
|
167 /** The colour of the text in a label when dimmed. */ |
|
168 EColorLabelDimmedText, |
|
169 /** The colour of the label background when highlighted and dimmed. */ |
|
170 EColorLabelHighlightPartialEmphasis, |
|
171 /** The colour of the label background when highlighted. */ |
|
172 EColorLabelHighlightFullEmphasis, |
|
173 /** The number of logical colours */ |
|
174 EColorNumberOfLogicalColors |
|
175 }; |
|
176 |
|
177 class RReadStream; |
|
178 class RWriteStream; |
|
179 class CColorArray; |
|
180 |
|
181 // not available before Release 005 |
|
182 |
|
183 class CColorList : public CBase |
|
184 /** A palette that maps logical colours (TLogicalColor) to physical (TRgb) values. It |
|
185 also supports independent sections for applications: a section is identified by an |
|
186 application UID, and the mappings are held as a colour array (CColorArray). |
|
187 |
|
188 A colour list also supports mapping for both four-grey and 256-colour schemes; the |
|
189 256-colour scheme will be used and will look good if the screen mode supports 16 or |
|
190 more colours. Otherwise, the four-grey scheme will be used. |
|
191 |
|
192 @publishedAll |
|
193 @released */ |
|
194 { |
|
195 public: |
|
196 IMPORT_C static CColorList* NewL(CArrayFix<TRgb>* aColors); |
|
197 IMPORT_C ~CColorList(); |
|
198 // Accessors |
|
199 IMPORT_C TRgb Color(TLogicalColor aColor) const; |
|
200 IMPORT_C TInt Count() const; |
|
201 IMPORT_C TRgb Color(TUid aApp,TInt aColor) const; |
|
202 IMPORT_C CColorArray* ColorArray(TUid aApp) const; |
|
203 IMPORT_C TBool ContainsColorArray(TUid aApp) const; |
|
204 // Manipulators |
|
205 IMPORT_C void SetColor(TLogicalColor aLogicalColor,TRgb aColor); |
|
206 IMPORT_C void AddColorArrayL(TUid aApp,CColorArray* aArray); // takes ownership |
|
207 IMPORT_C void DeleteColorArray(TUid aApp); |
|
208 public: |
|
209 IMPORT_C static CColorList* NewLC(); |
|
210 IMPORT_C void InternalizeL(RReadStream& aStream); |
|
211 IMPORT_C void ExternalizeL(RWriteStream& aStream) const; |
|
212 IMPORT_C void MergeL(const CColorList& aList); |
|
213 private: |
|
214 CColorList(CArrayFix<TRgb>* aColors); |
|
215 TInt Find(TUid aApp) const; |
|
216 private: |
|
217 class TAppColorList |
|
218 { |
|
219 public: |
|
220 inline TAppColorList(TUid aApp,CColorArray* aColorArray); |
|
221 public: |
|
222 TUid iApp; |
|
223 CColorArray* iColorArray; |
|
224 }; |
|
225 private: |
|
226 CArrayFix<TRgb>* iEikColors; |
|
227 CArrayFix<TAppColorList>* iAppColors; |
|
228 }; |
|
229 |
|
230 // not available before Release 005 |
|
231 |
|
232 class CColorArray : public CBase |
|
233 /** A dynamic array of mappings between logical and physical colours (TRgb values). |
|
234 |
|
235 @publishedAll |
|
236 @released */ |
|
237 { |
|
238 public: |
|
239 IMPORT_C static CColorArray* NewL(); |
|
240 IMPORT_C static CColorArray* NewLC(); |
|
241 IMPORT_C ~CColorArray(); |
|
242 IMPORT_C TRgb Color(TInt aLogicalColor) const; |
|
243 IMPORT_C void SetColor(TInt aLogicalColor,TRgb aColor); |
|
244 IMPORT_C TBool Contains(TInt aLogicalColor) const; |
|
245 IMPORT_C TInt Count() const; |
|
246 IMPORT_C void Reset(); |
|
247 IMPORT_C void AddL(TInt aLogicalColor,TRgb aColor); |
|
248 IMPORT_C void Remove(TInt aLogicalColor); |
|
249 public: |
|
250 static CColorArray* NewLC(const CColorArray& aArray); |
|
251 public: |
|
252 void InternalizeL(RReadStream& aStream); |
|
253 void ExternalizeL(RWriteStream& aStream) const; |
|
254 private: |
|
255 CColorArray(); |
|
256 void ConstructL(); |
|
257 TInt Find(TInt aLogicalColor) const; |
|
258 private: |
|
259 class TColor |
|
260 { |
|
261 public: |
|
262 inline TColor(); |
|
263 inline TColor(TRgb aColor,TInt aLogicalColor); |
|
264 public: |
|
265 void InternalizeL(RReadStream& aStream); |
|
266 void ExternalizeL(RWriteStream& aStream) const; |
|
267 public: |
|
268 TRgb iColor; |
|
269 TInt iLogicalColor; |
|
270 }; |
|
271 CArrayFixFlat<TColor> iColors; |
|
272 }; |
|
273 |
|
274 #endif |