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