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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #if !defined(__GULCOLOR_H__)
17 #define __GULCOLOR_H__
19 #if !defined(__W32STD_H__)
23 #if !defined(__E32BASE_H__)
27 #if !defined(__GDI_H__)
33 Logical colours are used to specify the colour scheme for the controls in
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.
46 /** The colour of a window's background. */
47 EColorWindowBackground,
48 /** The colour of text in a window. */
51 /** The colour of the background contents of a control. */
52 EColorControlBackground,
53 /** The colour of the text inside a control. */
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,
72 /** The colour of a dialog's background. */
73 EColorDialogBackground,
74 /** The colour of text inside a dialog. */
76 /** A dialog title's background colour. */
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,
85 /** The colour of the menubar's background. */
86 EColorMenubarBackground,
87 /** The colour of text in the menubar. */
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. */
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,
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. */
112 /** The colour of the button background when the button is in the set state and
114 EColorButtonFaceSetPressed,
115 /** The colour of the button background when the button is in the unset state and
117 EColorButtonFaceClearPressed,
118 /** The colour of the button text. */
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,
125 /** The colour of the message window foreground. */
126 EColorMsgWinForeground,
127 EColorMsgWinBackground,
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,
153 /** The colour of a toolbar's background. */
154 EColorToolbarBackground,
155 /** The colour of the text in a toolbar. */
158 /** The colour of a status pane's background. */
159 EColorStatusPaneBackground,
160 /** The colour of the text in a status pane. */
161 EColorStatusPaneText,
163 /** The colour of the text in a label. */
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
181 // not available before Release 005
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).
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.
196 IMPORT_C static CColorList* NewL(CArrayFix<TRgb>* aColors);
197 IMPORT_C ~CColorList();
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;
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);
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);
214 CColorList(CArrayFix<TRgb>* aColors);
215 TInt Find(TUid aApp) const;
220 inline TAppColorList(TUid aApp,CColorArray* aColorArray);
223 CColorArray* iColorArray;
226 CArrayFix<TRgb>* iEikColors;
227 CArrayFix<TAppColorList>* iAppColors;
230 // not available before Release 005
232 class CColorArray : public CBase
233 /** A dynamic array of mappings between logical and physical colours (TRgb values).
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);
250 static CColorArray* NewLC(const CColorArray& aArray);
252 void InternalizeL(RReadStream& aStream);
253 void ExternalizeL(RWriteStream& aStream) const;
257 TInt Find(TInt aLogicalColor) const;
263 inline TColor(TRgb aColor,TInt aLogicalColor);
265 void InternalizeL(RReadStream& aStream);
266 void ExternalizeL(RWriteStream& aStream) const;
271 CArrayFixFlat<TColor> iColors;