epoc32/include/mw/gulcolor.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/gulcolor.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,274 @@
     1.4 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// 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
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +#if !defined(__GULCOLOR_H__)
    1.20 +#define __GULCOLOR_H__
    1.21 +
    1.22 +#if !defined(__W32STD_H__)
    1.23 +#include <w32std.h>
    1.24 +#endif
    1.25 +
    1.26 +#if !defined(__E32BASE_H__)
    1.27 +#include <e32base.h>
    1.28 +#endif
    1.29 +
    1.30 +#if !defined(__GDI_H__)
    1.31 +#include <gdi.h>
    1.32 +#endif
    1.33 +
    1.34 +/** Logical colours.
    1.35 +
    1.36 +Logical colours are used to specify the colour scheme for the controls in 
    1.37 +an application.
    1.38 +
    1.39 +Many controls have one logical colour for text and another logical colour 
    1.40 +for the background. Some logical colours have a dimmed variant for when the 
    1.41 +control becomes inactive or disabled. Highlighted and pressed variants exist 
    1.42 +for controls that support selection or which can be pressed. 
    1.43 +
    1.44 +@publishedAll
    1.45 +@released */
    1.46 +enum TLogicalColor
    1.47 +	{
    1.48 +	// Windows
    1.49 +	/** The colour of a window's background. */
    1.50 +	EColorWindowBackground,
    1.51 +	/** The colour of text in a window. */
    1.52 +	EColorWindowText,
    1.53 +	// Controls
    1.54 +	/** The colour of the background contents of a control. */
    1.55 +	EColorControlBackground,
    1.56 +	/** The colour of the text inside a control. */
    1.57 +	EColorControlText, 
    1.58 +	/** The background colour of a control's border. */
    1.59 +	EColorControlSurroundBackground,
    1.60 +	/** The colour of text in a control's border. */
    1.61 +	EColorControlSurroundText,
    1.62 +	/** The colour of a control's background when highlighted for selection. */
    1.63 +	EColorControlHighlightBackground, 
    1.64 +	/** The colour of the text in a control when highlighted for selection. */
    1.65 +	EColorControlHighlightText,
    1.66 +	/** The colour of a control's background when dimmed. */
    1.67 +	EColorControlDimmedBackground, 
    1.68 +	/** The colour of the text in a control when dimmed. */
    1.69 +	EColorControlDimmedText,
    1.70 +	/** The colour of a control's background when dimmed and highlighted for selection. */
    1.71 +	EColorControlDimmedHighlightBackground,
    1.72 +	/** The colour of the text in a control when dimmed and highlighted for selection. */
    1.73 +	EColorControlDimmedHighlightText,
    1.74 +	// Dialogs
    1.75 +	/** The colour of a dialog's background. */
    1.76 +	EColorDialogBackground,
    1.77 +	/** The colour of text inside a dialog. */
    1.78 +	EColorDialogText,
    1.79 +	/** A dialog title's background colour. */
    1.80 +	EColorDialogTitle,
    1.81 +	/** A dialog title's background colour when pressed. */
    1.82 +	EColorDialogTitlePressed,
    1.83 +	/** The text colour in a dialog's title. */
    1.84 +	EColorDialogTitleText,
    1.85 +	/** The text colour in a dialog's title when pressed. */
    1.86 +	EColorDialogTitleTextPressed,
    1.87 +	// Menus
    1.88 +	/** The colour of the menubar's background. */
    1.89 +	EColorMenubarBackground,
    1.90 +	/** The colour of text in the menubar. */
    1.91 +	EColorMenubarText,
    1.92 +	/** The colour of the menubar title's background. */
    1.93 +	EColorMenubarTitleBackground,
    1.94 +	/** The colour of text in the menubar title. */
    1.95 +	EColorMenubarTitleText,
    1.96 +	/** The colour of the menu pane background. */
    1.97 +	EColorMenuPaneBackground,
    1.98 +	/** The colour of text in the menu pane. */
    1.99 +	EColorMenuPaneText,
   1.100 +	/** The colour of the menu pane background when highlighted for selection. */
   1.101 +	EColorMenuPaneHighlight,
   1.102 +	/** The colour of text in the menu pane when highlighted for selection. */
   1.103 +	EColorMenuPaneTextHighlight,
   1.104 +	/** The colour of the menu pane background when dimmed and highlighted. */
   1.105 +	EColorMenuPaneDimmedHighlight,
   1.106 +	/** The colour of text in the menu pane when dimmed. */
   1.107 +	EColorMenuPaneDimmedText,
   1.108 +	/** The colour of text in the menu pane when dimmed and highlighted for selection. */
   1.109 +	EColorMenuPaneDimmedTextHighlight,
   1.110 +	// Command buttons
   1.111 +	/** The colour of the button background, when the button is in the unset state. */
   1.112 +	EColorButtonFaceClear,
   1.113 +	/** The colour of the button background when the button is in the set state. */
   1.114 +	EColorButtonFaceSet,
   1.115 +	/** The colour of the button background when the button is in the set state and 
   1.116 +	is pressed. */
   1.117 +	EColorButtonFaceSetPressed,
   1.118 +	/** The colour of the button background when the button is in the unset state and 
   1.119 +	is pressed. */
   1.120 +	EColorButtonFaceClearPressed,
   1.121 +	/** The colour of the button text. */
   1.122 +	EColorButtonText,
   1.123 +	/** The colour of the button text when the button is pressed. */
   1.124 +	EColorButtonTextPressed,
   1.125 +	/** The colour of the button text when the button is dimmed. */
   1.126 +	EColorButtonTextDimmed,		
   1.127 +	// Message windows
   1.128 +	/** The colour of the message window foreground. */
   1.129 +	EColorMsgWinForeground,
   1.130 +	EColorMsgWinBackground,
   1.131 +	// Scrollbars
   1.132 +	/** The colour of the scroll bar border. */
   1.133 +	EColorScrollBarBorder,
   1.134 +	EColorScrollBarShaft,
   1.135 +	/** The colour of the scroll bar shaft background when dimmed. */
   1.136 +	EColorScrollBarShaftDimmed,
   1.137 +	/** The colour of the scroll bar shaft background when pressed. */
   1.138 +	EColorScrollBarShaftPressed,
   1.139 +	/** The colour of the background for scroll bars with no thumb and no shaft. */
   1.140 +	EColorScrollBarNoShaftOrThumb,
   1.141 +	/** The colour of scroll bar buttons. */
   1.142 +	EColorScrollButtonIcon,
   1.143 +	/** The colour of scroll bar buttons when pressed. */
   1.144 +	EColorScrollButtonIconPressed,
   1.145 +	/** The colour of scroll bar buttons when dimmed. */
   1.146 +	EColorScrollButtonIconDimmed,
   1.147 +	/** The colour of a scroll bar thumb's background. */
   1.148 +	EColorScrollButtonThumbBackground,
   1.149 +	/** The colour of a scroll bar thumb's background when pressed. */
   1.150 +	EColorScrollButtonThumbBackgroundPressed,
   1.151 +	/** The colour of a scroll bar thumb's background when dimmed. */
   1.152 +	EColorScrollThumbDimmed,
   1.153 +	/** The colour of a scroll bar thumb's edge. */
   1.154 +	EColorScrollThumbEdge,
   1.155 +	// Toolbars
   1.156 +	/** The colour of a toolbar's background. */
   1.157 +	EColorToolbarBackground,
   1.158 +	/** The colour of the text in a toolbar. */
   1.159 +	EColorToolbarText,
   1.160 +	// Status pane
   1.161 +	/** The colour of a status pane's background. */
   1.162 +	EColorStatusPaneBackground,
   1.163 +	/** The colour of the text in a status pane. */
   1.164 +	EColorStatusPaneText,
   1.165 +	// Labels
   1.166 +	/** The colour of the text in a label. */
   1.167 +	EColorLabelText,
   1.168 +	/** The colour of emphasised text in a label. */
   1.169 +	EColorLabelTextEmphasis,
   1.170 +	/** The colour of the text in a label when dimmed. */
   1.171 +	EColorLabelDimmedText,
   1.172 +	/** The colour of the label background when highlighted and dimmed. */
   1.173 +	EColorLabelHighlightPartialEmphasis,
   1.174 +	/** The colour of the label background when highlighted. */
   1.175 +	EColorLabelHighlightFullEmphasis,
   1.176 +	/** The number of logical colours */
   1.177 +	EColorNumberOfLogicalColors
   1.178 +	};
   1.179 +
   1.180 +class RReadStream;
   1.181 +class RWriteStream;
   1.182 +class CColorArray;
   1.183 +
   1.184 +// not available before Release 005
   1.185 +
   1.186 +class CColorList : public CBase
   1.187 +/** A palette that maps logical colours (TLogicalColor) to physical (TRgb) values. It 
   1.188 +also supports independent sections for applications: a section is identified by an 
   1.189 +application UID, and the mappings are held as a colour array (CColorArray). 
   1.190 +
   1.191 +A colour list also supports mapping for both four-grey and 256-colour schemes; the 
   1.192 +256-colour scheme will be used and will look good if the screen mode supports 16 or 
   1.193 +more colours. Otherwise, the four-grey scheme will be used. 
   1.194 +
   1.195 +@publishedAll 
   1.196 +@released */
   1.197 +	{
   1.198 +public:
   1.199 +	IMPORT_C static CColorList* NewL(CArrayFix<TRgb>* aColors);
   1.200 +	IMPORT_C ~CColorList();
   1.201 +	// Accessors
   1.202 +	IMPORT_C TRgb Color(TLogicalColor aColor) const;
   1.203 +	IMPORT_C TInt Count() const;
   1.204 +	IMPORT_C TRgb Color(TUid aApp,TInt aColor) const;
   1.205 +	IMPORT_C CColorArray* ColorArray(TUid aApp) const;
   1.206 +	IMPORT_C TBool ContainsColorArray(TUid aApp) const;
   1.207 +	// Manipulators
   1.208 +	IMPORT_C void SetColor(TLogicalColor aLogicalColor,TRgb aColor);
   1.209 +	IMPORT_C void AddColorArrayL(TUid aApp,CColorArray* aArray); // takes ownership
   1.210 +	IMPORT_C void DeleteColorArray(TUid aApp);
   1.211 +public:
   1.212 +	IMPORT_C static CColorList* NewLC();
   1.213 +	IMPORT_C void InternalizeL(RReadStream& aStream);
   1.214 +	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
   1.215 +	IMPORT_C void MergeL(const CColorList& aList);
   1.216 +private:
   1.217 +	CColorList(CArrayFix<TRgb>* aColors);
   1.218 +	TInt Find(TUid aApp) const;
   1.219 +private:
   1.220 +	class TAppColorList
   1.221 +		{
   1.222 +	public:
   1.223 +		inline TAppColorList(TUid aApp,CColorArray* aColorArray);
   1.224 +	public:
   1.225 +		TUid iApp;
   1.226 +		CColorArray* iColorArray;
   1.227 +		};
   1.228 +private:
   1.229 +	CArrayFix<TRgb>* iEikColors;
   1.230 +	CArrayFix<TAppColorList>* iAppColors;
   1.231 +	};
   1.232 +
   1.233 +// not available before Release 005
   1.234 +
   1.235 +class CColorArray : public CBase
   1.236 +/** A dynamic array of mappings between logical and physical colours (TRgb values).
   1.237 +
   1.238 +@publishedAll 
   1.239 +@released */
   1.240 +	{
   1.241 +public:
   1.242 +	IMPORT_C static CColorArray* NewL();
   1.243 +	IMPORT_C static CColorArray* NewLC();
   1.244 +	IMPORT_C ~CColorArray();
   1.245 +	IMPORT_C TRgb Color(TInt aLogicalColor) const;
   1.246 +	IMPORT_C void SetColor(TInt aLogicalColor,TRgb aColor);
   1.247 +	IMPORT_C TBool Contains(TInt aLogicalColor) const;
   1.248 +	IMPORT_C TInt Count() const;
   1.249 +	IMPORT_C void Reset();
   1.250 +	IMPORT_C void AddL(TInt aLogicalColor,TRgb aColor);
   1.251 +	IMPORT_C void Remove(TInt aLogicalColor);
   1.252 +public:
   1.253 +	static CColorArray* NewLC(const CColorArray& aArray);
   1.254 +public:
   1.255 +	void InternalizeL(RReadStream& aStream);
   1.256 +	void ExternalizeL(RWriteStream& aStream) const;
   1.257 +private:
   1.258 +	CColorArray();
   1.259 +	void ConstructL();
   1.260 +	TInt Find(TInt aLogicalColor) const;
   1.261 +private:
   1.262 +	class TColor
   1.263 +		{
   1.264 +	public:
   1.265 +		inline TColor();
   1.266 +		inline TColor(TRgb aColor,TInt aLogicalColor);
   1.267 +	public:
   1.268 +		void InternalizeL(RReadStream& aStream);
   1.269 +		void ExternalizeL(RWriteStream& aStream) const;
   1.270 +	public:
   1.271 +		TRgb iColor;
   1.272 +		TInt iLogicalColor;
   1.273 +		};
   1.274 +	CArrayFixFlat<TColor> iColors;
   1.275 +	};
   1.276 +
   1.277 +#endif