williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined(__GULCOLOR_H__) williamr@2: #define __GULCOLOR_H__ williamr@2: williamr@2: #if !defined(__W32STD_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__E32BASE_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: #if !defined(__GDI_H__) williamr@2: #include williamr@2: #endif williamr@2: williamr@2: /** Logical colours. williamr@2: williamr@2: Logical colours are used to specify the colour scheme for the controls in williamr@2: an application. williamr@2: williamr@2: Many controls have one logical colour for text and another logical colour williamr@2: for the background. Some logical colours have a dimmed variant for when the williamr@2: control becomes inactive or disabled. Highlighted and pressed variants exist williamr@2: for controls that support selection or which can be pressed. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: enum TLogicalColor williamr@2: { williamr@2: // Windows williamr@2: /** The colour of a window's background. */ williamr@2: EColorWindowBackground, williamr@2: /** The colour of text in a window. */ williamr@2: EColorWindowText, williamr@2: // Controls williamr@2: /** The colour of the background contents of a control. */ williamr@2: EColorControlBackground, williamr@2: /** The colour of the text inside a control. */ williamr@2: EColorControlText, williamr@2: /** The background colour of a control's border. */ williamr@2: EColorControlSurroundBackground, williamr@2: /** The colour of text in a control's border. */ williamr@2: EColorControlSurroundText, williamr@2: /** The colour of a control's background when highlighted for selection. */ williamr@2: EColorControlHighlightBackground, williamr@2: /** The colour of the text in a control when highlighted for selection. */ williamr@2: EColorControlHighlightText, williamr@2: /** The colour of a control's background when dimmed. */ williamr@2: EColorControlDimmedBackground, williamr@2: /** The colour of the text in a control when dimmed. */ williamr@2: EColorControlDimmedText, williamr@2: /** The colour of a control's background when dimmed and highlighted for selection. */ williamr@2: EColorControlDimmedHighlightBackground, williamr@2: /** The colour of the text in a control when dimmed and highlighted for selection. */ williamr@2: EColorControlDimmedHighlightText, williamr@2: // Dialogs williamr@2: /** The colour of a dialog's background. */ williamr@2: EColorDialogBackground, williamr@2: /** The colour of text inside a dialog. */ williamr@2: EColorDialogText, williamr@2: /** A dialog title's background colour. */ williamr@2: EColorDialogTitle, williamr@2: /** A dialog title's background colour when pressed. */ williamr@2: EColorDialogTitlePressed, williamr@2: /** The text colour in a dialog's title. */ williamr@2: EColorDialogTitleText, williamr@2: /** The text colour in a dialog's title when pressed. */ williamr@2: EColorDialogTitleTextPressed, williamr@2: // Menus williamr@2: /** The colour of the menubar's background. */ williamr@2: EColorMenubarBackground, williamr@2: /** The colour of text in the menubar. */ williamr@2: EColorMenubarText, williamr@2: /** The colour of the menubar title's background. */ williamr@2: EColorMenubarTitleBackground, williamr@2: /** The colour of text in the menubar title. */ williamr@2: EColorMenubarTitleText, williamr@2: /** The colour of the menu pane background. */ williamr@2: EColorMenuPaneBackground, williamr@2: /** The colour of text in the menu pane. */ williamr@2: EColorMenuPaneText, williamr@2: /** The colour of the menu pane background when highlighted for selection. */ williamr@2: EColorMenuPaneHighlight, williamr@2: /** The colour of text in the menu pane when highlighted for selection. */ williamr@2: EColorMenuPaneTextHighlight, williamr@2: /** The colour of the menu pane background when dimmed and highlighted. */ williamr@2: EColorMenuPaneDimmedHighlight, williamr@2: /** The colour of text in the menu pane when dimmed. */ williamr@2: EColorMenuPaneDimmedText, williamr@2: /** The colour of text in the menu pane when dimmed and highlighted for selection. */ williamr@2: EColorMenuPaneDimmedTextHighlight, williamr@2: // Command buttons williamr@2: /** The colour of the button background, when the button is in the unset state. */ williamr@2: EColorButtonFaceClear, williamr@2: /** The colour of the button background when the button is in the set state. */ williamr@2: EColorButtonFaceSet, williamr@2: /** The colour of the button background when the button is in the set state and williamr@2: is pressed. */ williamr@2: EColorButtonFaceSetPressed, williamr@2: /** The colour of the button background when the button is in the unset state and williamr@2: is pressed. */ williamr@2: EColorButtonFaceClearPressed, williamr@2: /** The colour of the button text. */ williamr@2: EColorButtonText, williamr@2: /** The colour of the button text when the button is pressed. */ williamr@2: EColorButtonTextPressed, williamr@2: /** The colour of the button text when the button is dimmed. */ williamr@2: EColorButtonTextDimmed, williamr@2: // Message windows williamr@2: /** The colour of the message window foreground. */ williamr@2: EColorMsgWinForeground, williamr@2: EColorMsgWinBackground, williamr@2: // Scrollbars williamr@2: /** The colour of the scroll bar border. */ williamr@2: EColorScrollBarBorder, williamr@2: EColorScrollBarShaft, williamr@2: /** The colour of the scroll bar shaft background when dimmed. */ williamr@2: EColorScrollBarShaftDimmed, williamr@2: /** The colour of the scroll bar shaft background when pressed. */ williamr@2: EColorScrollBarShaftPressed, williamr@2: /** The colour of the background for scroll bars with no thumb and no shaft. */ williamr@2: EColorScrollBarNoShaftOrThumb, williamr@2: /** The colour of scroll bar buttons. */ williamr@2: EColorScrollButtonIcon, williamr@2: /** The colour of scroll bar buttons when pressed. */ williamr@2: EColorScrollButtonIconPressed, williamr@2: /** The colour of scroll bar buttons when dimmed. */ williamr@2: EColorScrollButtonIconDimmed, williamr@2: /** The colour of a scroll bar thumb's background. */ williamr@2: EColorScrollButtonThumbBackground, williamr@2: /** The colour of a scroll bar thumb's background when pressed. */ williamr@2: EColorScrollButtonThumbBackgroundPressed, williamr@2: /** The colour of a scroll bar thumb's background when dimmed. */ williamr@2: EColorScrollThumbDimmed, williamr@2: /** The colour of a scroll bar thumb's edge. */ williamr@2: EColorScrollThumbEdge, williamr@2: // Toolbars williamr@2: /** The colour of a toolbar's background. */ williamr@2: EColorToolbarBackground, williamr@2: /** The colour of the text in a toolbar. */ williamr@2: EColorToolbarText, williamr@2: // Status pane williamr@2: /** The colour of a status pane's background. */ williamr@2: EColorStatusPaneBackground, williamr@2: /** The colour of the text in a status pane. */ williamr@2: EColorStatusPaneText, williamr@2: // Labels williamr@2: /** The colour of the text in a label. */ williamr@2: EColorLabelText, williamr@2: /** The colour of emphasised text in a label. */ williamr@2: EColorLabelTextEmphasis, williamr@2: /** The colour of the text in a label when dimmed. */ williamr@2: EColorLabelDimmedText, williamr@2: /** The colour of the label background when highlighted and dimmed. */ williamr@2: EColorLabelHighlightPartialEmphasis, williamr@2: /** The colour of the label background when highlighted. */ williamr@2: EColorLabelHighlightFullEmphasis, williamr@2: /** The number of logical colours */ williamr@2: EColorNumberOfLogicalColors williamr@2: }; williamr@2: williamr@2: class RReadStream; williamr@2: class RWriteStream; williamr@2: class CColorArray; williamr@2: williamr@2: // not available before Release 005 williamr@2: williamr@2: class CColorList : public CBase williamr@2: /** A palette that maps logical colours (TLogicalColor) to physical (TRgb) values. It williamr@2: also supports independent sections for applications: a section is identified by an williamr@2: application UID, and the mappings are held as a colour array (CColorArray). williamr@2: williamr@2: A colour list also supports mapping for both four-grey and 256-colour schemes; the williamr@2: 256-colour scheme will be used and will look good if the screen mode supports 16 or williamr@2: more colours. Otherwise, the four-grey scheme will be used. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CColorList* NewL(CArrayFix* aColors); williamr@2: IMPORT_C ~CColorList(); williamr@2: // Accessors williamr@2: IMPORT_C TRgb Color(TLogicalColor aColor) const; williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C TRgb Color(TUid aApp,TInt aColor) const; williamr@2: IMPORT_C CColorArray* ColorArray(TUid aApp) const; williamr@2: IMPORT_C TBool ContainsColorArray(TUid aApp) const; williamr@2: // Manipulators williamr@2: IMPORT_C void SetColor(TLogicalColor aLogicalColor,TRgb aColor); williamr@2: IMPORT_C void AddColorArrayL(TUid aApp,CColorArray* aArray); // takes ownership williamr@2: IMPORT_C void DeleteColorArray(TUid aApp); williamr@2: public: williamr@2: IMPORT_C static CColorList* NewLC(); williamr@2: IMPORT_C void InternalizeL(RReadStream& aStream); williamr@2: IMPORT_C void ExternalizeL(RWriteStream& aStream) const; williamr@2: IMPORT_C void MergeL(const CColorList& aList); williamr@2: private: williamr@2: CColorList(CArrayFix* aColors); williamr@2: TInt Find(TUid aApp) const; williamr@2: private: williamr@2: class TAppColorList williamr@2: { williamr@2: public: williamr@2: inline TAppColorList(TUid aApp,CColorArray* aColorArray); williamr@2: public: williamr@2: TUid iApp; williamr@2: CColorArray* iColorArray; williamr@2: }; williamr@2: private: williamr@2: CArrayFix* iEikColors; williamr@2: CArrayFix* iAppColors; williamr@2: }; williamr@2: williamr@2: // not available before Release 005 williamr@2: williamr@2: class CColorArray : public CBase williamr@2: /** A dynamic array of mappings between logical and physical colours (TRgb values). williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CColorArray* NewL(); williamr@2: IMPORT_C static CColorArray* NewLC(); williamr@2: IMPORT_C ~CColorArray(); williamr@2: IMPORT_C TRgb Color(TInt aLogicalColor) const; williamr@2: IMPORT_C void SetColor(TInt aLogicalColor,TRgb aColor); williamr@2: IMPORT_C TBool Contains(TInt aLogicalColor) const; williamr@2: IMPORT_C TInt Count() const; williamr@2: IMPORT_C void Reset(); williamr@2: IMPORT_C void AddL(TInt aLogicalColor,TRgb aColor); williamr@2: IMPORT_C void Remove(TInt aLogicalColor); williamr@2: public: williamr@2: static CColorArray* NewLC(const CColorArray& aArray); williamr@2: public: williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: void ExternalizeL(RWriteStream& aStream) const; williamr@2: private: williamr@2: CColorArray(); williamr@2: void ConstructL(); williamr@2: TInt Find(TInt aLogicalColor) const; williamr@2: private: williamr@2: class TColor williamr@2: { williamr@2: public: williamr@2: inline TColor(); williamr@2: inline TColor(TRgb aColor,TInt aLogicalColor); williamr@2: public: williamr@2: void InternalizeL(RReadStream& aStream); williamr@2: void ExternalizeL(RWriteStream& aStream) const; williamr@2: public: williamr@2: TRgb iColor; williamr@2: TInt iLogicalColor; williamr@2: }; williamr@2: CArrayFixFlat iColors; williamr@2: }; williamr@2: williamr@2: #endif