/** * @file XTPColorManager.h * * @copyright * (c) 1998-2025 Codejock Software, All Rights Reserved. * * This source file is the property of Codejock Software and must not be * redistributed by any means without the explicit written permission of * Codejock Software. * * The use of this source code is governed by the terms and conditions specified * in the Toolkit Pro license agreement. Codejock Software grants you, as a * single software developer, the limited right to use this software on one * computer only. * * Contact Information: * support@codejock.com * http://www.codejock.com * */ /** @cond */ #if !defined(__XTPCOLORMANAGER_H__) # define __XTPCOLORMANAGER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * Enumeration used to determine the current Windows XP theme in use * * * Example: *
XTPCurrentSystemTheme systemTheme = XTPColorManager()->GetCurrentSystemTheme();* * @see xtpSystemThemeUnknown, xtpSystemThemeBlue, xtpSystemThemeOlive, xtpSystemThemeSilver, * xtpSystemThemeAuto, xtpSystemThemeDefault, CXTPColorManager::GetCurrentSystemTheme */ enum XTPCurrentSystemTheme { xtpSystemThemeUnknown, /**< No known theme in use */ xtpSystemThemeBlue, /**< Luna Blue Windows XP theme in use */ xtpSystemThemeOlive, /**< Luna Olive Windows XP theme in use */ xtpSystemThemeSilver, /**< Luna Silver Windows XP theme in use */ xtpSystemThemeRoyale, /**< Royale Windows XP theme in use */ xtpSystemThemeAero, /**< Aero Vista theme in use */ xtpSystemThemeAuto, /**< Use OS theme. */ xtpSystemThemeDefault /**< Default theme (xtpSystemThemeAuto) */ }; /** @cond */ # ifndef COLOR_GRADIENTACTIVECAPTION # define COLOR_GRADIENTACTIVECAPTION 27 # endif # ifndef COLOR_GRADIENTINACTIVECAPTION # define COLOR_GRADIENTINACTIVECAPTION 28 # endif # ifndef COLORREF_NULL # define COLORREF_NULL ((COLORREF)-1) # endif # ifndef COLORREF_ERROR # define COLORREF_ERROR RGB(255, 0, 0) # endif /** @endcond */ const int XPCOLOR_BASE = 30; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TOOLBAR_FACE = XPCOLOR_BASE; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT = 31; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_BORDER = 32; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_PUSHED = 33; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_ICONSHADDOW = 34; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_MENUBAR_GRAYTEXT = 35; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_GRAYTEXT = XPCOLOR_MENUBAR_GRAYTEXT; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_CHECKED = 36; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_CHECKED_BORDER = 37; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TOOLBAR_GRIPPER = 38; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_SEPARATOR = 39; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_DISABLED = 40; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_MENUBAR_FACE = 41; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_MENUBAR_EXPANDED = 42; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_MENUBAR_BORDER = 43; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_MENUBAR_TEXT = 44; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_TEXT = 45; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_CHECKED_TEXT = XPCOLOR_HIGHLIGHT_TEXT; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TOOLBAR_TEXT = 46; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_PUSHED_TEXT = 47; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TAB_INACTIVE_BACK = 48; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TAB_INACTIVE_TEXT = 49; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_PUSHED_BORDER = 50; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_3DFACE = 51; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_3DSHADOW = 52; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_EDITCTRLBORDER = 53; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_FRAME = 54; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_SPLITTER_FACE = 55; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_LABEL = 56; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_STATICFRAME = 57; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_HIGHLIGHT_DISABLED_BORDER = 58; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_SHADOW_FACTOR = 59; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_TOOLBAR_GRAYTEXT = 60; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_FLOATBAR_BORDER = 61; /**< @see CXTPColorManager::GetColor> */ const int XPCOLOR_LAST = 62; /**< @see CXTPColorManager::GetColor> */ /** * @brief * The CXTPPaintManagerColor class is used to manage COLORREF values for * determining default and application defined colors. */ class _XTP_EXT_CLASS CXTPPaintManagerColor { public: /** * @brief * Constructs a CXTPPaintManagerColor object and initializes default * and application defined colors for the class * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColor(); /** * @brief * Constructs a CXTPPaintManagerColor object and initializes default * and application defined colors for the class * @param clr n RGB value that represents default color to set. * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColor(COLORREF clr); /** * Handles object destruction */ virtual ~CXTPPaintManagerColor() { } /** * @brief * This member function determines if application defined colors are * used. * @return * TRUE if application defined colors are used, otherwise FALSE. */ BOOL IsDefaultValue() const; /** * @brief * This member function determines if the standard color is set and * used. * @return * TRUE if standard color is set and custom color is not set, * otherwise FALSE. */ BOOL IsStandardValue() const; /** * @brief * This member function determines if the custom color is set and * used. * @return * TRUE if custom color is set, otherwise FALSE. */ BOOL IsCustomValue() const; /** * @brief * This member function will retrieves the default color for the * CXTPPaintManagerColor class. * @return * An RGB value that represents the default color. */ COLORREF GetStandardColor() const; /** * @brief * This member function will sets the application defined color for * the CXTPPaintManagerColor class. * @param clr n RGB value that represents application defined color to set. */ void SetCustomValue(COLORREF clr); /** * @brief * This member function will sets the default color for * the CXTPPaintManagerColor class. * @param clr n RGB value that represents default color to set. */ void SetStandardValue(COLORREF clr); /** * @brief * This member function will remove the application defined color (if any) * that was defined for the CXTPPaintManagerColor class. */ void SetDefaultValue(); /** * @brief * Operator used to retrieve an RGB color value that represents * the current color defined for the CXTPPaintManagerColor class. * @return * An RGB value that represents the current color. */ operator COLORREF() const; /** * @brief * This operator assigns a new COLORREF value for the application defined color * @param clr RGB value that represents application defined color to set. * color to set. * @return Self reference. * @see * SetStandardValue, SetCustomValue */ const CXTPPaintManagerColor& operator=(COLORREF clr); /** * @brief * This operator assigns a new COLORREF value for the application defined color * @param refclr Reference to CXTPPaintManagerColor value that represents application defined * color to set. * @return Self reference. * @see * SetStandardValue, SetCustomValue */ const CXTPPaintManagerColor& operator=(const CXTPPaintManagerColor& refclr); /** * @brief * This method reads or writes data from or to an archive. * @param ar A CArchive object to serialize to or from. */ virtual void Serialize(CArchive& ar); protected: COLORREF m_clrStandardValue; /**< Standard color */ COLORREF m_clrCustomValue; /**< Application defined color */ }; /** @cond */ AFX_INLINE BOOL CXTPPaintManagerColor::IsDefaultValue() const { return (m_clrCustomValue == COLORREF_NULL) && (m_clrStandardValue == COLORREF_NULL); } AFX_INLINE BOOL CXTPPaintManagerColor::IsStandardValue() const { return (m_clrCustomValue == COLORREF_NULL) && (m_clrStandardValue != COLORREF_NULL); } AFX_INLINE BOOL CXTPPaintManagerColor::IsCustomValue() const { return m_clrCustomValue != COLORREF_NULL; } AFX_INLINE COLORREF CXTPPaintManagerColor::GetStandardColor() const { return m_clrStandardValue; } AFX_INLINE void CXTPPaintManagerColor::SetCustomValue(COLORREF clr) { m_clrCustomValue = clr; } AFX_INLINE void CXTPPaintManagerColor::SetStandardValue(COLORREF clr) { m_clrStandardValue = clr; } AFX_INLINE void CXTPPaintManagerColor::SetDefaultValue() { m_clrCustomValue = COLORREF_NULL; } AFX_INLINE CXTPPaintManagerColor::operator COLORREF() const { return (m_clrCustomValue == COLORREF_NULL) ? m_clrStandardValue : m_clrCustomValue; } AFX_INLINE const CXTPPaintManagerColor& CXTPPaintManagerColor::operator=(COLORREF clr) { SetCustomValue(clr); return *this; } AFX_INLINE const CXTPPaintManagerColor& CXTPPaintManagerColor:: operator=(const CXTPPaintManagerColor& clr) { m_clrCustomValue = clr.m_clrCustomValue; m_clrStandardValue = clr.m_clrStandardValue; return *this; } /** @endcond */ /** * @brief * The CXTPPaintManagerColorGradient class is used to manage COLORREF values * for determining light and dark gradient colors. * @see CXTPPaintManagerColor */ class _XTP_EXT_CLASS CXTPPaintManagerColorGradient { public: /** * @brief * Constructs a CXTPPaintManagerColorGradient object and initializes * default dark and light colors equal to the specified COLORREF value. * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColorGradient(); /** * @brief * Constructs a CXTPPaintManagerColorGradient object and initializes * default dark and light colors equal to the specified COLORREF value. * @param clr An RGB COLORREF value representing the dark and light colors. * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColorGradient(const COLORREF clr); /** * @brief * Constructs a CXTPPaintManagerColorGradient object and initializes * default dark and light colors equal to the specified COLORREF value. * @param clr An RGB COLORREF value representing the dark and light colors. * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColorGradient(const CXTPPaintManagerColor clr); /** * @brief * Constructs a CXTPPaintManagerColorGradient object and initializes * default dark and light colors equal to the specified COLORREF value. * @param clrLight An RGB COLORREF value representing the light color. * @param clrDark An RGB COLORREF value representing the dark color. * @see * SetStandardValue, SetCustomValue */ CXTPPaintManagerColorGradient(COLORREF clrLight, COLORREF clrDark); /** * @brief * Handles object destruction */ virtual ~CXTPPaintManagerColorGradient() { } /** * @brief * This member function sets the value of the default * dark and light colors equal to the specified COLORREF value. * @param clr An RGB COLORREF value representing the dark and light colors. */ void SetStandardValue(const COLORREF clr); /** * @brief * This member function sets the value of the default * dark and light colors equal to the specified COLORREF value. * @param clrref An reference to CXTPPaintManagerColorGradient value representing the dark * and light colors. */ void SetStandardValue(CXTPPaintManagerColorGradient& clrref); /** * @brief * This member function sets the value of the default * dark and light colors equal to the specified COLORREF value. * @param clrLight An RGB COLORREF value representing the light color. * @param clrDark An RGB COLORREF value representing the dark color. * @param fGradientFactor Gradient divider factor */ void SetStandardValue(COLORREF clrLight, COLORREF clrDark, float fGradientFactor = 0.5f); /** * @brief * This member function will sets the application defined 4 color gradient values for * the CXTPPaintManagerColorGradient class. * @param clr An RGB COLORREF value representing the dark and light colors. */ void SetCustomValue(const COLORREF clr); /** * @brief * This member function will sets the application defined 4 color gradient values for * the CXTPPaintManagerColorGradient class. * @param clrref An reference to CXTPPaintManagerColorGradient value representing the dark * and light colors. */ void SetCustomValue(CXTPPaintManagerColorGradient& clrref); /** * @brief * This member function will sets the application defined 4 color gradient values for * the CXTPPaintManagerColorGradient class. * @param clrLight An RGB COLORREF value representing the light color. * @param clrDark An RGB COLORREF value representing the dark color. */ void SetCustomValue(COLORREF clrLight, COLORREF clrDark); /** * @brief * Operator used to retrieve an RGB color value that represents * the dark gradient color used for the CXTPPaintManagerColorGradient class. * @return * An RGB value that represents the dark gradient color. */ operator COLORREF() const; /** * @brief * Retrieves a reference to the CXTPPaintManagerColor dark gradient color * member. * @return * A reference to the CXTPPaintManagerColor dark gradient color used * for the CXTPPaintManagerColorGradient class. */ operator CXTPPaintManagerColor&(); /** * @brief * This operator copy all values from the specified source object; * @param refSrc Reference to CXTPPaintManagerColorGradient source object. * @return Self reference. * @see * SetStandardValue, SetCustomValue */ const CXTPPaintManagerColorGradient& operator=(const CXTPPaintManagerColorGradient& refSrc); /** * @brief * Determines if the CXTPPaintManagerColorGradient object's colors * have been initialized. * @return * TRUE if both light and dark gradient colors have not been initialized, * otherwise FALSE. */ BOOL IsNull() const; /** * @brief * This method reads or writes data from or to an archive. * @param ar A CArchive object to serialize to or from. */ virtual void Serialize(CArchive& ar); public: CXTPPaintManagerColor clrLight; /**< Light color. */ CXTPPaintManagerColor clrDark; /**< Dark color. */ float fGradientFactor; /**< Gradient divider factor */ }; /** @cond */ AFX_INLINE CXTPPaintManagerColorGradient::operator COLORREF() const { return clrDark; } AFX_INLINE CXTPPaintManagerColorGradient::operator CXTPPaintManagerColor&() { return clrDark; } AFX_INLINE BOOL CXTPPaintManagerColorGradient::IsNull() const { return ((clrDark == COLORREF_NULL) && (clrLight == COLORREF_NULL)); } AFX_INLINE const CXTPPaintManagerColorGradient& CXTPPaintManagerColorGradient:: operator=(const CXTPPaintManagerColorGradient& refSrc) { clrLight = refSrc.clrLight; clrDark = refSrc.clrDark; fGradientFactor = refSrc.fGradientFactor; return *this; } /** @endcond */ /** * @brief * CXTPColorManager is a stand alone class. This object is used for manipulation of * RGB values. * @see * XTPColorManager */ class _XTP_EXT_CLASS CXTPColorManager : public CXTPCmdTarget { friend class CXTPSingleton
* Constant Value Description< * ---------------------------------------------------------------------------------- * COLOR_SCROLLBAR 0 Scroll bar color * COLOR_BACKGROUND 1 Desktop color * COLOR_ACTIVECAPTION 2 Color of the title bar for the active window, * Specifies the left side color in the color * gradient of an active window's title bar if * the gradient effect is enabled. * COLOR_INACTIVECAPTION 3 Color of the title bar for the inactive window, * Specifies the left side color in the color * gradient of an inactive window's title bar if * the gradient effect is enabled. * COLOR_MENU 4 Menu background color * COLOR_WINDOW 5 Window background color * COLOR_WINDOWFRAME 6 Window frame color * COLOR_MENUTEXT 7 Color of text on menus * COLOR_WINDOWTEXT 8 Color of text in windows * COLOR_CAPTIONTEXT 9 Color of text in caption, size box, and scroll arrow * COLOR_ACTIVEBORDER 10 Border color of active window * COLOR_INACTIVEBORDER 11 Border color of inactive window * COLOR_APPWORKSPACE 12 Background color of multiple-document interface * (MDI) applications * COLOR_HIGHLIGHT 13 Background color of items selected in a control * COLOR_HIGHLIGHTTEXT 14 Text color of items selected in a control * COLOR_BTNFACE 15 Background color for three-dimensional display * elements and for dialog box backgrounds. * COLOR_BTNSHADOW 16 Color of shading on the edge of command buttons * COLOR_GRAYTEXT 17 Grayed (disabled) text * COLOR_BTNTEXT 18 Text color on push buttons * COLOR_INACTIVECAPTIONTEXT 19 Color of text in an inactive caption * COLOR_BTNHIGHLIGHT 20 Highlight color for 3-D display elements * COLOR_3DDKSHADOW 21 Darkest shadow color for 3-D display * elements COLOR_3DLIGHT 22 Second lightest 3-D color after 3DHighlight, * Light color for three-dimensional display elements * (for edges facing the light source.) * COLOR_INFOTEXT 23 Color of text in ToolTips * COLOR_INFOBK 24 Background color of ToolTips * COLOR_HOTLIGHT 26 Color for a hot-tracked item. Single clicking a * hot-tracked item executes the item. * COLOR_GRADIENTACTIVECAPTION 27 Right side color in the color gradient of an active * window's title bar. COLOR_ACTIVECAPTION specifies * the left side color. * COLOR_GRADIENTINACTIVECAPTION 28 Right side color in the color gradient of an inactive * window's title bar. COLOR_INACTIVECAPTION specifies * the left side color. * XPCOLOR_TOOLBAR_FACE 30 Office XP Style toolbar background color. * XPCOLOR_HIGHLIGHT 31 Office XP Style menu item selected color. * XPCOLOR_HIGHLIGHT_BORDER 32 Office XP Style menu item selected border color. * XPCOLOR_HIGHLIGHT_PUSHED 33 Office XP Style menu item pushed color. * XPCOLOR_ICONSHADDOW 34 Office XP Style menu item icon shadow. * XPCOLOR_GRAYTEXT 35 Office XP Style menu item disabled text color. * XPCOLOR_HIGHLIGHT_CHECKED 36 Office XP Style menu item checked color. * XPCOLOR_HIGHLIGHT_CHECKED_BORDER 37 An RGB value that represents the Office XP Style menu * item checked border color. * XPCOLOR_TOOLBAR_GRIPPER 38 Office XP Style toolbar gripper color. * XPCOLOR_SEPARATOR 39 Office XP Style toolbar separator color. * XPCOLOR_DISABLED 40 Office XP Style menu icon disabled color. * XPCOLOR_MENUBAR_FACE 41 Office XP Style menu item57- text background color. * XPCOLOR_MENUBAR_EXPANDED 42 Office XP Style hidden menu commands background color. * XPCOLOR_MENUBAR_BORDER 43 Office XP Style menu border color. * XPCOLOR_MENUBAR_TEXT 44 Office XP Style menu item text color. * XPCOLOR_HIGHLIGHT_TEXT 45 Office XP Style menu item selected text color. * XPCOLOR_CHECKED_TEXT 45 Office XP Style color for text displayed in a * checked button. * XPCOLOR_TOOLBAR_TEXT 46 Office XP Style toolbar text color. * XPCOLOR_PUSHED_TEXT 47 Office XP Style toolbar pushed text color. * XPCOLOR_TAB_INACTIVE_BACK 48 Office XP Style inactive tab background color. * XPCOLOR_TAB_INACTIVE_TEXT 49 Office XP Style inactive tab text color. * XPCOLOR_HIGHLIGHT_PUSHED_BORDER 50 An RGB value that represents the Office XP Style * border color for pushed in 3D elements. * XPCOLOR_3DFACE 51 Office XP Style face color for three- dimensional * display elements and for dialog box backgrounds. * XPCOLOR_3DSHADOW 52 Office XP Style shadow color for three-dimensional * display elements (for edges facing away from the * light source). * XPCOLOR_EDITCTRLBORDER 53 Office XP Style color for the border color of edit * controls. * XPCOLOR_FRAME 54 Office 2003 frame color. * XPCOLOR_SPLITTER_FACE 55 Office XP Style splitter face color. * XPCOLOR_LABEL 56 Color for label control (xtpControlLabel) * XPCOLOR_STATICFRAME 57 Static frame color * XPCOLOR_HIGHLIGHT_DISABLED_BORDER 58 Highlighted disabled border color * XPCOLOR_SHADOW_FACTOR 59 Shadow factor color * XPCOLOR_TOOLBAR_GRAYTEXT 60 Toolbar gray text color * XPCOLOR_FLOATBAR_BORDER 61 Floatbar border color * XPCOLOR_LAST 62 The last color value ** @return * The red, green, blue (RGB) color value of the given element. */ COLORREF GetColor(int nIndex) const; /** * @brief * Call this member function to get the Luna color specified by nIndex. * @param nIndex Specifies the display element whose color is to be * retrieved. * @return * An RGB color value representing the Luna color. */ COLORREF GetLunaColor(int nIndex) const; /** * @brief * Call this member function to blend the light and dark colors * by the amount specified in nDelta. * @param clrLight RGB light color * @param clrDark RGB dark color * @param nDelta Amount saturation to blend colors. * @return * An RGB color value representing the two blended colors. */ COLORREF LightColor(COLORREF clrLight, COLORREF clrDark, int nDelta) const; /** * @brief * Call this member function to disable the luna (Blue, Olive * and Green) colors for Office 2003 theme for Windows XP and * later operating systems. * @param bDisable TRUE to disable luna colors, otherwise FALSE. */ void DisableLunaColors(BOOL bDisable = TRUE); /** * @brief * Determines if Luna colors for Office 2003 style is disabled. * @return * TRUE if the luna colors are disabled, otherwise FALSE. */ BOOL IsLunaColorsDisabled() const; /** * @brief * Call this member to set the color for the specified index. * See GetColor for a complete list of index values. * @param nIndex Color index. * @param clrValue RGB color value to set. * @see * SetColors */ void SetColor(int nIndex, COLORREF clrValue); /** * @brief * Call this member to set the colors for each element to the * color in the specified color array. * @param cElements Number of elements in array. * @param lpaElements Array of elements. * @param lpaRgbValues Array of RGB values. * @see * SetColor */ void SetColors(int cElements, const int* lpaElements, const COLORREF* lpaRgbValues); /** * @brief * Call this member to set the Office 2003 Luna colors for each element to correspond with * the current Windows XP visual style. * @see * SetColor, SetColors */ void RefreshLunaColors(); /** * @brief * Call this member function to determine the current Windows XP * theme in use. * @return * A XTPCurrentSystemTheme enumeration that represents the * current Windows theme in use, can be one of the following * values: * xtpSystemThemeUnknown: Indicates no known theme in use. * xtpSystemThemeBlue: Indicates blue theme in use. * xtpSystemThemeOlive: Indicates olive theme in use. * xtpSystemThemeSilver: Indicates silver theme in use. * @see * SetLunaTheme, RefreshLunaColors */ XTPCurrentSystemTheme GetCurrentSystemTheme() const; /** * @brief * Call this member function to determine the current Windows XP * theme in use. * @return * A XTPCurrentSystemTheme enumeration that represents the * current Windows theme in use, can be one of the following * values: * xtpSystemThemeUnknown: Indicates no known theme in use. * xtpSystemThemeBlue: Indicates blue theme in use. * xtpSystemThemeOlive: Indicates olive theme in use. * xtpSystemThemeSilver: Indicates silver theme in use. */ XTPCurrentSystemTheme GetWinThemeWrapperTheme() const; /** * @brief * Call this method to force system theme. * @param systemTheme theme to use. Can be any of the values listed in the Remarks section. * @details * Theme can be one of the following: * xtpSystemThemeUnknown: Disables luna theme support. * xtpSystemThemeBlue: Enables blue theme. * xtpSystemThemeOlive: Enables olive theme. * xtpSystemThemeSilver: Enables silver theme. */ void SetLunaTheme(XTPCurrentSystemTheme systemTheme); /** * @brief * This method replace standard GetSysColor to application defined. * @param pfnGetSysColor Pointer to the PFNGETSYSCOLOR procedure */ void SetGetSysColorPtr(PFNGETSYSCOLOR pfnGetSysColor); /** * @brief * Call this member function to determine if the system display * is set to low resolution. * @param hDC Handle to a device context, if NULL the desktop window * device context is used. * @return * TRUE if the system display is set to low resolution, * otherwise FALSE. */ BOOL IsLowResolution(HDC hDC = 0); public: BOOL LongColor(COLORREF clrMain, COLORREF clrSub, BOOL bCalcLength, float fDistance); private: CXTPColorManager(); void RefreshSysColors(); void RefreshXPColors(); void RefreshGradientColors(); float ColorWidth(int nLength, int nWidth); float ColorDelta(COLORREF clrA, COLORREF clrB); float Length(COLORREF clrA, COLORREF clrB); COLORREF MixColor(COLORREF clrMain, COLORREF clrSub, float fDistance); COLORREF AdjustColor(COLORREF clrMain, COLORREF clrSub, float fDistance); double GetRDelta(COLORREF clr); double GetGDelta(COLORREF clr); double GetBDelta(COLORREF clr); XTPCurrentSystemTheme _GetWinThemeWrapperTheme(); public: CXTPPaintManagerColorGradient grcCaption; /**< Office 2003 Caption gradient color. */ CXTPPaintManagerColorGradient grcDockBar; /**< Office 2003 Dockbar gradient color. */ CXTPPaintManagerColorGradient grcShortcutBarGripper; /**< Office 2003 Shortcut bar gripper. */ CXTPPaintManagerColorGradient grcToolBar; /**< Office 2003 ToolBar gradient color. */ CXTPPaintManagerColorGradient grcMenu; /**< Office 2003 Menu sidebar gradient color. */ CXTPPaintManagerColorGradient grcMenuExpanded; /**< Office 2003 Expanded menu sidebar gradient color. */ CXTPPaintManagerColorGradient grcMenuItemPopup; /**< Office 2003 Menu item pop-up gradient color. */ CXTPPaintManagerColorGradient grcLunaChecked; /**< Office 2003 checked button gradient color. */ CXTPPaintManagerColorGradient grcLunaPushed; /**< Office 2003 pushed button gradient color. */ CXTPPaintManagerColorGradient grcLunaSelected; /**< Office 2003 selected button gradient color. */ BOOL m_bEnableLunaBlueForRoyaleTheme; /**< TRUE if Office2003 blue theme will be used for xtpSystemThemeRoyale */ BOOL m_bEnableLunaBlueForAeroTheme; /**< TRUE if Office2003 blue theme will be used for xtpSystemThemeAero */ private: BOOL m_bDisableLunaColors; COLORREF m_arrStandardColor[XPCOLOR_LAST + 1]; COLORREF m_arrCustomColor[XPCOLOR_LAST + 1]; COLORREF m_arrLunaColor[XPCOLOR_LAST + 1]; PFNGETSYSCOLOR m_pfnGetSysColor; XTPCurrentSystemTheme m_systemTheme; XTPCurrentSystemTheme m_winThemeWrapperTheme; # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPColorManager); void OleSetColor(int nIndex, OLE_COLOR clr); void OleRefreshColors(); virtual void OnFinalRelease(); /** @endcond */ # endif }; /** * @brief * Call this function to access CXTPColorManager members. * Since this class is designed as a single instance object you can * only access version info through this method. You cannot * directly instantiate an object of type CXTPColorManager. * * Example: *
* COLORREF cr = XTPColorManager()->GetColor(nIndex); ** @return A global color manager object pointer. */ _XTP_EXT_CLASS CXTPColorManager* AFX_CDECL XTPColorManager(); /** * @brief * Call this member as a convenient way to call * XTPColorManager()->GetColor, see CXTPColorManager::GetColor for * more details. * @param nIndex Specifies the display element whose color is to be * retrieved. * @return * The red, green, blue (RGB) color value of the given element. * * Example: *
* if (eState == xtMouseNormal)
* {
* pDC->Draw3dRect(rcItem,
* GetXtremeColor(COLOR_3DFACE),
* GetXtremeColor(COLOR_3DFACE));
* }
*
* @see
* CXTPColorManager::GetColor
*/
_XTP_EXT_CLASS COLORREF AFX_CDECL GetXtremeColor(UINT nIndex);
/**
* @brief
* Call this function to get the MS Office color represented by nIndex.
* @param nIndex Specifies the display element whose color is to be
* retrieved.
* @return
* An RGB color value representing the color value of the MS Office color.
*
* Example:
*
* switch (XTPColorManager()->GetCurrentSystemTheme())
* {
* case xtpSystemThemeBlue:
* case xtpSystemThemeOlive:
* case xtpSystemThemeSilver:
* m_clr3DFacePushed.SetStandardValue(GetMSO2003Color(XPCOLOR_HIGHLIGHT_PUSHED));
* m_clr3DFaceHilite.SetStandardValue(GetMSO2003Color(XPCOLOR_HIGHLIGHT));
* m_clrBtnTextPushed.SetStandardValue(GetMSO2003Color(XPCOLOR_PUSHED_TEXT));
* m_clrBtnTextHilite.SetStandardValue(GetMSO2003Color(XPCOLOR_HIGHLIGHT_TEXT));
* m_clrBorder3DShadow.SetStandardValue(GetMSO2003Color(XPCOLOR_HIGHLIGHT_BORDER));
* m_clrBorder3DHilite.SetStandardValue(GetMSO2003Color(XPCOLOR_HIGHLIGHT_BORDER));
* break;
* }
*
* @see
* CXTPColorManager::GetColor
*/
_XTP_EXT_CLASS COLORREF AFX_CDECL GetMSO2003Color(UINT nIndex);
/**
* @brief
* This global function will refresh the display element
* colors defined in the CXTPColorManager class.
* @param bResetCustomColors If FALSE, all custom colors will remain unchanged.
* @return
* @see
* CXTPColorManager::RefreshColors
*/
_XTP_EXT_CLASS void AFX_CDECL RefreshXtremeColors(BOOL bResetCustomColors = TRUE);
/**
* @brief
* Defines a set of accent related colors.
*/
enum XTPPaintManagerAccentColor
{
xtpPaintManagerAccentColor, /**< The actual accent color. */
xtpPaintManagerNormalBackAccentColor, /**< The background accent color in normal state. */
xtpPaintManagerHighlightBackAccentColor, /**< The background accent color in highlighted state.
*/
xtpPaintManagerPressedBackAccentColor, /**< The background accent color in pressed state. */
xtpPaintManagerNormalTextAccentColor, /**< The text accent color in normal state. */
xtpPaintManagerHighlightTextAccentColor, /**< The text accent color in highlighted state. */
xtpPaintManagerPressedTextAccentColor /**< The text accent color in pressed state. */
};
/**
* @brief
* Calculate the specified accent color value.
* @param nColor Accent color identifier.
* @return Returns accent color value
*/
_XTP_EXT_CLASS COLORREF AFX_CDECL XTPGetAccentColor(XTPPaintManagerAccentColor nColor);
/**
* @brief
* Retrieves the current color used for Desktop Window Manager (DWM) glass composition. This
* value is based on the current color scheme and can be modified by the user. Applications can
* listen for color changes by handling the WM_DWMCOLORIZATIONCOLORCHANGED notification.
* @return
* The current color used for glass composition or COLORREF_NULL if unable to obtain the value.
*/
_XTP_EXT_CLASS COLORREF AFX_CDECL XTPGetColorizationColor();
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPCOLORMANAGER_H__)
/** @endcond */