/** * @file XTPTabPaintManagerColorSet.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(__XTPTABPAINTMANAGERCOLORSET_H__) # define __XTPTABPAINTMANAGERCOLORSET_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPTabManagerItem; class CXTPTabManager; class CXTPTabManagerNavigateButton; class CXTPTabPaintManager; /** * @brief * CXTPTabPaintManagerColorSet represents the colors for all of the * components of the tab manager (e.g. tab button, tab button border, etc.). * @details * CXTPTabPaintManagerColorSet colorizes the different parts that make up * a tab, tab header, tab client, and tab manager control. * * Colors should be updated by using the RefreshMetrics method for each * CXTPTabPaintManagerColorSet object. */ class _XTP_EXT_CLASS CXTPTabPaintManagerColorSet { public: /** * @brief * Colors used for Excel tab button colorization. * @details * Members of COLORSET_TAB_EXCEL are only used when the * XTPTabAppearanceStyle is set to xtpTabAppearanceExcel2003. * * Both the m_csExcelSelected and m_csExcelNormal color sets are * used when the xtpTabAppearanceExcel2003 appearance is applied. * * By default, the "selected" excel style tab will display * clrLeftInnerBorder and clrTopInnerBorder in addition to * the outer borders to indicate that the tab is selected. * * The following color sets customize members of COLORSET_TAB_EXCEL * in addition to the color members of CXTPTabPaintManagerColorSet: * CXTPTabColorSetOffice2003: Office 2003 Color Set. * CXTPTabColorSetDefault: Default Color Set. * @see * m_csExcelSelected, m_csExcelNormal */ struct COLORSET_TAB_EXCEL { CXTPPaintManagerColor clrLeftInnerBorder; /**< Color of the left inner border of the tab button. */ CXTPPaintManagerColor clrTopInnerBorder; /**< Color of the top inner border of the tab button. */ CXTPPaintManagerColor clrRightInnerBorder; /**< Color of the right inner border of the tab button. */ CXTPPaintManagerColor clrLeftOuterBorder; /**< Color of the left outer border of the tab button. */ CXTPPaintManagerColor clrRightOuterBorder; /**< Color of the right outer border of the tab button. */ CXTPPaintManagerColor clrTopOuterBorder; /**< Color of the top outer border of the tab button. */ }; /** * @brief * Colors used for Office 2000 tab button colorization. * @details * The tab buttons and the tab client area cast a shadow. The shadow consists * of both a normal and a dark color. One or both of these colors can be used * depending on the selected XTPTabAppearanceStyle. * * Members of COLORSET_TAB_PROPERTYPAGE are only used when the * XTPTabAppearanceStyle is set to either xtpTabAppearancePropertyPage, * xtpTabAppearancePropertyPageFlat, xtpTabAppearancePropertyPageSelected, * or xtpTabAppearancePropertyPage2003. * * The following color sets customize members of COLORSET_TAB_PROPERTYPAGE * in addition to the color members of CXTPTabPaintManagerColorSet: * CXTPTabColorSetOffice2003: Office 2003 Color Set. * CColorSetWinNative: Windows XP Color Set. * CXTPTabColorSetDefault: Default Color Set. * @see * m_csPropertyPage */ struct COLORSET_TAB_PROPERTYPAGE { CXTPPaintManagerColor clrHighlight; /**< Color of tab button on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor clrShadow; /**< Color of the tab button's shadow. */ CXTPPaintManagerColor clrDarkShadow; /**< Color of the tab button's dark shadow. */ }; /** * @brief * Colors used for Office 2003 tab button colorization. * @details * Members of COLORSET_TAB_PROPERTYPAGE2003 are only used when the * XTPTabAppearanceStyle is set to xtpTabAppearancePropertyPage2003. * * The following color sets customize members of COLORSET_TAB_PROPERTYPAGE2003 * in addition to the color members of CXTPTabPaintManagerColorSet: * CXTPTabColorSetOffice2003: Office 2003 Color Set. * CColorSetVisualStudio2005: Visual Studio 2005 Color Set. * CXTPTabColorSetDefault: Default Color Set. * @see * m_csPropertyPage2003 */ struct COLORSET_TAB_PROPERTYPAGE2003 { CXTPPaintManagerColor clrDarkShadow; /**< Color of the shadow of a tab button. */ CXTPPaintManagerColor clrFrameBorder; /**< Color of the XTPTabClientFrame. */ CXTPPaintManagerColor clrBorderLeftHighlight; /**< Color of the left border of a tab button. */ CXTPPaintManagerColor clrBorderTopHighlight; /**< Color of the top border of a tab button. */ }; /** * @brief * Colors used for "State Button" tab button colorization. * @details * Members of COLORSET_TAB_STATEBUTTON are only used when the * XTPTabAppearanceStyle is set to xtpTabAppearanceStateButtons. * * The following color sets customize members of COLORSET_TAB_STATEBUTTON * in addition to the color members of CXTPTabPaintManagerColorSet: * CXTPTabColorSetOffice2003: Office 2003 Color Set. * CXTPTabColorSetDefault: Default Color Set. * @see * m_csStateButton */ struct COLORSET_TAB_STATEBUTTON { CXTPPaintManagerColorGradient clrFace; /**< Color of the currently selected tab button. */ CXTPPaintManagerColorGradient clrBorder; /**< Border color of the currently selected tab button. */ }; public: /** * @brief * Constructs a CXTPTabPaintManagerColorSet object. */ CXTPTabPaintManagerColorSet(); /** * @brief * Destroys a CXTPTabPaintManagerColorSet object, handles cleanup and deallocation. */ virtual ~CXTPTabPaintManagerColorSet(); public: /** * @brief * Refreshes the visual metrics of the tabs. * Override this method to change the colors of the color members. * @details * All of the color members are refreshed when this method is called. */ virtual void RefreshMetrics(); public: /** * @brief * Sets the text color for the tab. * @param pDC Pointer to a valid device context. * @param pItem Pointer to the tab to set the text color of. */ virtual void SetTextColor(CDC* pDC, CXTPTabManagerItem* pItem); /** * @brief * Fills the header of the tab client of a specified tab manager. * @param pDC Pointer to a valid device context. * @param rc Bounding rectangle of the tab header. * @param pTabManager Pointer to the tab manager with the header to fill. * @details * The tab client header is the bounding rectangle containing the tab buttons. * The bounding rectangle can be retrieved by using the * CXTPTabPaintManagerTheme::GetHeaderRect and * CXTPTabManager::GetHeaderRect methods. * @see * CXTPTabPaintManagerTheme::GetHeaderRect, CXTPTabManager::GetHeaderRect */ virtual void FillHeader(CDC* pDC, CRect rc, CXTPTabManager* pTabManager); /** * @brief * Fills the tab client area of a specified tab manager. * @param pDC Pointer to a valid device context. * @param rc Bounding rectangle of the tab client area. * @param pTabManager Pointer to the tab manager with the tab client area to fill. * @details * The tab client bounding rectangle can be retrieved by using the * CXTPTabPaintManagerTheme::GetClientRect and * CXTPTabManager::GetClientRect members. * @return * The fill color value. */ virtual COLORREF FillClient(CDC* pDC, CRect rc, CXTPTabManager* pTabManager); /** * @brief * Obtains client background color. * @param pTabManager Pointer to the tab manager with the tab client area to fill. * @return * Client area background color value. */ virtual COLORREF GetClientColor(CXTPTabManager* pTabManager); /** * @brief * Fills a specified tab button when XTPTabAppearanceStyle * is xtpTabAppearanceStateButtons. * @param pDC Pointer to a valid device context. * @param rcItem Bounding rectangle of the tab button to fill. * @param pItem Pointer to the tab button to fill. * @details * This method is only used to fill buttons when XTPTabAppearanceStyle * is xtpTabAppearanceStateButtons. Otherwise, FillPropertyButton is used. * @see * FillPropertyButton */ virtual void FillStateButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem); /** * @brief * Fills a specified tab button. * @param pDC Pointer to a valid device context. * @param rcItem Bounding rectangle of the tab button to fill. * @param pItem Pointer to the tab button to fill. * @return * The color of the specified tab button. * @details * This method is used to fill all tab buttons except when * XTPTabAppearanceStyle is set to xtpTabAppearanceStateButtons. * xtpTabAppearanceStateButtons requires the FillStateButton member. * @see * FillStateButton */ virtual COLORREF FillPropertyButton(CDC* pDC, CRect rcItem, CXTPTabManagerItem* pItem); /** * @brief * Sets a clipping region for the specified tab client area. * @param pDC Pointer to a valid device context. * @param rcClient Bounding rectangle of the tab client area. This will * be the clipping region for the device context. * @param pTabManager Pointer to the tab manager. */ virtual void SelectClipRgn(CDC* pDC, CRect rcClient, CXTPTabManager* pTabManager); /** * @brief * Fills a specified tab navigation button. * @param pDC Pointer to a valid device context. * @param pButton Pointer to the tab navigation button to fill. * @param rc Reference to the bounding rectangle of the tab navigation button. * @details * This method is used to fill the tab navigation buttons in the header of * the tab client and is overridden by XTPTabColorStyle and * CXTPTabPaintManagerColorSet to perform actions such as painting * the highlighted, pressed, and normal versions of tab navigation buttons. * * This method must be overridden. * @see * CXTPTabManager::GetNavigateButton, CXTPTabManagerNavigateButton */ virtual void FillNavigateButton(CDC* pDC, CXTPTabManagerNavigateButton* pButton, CRect& rc) = 0; /** * @brief * Retrieves the color of a specified tab. * @param pItem Pointer to the tab with the color to retrieve. * @return * The color of the tab. * @details * This method is used within many of * CXTPTabPaintManagerColorSet's "fill" methods. * @see * CXTPTabManager::GetItemColor, XTPTabColorStyle, * SetColor, GetColorSet, SetColorSet */ virtual COLORREF GetItemColor(CXTPTabManagerItem* pItem); /** * @brief * Performs a gradient fill of a rectangle with a color that * smoothly fades from top to bottom. * @param pDC Pointer to a valid device context. * @param rc Rectangle to fill. * @param clrLight COLORREF to start the gradient from. * @param clrDark COLORREF to end the gradient with. * @param position Position of the tab buttons; one of the values * defined by the XTPTabPosition enumeration. * @details * The color smoothly fades from clrLight at the top to clrDark at the bottom. * * If clrLight is XTP_TABMANAGER_COLOR_SHADED, then the rectangle will * be filled with a special "shaded" fill type and clrDark will * be ignored. See the description of XTP_TABMANAGER_COLOR_SHADED for * more information on this fill type. * @see * XTP_TABMANAGER_COLOR_SHADED */ void GradientFill(CDC* pDC, CRect rc, COLORREF clrLight, COLORREF clrDark, XTPTabPosition position); /** * @brief * Determines if Windows XP themes are enabled and if * a Windows XP theme is currently used. * @return * Always returns FALSE in the base class implementation. * @details * This method is overridden in CXTPTabPaintManager::CColorSetWinNative. * @see * CXTPTabPaintManager::CColorSetWinNative::IsAppThemed */ virtual BOOL IsAppThemed() const; public: CXTPPaintManagerColorGradient m_clrHeaderFace; /**< Color set of the tab header background. */ CXTPPaintManagerColorGradient m_clrAutoHideFace; /**< Color set of the auto-hide panel background. This is the tab header for docking pane tabs when the pane is hidden. */ CXTPPaintManagerColor m_clrFrameBorder; /**< Color of the border placed around the tab buttons and the tab client. */ CXTPPaintManagerColor m_clrControlFace; /**< Color of the control foreground. This is the area that the tab header and tab client are drawn on. */ CXTPPaintManagerColor m_clrPaneFace; /**< Color of the control pane foreground. */ CXTPPaintManagerColor m_clrBorderHighlight; /**< Color of the highlight border. */ CXTPPaintManagerColor m_clrTabClientBack; /**< Background color for the tab client area. */ CXTPPaintManagerColor m_clrTabClientBorder; /**< Border color for the tab client area. */ CXTPPaintManagerColor m_clrButtonNormal; /**< Color of normal tabs. Normal tabs are tabs that are not selected or disabled. */ CXTPPaintManagerColor m_clrButtonPressed; /**< Tab pressed button color. */ CXTPPaintManagerColor m_clrButtonHighlighted; /**< Tab button color on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor m_clrButtonHighlightedClose; /**< Tab close button color on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor m_clrButtonBorderHighlighted; /**< Tab button border color on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor m_clrButtonBorderTabContext1; /**< Tab button border color with tab context. */ CXTPPaintManagerColor m_clrButtonBorderTabContext2; /**< Tab button border color with tab context. */ CXTPPaintManagerColor m_clrButtonBorderKeyTips; /**< Tab button border color when ALT button is pressed */ CXTPPaintManagerColor m_clrButtonSelected; /**< Color of the currently selected tab. */ CXTPPaintManagerColor m_clrButtonSelectedPressed; /**< Color of the currently selected tab when pressed. */ CXTPPaintManagerColor m_clrButtonSelectedHighlighted; /**< Color of the currently selected tab when highlighted. */ CXTPPaintManagerColor m_clrButtonBorder; /**< Tab button border (edge) color. */ CXTPPaintManagerColor m_clrButtonBorderHot; /**< Tab button highlight or pressed border (edge) color. */ CXTPPaintManagerColor m_clrTextNormal; /**< Color of text in a normal tab. Normal tabs are tabs that are not selected or disabled. */ CXTPPaintManagerColor m_clrTextPressed; /**< Color of text in a "pressed" tab button. The "pressed" tab button is the tab with focus (i.e. the tab becomes active when it is clicked). */ CXTPPaintManagerColor m_clrTextHighlight; /**< Color of text on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor m_clrTextHighlightClose; /**< Color of close button text on mouse over when hot tracking is enabled. */ CXTPPaintManagerColor m_clrTextSelected; /**< Color of text in a "selected" tab button. The "selected" tab button is the tab with focus (i.e. the tab becomes active when it is clicked). */ CXTPPaintManagerColor m_clrTextSelectedPressed; /**< Color of text in a "pressed" tab button. The "pressed" tab button is the tab with focus (i.e. The tab becomes active when it is clicked). */ CXTPPaintManagerColor m_clrTextSelectedHighlighted; /**< Color of text for tabs in all non-active groups of tabs in MDITabClient. */ CXTPPaintManagerColor m_clrTextDisabled; /**< Color of text when a tab is disabled. A disabled tab cannot receive focus. */ CXTPPaintManagerColor m_clrActiveFilesGlyph; /**< Color of navigation button. */ CXTPPaintManagerColor m_clrActiveFilesGlyphHighlighted; /**< Color of highlighted navigation button. */ CXTPPaintManagerColor m_clrActiveFilesGlyphPressed; /**< Color of selected navigation button. */ CXTPPaintManagerColor m_clrActiveFilesBack; /**< Color of highlighted navigation button background. */ CXTPPaintManagerColor m_clrActiveFilesBackHighlighted; /**< Color of navigation button background. */ CXTPPaintManagerColor m_clrActiveFilesBackPressed; /**< Color of selected navigation button background. */ COLORSET_TAB_STATEBUTTON m_csStateButton; /**< Color set of state button style tabs. */ COLORSET_TAB_PROPERTYPAGE m_csPropertyPage; /**< Color set of visual studio style tabs. */ COLORSET_TAB_PROPERTYPAGE2003 m_csPropertyPage2003; /**< Color set of Office 2003 style tabs. */ COLORSET_TAB_EXCEL m_csExcelSelected; /**< Color set of selected (focused) Excel style tabs. */ COLORSET_TAB_EXCEL m_csExcelNormal; /**< Color set of normal Excel style tabs. */ CXTPPaintManagerColor m_clrFrameHighlightBorder; /** @cond */ __declspec(property(get = GetTextSelected, put = SetTextSelected)) CXTPPaintManagerColor& m_clrSelectedText; _XTP_DEPRECATED_IN_FAVOR(m_clrTextSelected) CXTPPaintManagerColor& GetTextSelected(); _XTP_DEPRECATED_IN_FAVOR(m_clrTextSelected) const CXTPPaintManagerColor& GetTextSelected() const; _XTP_DEPRECATED_IN_FAVOR(m_clrTextSelected) CXTPPaintManagerColor& SetTextSelected(const CXTPPaintManagerColor& clr); /** @endcond */ protected: CXTPTabPaintManager* m_pPaintManager; /**< Self paint manager pointer. */ friend class CXTPTabPaintManager; }; /** @cond */ AFX_INLINE void CXTPTabPaintManagerColorSet::SelectClipRgn(CDC* /*pDC*/, CRect /*rcClient*/, CXTPTabManager* /*pTabManager*/) { } AFX_INLINE CXTPPaintManagerColor& CXTPTabPaintManagerColorSet::GetTextSelected() { return m_clrTextSelected; } AFX_INLINE const CXTPPaintManagerColor& CXTPTabPaintManagerColorSet::GetTextSelected() const { return m_clrTextSelected; } AFX_INLINE CXTPPaintManagerColor& CXTPTabPaintManagerColorSet::SetTextSelected(const CXTPPaintManagerColor& clr) { m_clrTextSelected = clr; return m_clrTextSelected; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPTABPAINTMANAGERCOLORSET_H__) /** @endcond */