/** * @file XTPRibbonMarkupTheme.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(__XTPRIBBONMARKUPTHEME_H__) # define __XTPRIBBONMARKUPTHEME_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarkupContext; class CXTPRibbonTabContextHeader; /** * @brief * Defines ribbon theme parts. */ enum XTPRibbonThemePart { xtpRibbonFrameCaptionActive, /**< Specifies an active frame caption ribbon theme part. */ xtpRibbonFrameCaptionInactive, /**< Specifies an inactive frame caption ribbon theme part. */ xtpRibbonFrameSystemButtonNormal, /**< Specifies a normal frame system button ribbon theme part. */ xtpRibbonFrameSystemButtonPopuped, /**< Specifies a popup frame system button ribbon theme part. */ xtpRibbonFrameSystemButtonSelected, /**< Specifies a selected frame system button ribbon theme part. */ xtpRibbonGroupControlEntry, /**< Specifies a group control entry ribbon theme part. */ xtpRibbonGroupControlEntryLeft, /**< Specifies a group control entry left ribbon theme part. */ xtpRibbonGroupControlEntryLeftRight, /**< Specifies a group control entry left-right ribbon theme part. */ xtpRibbonGroupControlEntryRight, /**< Specifies a group control entry right ribbon theme part. */ xtpRibbonGroupRect, /**< Specifies a group rectangle ribbon theme part. */ xtpRibbonGroupRectBlue, /**< Specifies a blue group rectangle ribbon theme part. */ xtpRibbonGroupRectCyan, /**< Specifies a cyan group rectangle ribbon theme part. */ xtpRibbonGroupRectGreen, /**< Specifies a green group rectangle ribbon theme part. */ xtpRibbonGroupRectOrange, /**< Specifies an orange group rectangle ribbon theme part. */ xtpRibbonGroupRectPurple, /**< Specifies a purple group rectangle ribbon theme part. */ xtpRibbonGroupRectRed, /**< Specifies a red group rectangle ribbon theme part. */ xtpRibbonGroupRectYellow, /**< Specifies a yellow group rectangle ribbon theme part. */ xtpRibbonScrollButtonLeft, /**< Specifies a left scroll button ribbon theme part. */ xtpRibbonScrollButtonRight, /**< Specifies a right scroll button ribbon theme part. */ xtpRibbonTabHighlighted, /**< Specifies a highlighted tab ribbon theme part. */ xtpRibbonTabSelected, /**< Specifies a selected tab ribbon theme part. */ xtpRibbonTabSelectedFocused, /**< Specifies a focused selected tab ribbon theme part. */ xtpRibbonTabSelectedHighlighted, /**< Specifies a highlighted selected tab ribbon theme part. */ xtpRibbonContextTabBlue, /**< Specifies a blue context tab ribbon theme part. */ xtpRibbonContextTabCyan, /**< Specifies a cyan context tab ribbon theme part. */ xtpRibbonContextTabGreen, /**< Specifies a green context tab ribbon theme part. */ xtpRibbonContextTabOrange, /**< Specifies an orange context tab ribbon theme part. */ xtpRibbonContextTabPurple, /**< Specifies a purple context tab ribbon theme part. */ xtpRibbonContextTabRed, /**< Specifies a red context tab ribbon theme part. */ xtpRibbonContextTabYellow, /**< Specifies a yellow context tab ribbon theme part. */ xtpRibbonTabSelectedBlue, /**< Specifies a selected blue tab ribbon theme part. */ xtpRibbonTabSelectedFocusedBlue, /**< Specifies a selected focuse blue tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedBlue, /**< Specifies a selected highlighted blue tab ribbon theme part. */ xtpRibbonTabSelectedCyan, /**< Specifies a selected cyan tab ribbon theme part. */ xtpRibbonTabSelectedFocusedCyan, /**< Specifies a selected focused cyan tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedCyan, /**< Specifies a selected highlighted cyan tab ribbon theme part. */ xtpRibbonTabSelectedGreen, /**< Specifies a selected green tab ribbon theme part. */ xtpRibbonTabSelectedFocusedGreen, /**< Specifies a selected focused green tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedGreen, /**< Specifies a selected highlighted green tab ribbon theme part. */ xtpRibbonTabSelectedOrange, /**< Specifies a selected orange tab ribbon theme part. */ xtpRibbonTabSelectedFocusedOrange, /**< Specifies a selected focused orange tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedOrange, /**< Specifies a selected highlighted orange tab ribbon theme part. */ xtpRibbonTabSelectedPurple, /**< Specifies a selected purple tab ribbon theme part. */ xtpRibbonTabSelectedFocusedPurple, /**< Specifies a selected focused purple tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedPurple, /**< Specifies a selected highlighted purple tab ribbon theme part. */ xtpRibbonTabSelectedRed, /**< Specifies a selected red tab ribbon theme part. */ xtpRibbonTabSelectedFocusedRed, /**< Specifies a selected focused red tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedRed, /**< Specifies a selected highlighted red tab ribbon theme part. */ xtpRibbonTabSelectedYellow, /**< Specifies a selected yellow tab ribbon theme part. */ xtpRibbonTabSelectedFocusedYellow, /**< Specifies a selected focused yellow tab ribbon theme part. */ xtpRibbonTabSelectedHighlightedYellow, /**< Specifies a selected highlighted yellow tab ribbon theme part. */ xtpRibbonFrameCaptionBackstageLeft, /**< Specifies a frame caption backstage left ribbon theme part. */ xtpRibbonFrameCaptionBackstageRight, /**< Specifies a frame caption backstage right ribbon theme part. */ xtpRibbonThemePartCount /**< The number of theme parts. */ }; class _XTP_EXT_CLASS CXTPRibbonMarkupThemePartGroup : public CXTPMarkupThemePart { public: void SetCaption(LPCTSTR pszCaption); void SetTextColor(COLORREF clrText); void SetFontSize(int nFontSize); void SetFontFamily(LPCTSTR pszFontFamily); }; class _XTP_EXT_CLASS CXTPRibbonMarkupThemePartSystemMenu : public CXTPMarkupThemePart { public: void SetBackgroundColor(COLORREF clrBackground); void SetForegroundColor(COLORREF clrForeground); void SetCaption(LPCTSTR pszCaption); void SetFontSize(int nFontSize); void SetFontFamily(LPCTSTR pszFontFamily); }; /** * @brief * CXTPRibbonMarkupTheme class. */ class _XTP_EXT_CLASS CXTPRibbonMarkupTheme : public CXTPRibbonPaintManager { /** @cond */ DECLARE_DYNAMIC(CXTPRibbonMarkupTheme) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonMarkupTheme object. * @param pPaintManager Pointer to a CXTPPaintManager object. */ CXTPRibbonMarkupTheme(CXTPPaintManager* pPaintManager); /** * @brief * Destroys a CXTPRibbonMarkupTheme object, handles cleanup and deallocation. */ virtual ~CXTPRibbonMarkupTheme(); public: /** * @brief * Loads markup parts from the specified ZIP source. * @param hZip ZIP source to load markup parts from. * @param pMarkupContext Associated markup context. */ void LoadParts(HZIP hZip, CXTPMarkupContext* pMarkupContext = NULL); /** * @brief * Loads markup parts. * @param bReload Re-loads previously loaded parts if TRUE. */ virtual void LoadParts(BOOL bReload = FALSE) = 0; public: /** * @brief * This method is called to fill the background of a ribbon bar control. * @param pDC Pointer to a valid device context * @param pRibbonBar Pointer to the parent ribbon bar. */ void FillRibbonBar(CDC* pDC, CXTPRibbonBar* pRibbonBar); /** * @brief * This method is called to refresh the visual metrics of the manager. * @details * Refreshes all of the colors in the ribbon bar. Many of the colors * used are set with the GROUP_COLOR structure. * @see * GROUP_COLOR */ virtual void RefreshMetrics(); /** * @brief * This method is called to fill the background of a CXTPRibbonGroup. * @param pDC Pointer to a valid device context. * @param pActiveTab Pointer to the tab that is currently active. * @param rcGroups Bounding rectangle of the group. * @details * Performs a gradient fill using the GROUP_COLOR::clrBackground for * the main group background and GROUP_COLOR::clrCaption to fill the * group caption rectangle. * @see * CXTPRibbonGroup::GetRect, GROUP_COLOR */ void FillGroupRect(CDC* pDC, CXTPRibbonTab* pActiveTab, CRect rcGroups); /** * @brief * Draws the specified CXTPRibbonGroup. * @param pDC Pointer to a valid device context. * @param pGroup Pointer to the CXTPRibbonGroup to be drawn. * @details * Draws the entire group including background, caption, and text. * This will not draw the option button or the group pop-up. * @see * GROUP_COLOR, FillRibbonBar, FillGroupRect, RefreshMetrics */ void DrawGroup(CDC* pDC, CXTPRibbonGroup* pGroup); /** * @brief * Renders a Markup string in the Ribbon. * @param pDC Pointer to a valid device context. * @param rc Bounding rectangle for the Markup. * @param lpszText Markup string to render. */ void RenderMarkup(CDC* pDC, CRect rc, LPCTSTR lpszText); /** * @brief * Renders a Markup string in the Ribbon. * @param pDC Pointer to a valid device context. * @param rc Bounding rectangle for the Markup. * @param part XTPRibbonThemePart object */ void RenderMarkup(CDC* pDC, CRect rc, XTPRibbonThemePart part); /** * @brief * Draws the group option button. * @param pDC Pointer to a valid device context. * @param pControlGroupOption Pointer to a CXTPControl object. * @param bDraw TRUE to draw option button, * FALSE to retrieve the size of the control. * @details * The option button is typically used to launch a dialog associated with the group. * It is drawn on the right side of the group caption. * @return * If bDraw is FALSE, then the size of the option button control * will be returned. * @see * CXTPRibbonGroup::ShowOptionButton, CXTPRibbonGroup::GetControlGroupOption */ CSize DrawControlGroupOption(CDC* pDC, CXTPControl* pControlGroupOption, BOOL bDraw); /** * @brief * Calculates the ribbon group option size. * @return * The ribbon group option size. */ CSize GetControlGroupOptionSize() const; /** * @brief * Draws the group pop-up button. * @param pDC Pointer to a valid device context * @param pControlGroupPopup Pointer to a CXTPControlPopup object. * @param bDraw TRUE to draw the group pop-up button, * FALSE to retrieve the size of the control. * @details * A single group button will be displayed if there is not enough room * to display the items in the group. A group pop-up is displayed * when the button is clicked. The pop-up contains all the items in * the group. When a group button is clicked, a CXTPControlPopup * is displayed that contains the items of the group. * @return * If bDraw is FALSE, then the size of the group pop-up button control * will be returned. * @see * CXTPRibbonGroup::GetControlGroupPopup */ CSize DrawControlGroupPopup(CDC* pDC, CXTPControlPopup* pControlGroupPopup, BOOL bDraw); /** * @brief * This method is called to draw the pop-up toolbar of a reduced group. * @param pDC Pointer to a valid device context. * @param pGroup Parent group of pop-up'ed toolbar. * @param pCommandBar Pop-up toolbar to draw. */ void FillGroupPopupToolBar(CDC* pDC, CXTPRibbonGroup* pGroup, CXTPCommandBar* pCommandBar); /** * @brief * This method is called to draw the Quick Access customize button. * @param pDC Pointer to a valid device context. * @param pControl Pointer to the Quick Access customize button. * @see * DrawRibbonQuickAccessMoreButton */ virtual void DrawRibbonQuickAccessButton(CDC* pDC, CXTPControlPopup* pControl); /** * @brief * This method is called to draw the Quick Access more button. * @param pDC Pointer to a valid device context. * @param pControl Pointer to the Quick Access more button. * @see * DrawRibbonQuickAccessButton */ void DrawRibbonQuickAccessMoreButton(CDC* pDC, CXTPControlPopup* pControl); /** * @brief * This method is called to draw the pop-up bar of the more button. * @param pDC Pointer to a valid device context. * @param pBar Toolbar to fill. */ void FillMorePopupToolBarEntry(CDC* pDC, CXTPCommandBar* pBar); /** * @brief * This method is called to draw a single tab of the ribbon bar. * @param pDC Pointer to a valid device context. * @param pItem Ribbon tab to draw. */ virtual void DrawRibbonTab(CDC* pDC, CXTPRibbonTab* pItem); /** * @brief * This method is called to draw the pop-up bar of the system button. * @param pDC Pointer to a valid device context. * @param pBar Toolbar to fill. */ void FillSystemPopupBarEntry(CDC* pDC, CXTPPopupBar* pBar); /** * @brief * This method is called to draw a pop-up bar button. * @param pDC Pointer to a valid device context. * @param pButton Pop-up bar button to draw. */ void DrawSystemPopupBarButton(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to draw scroll group buttons. * @param pDC Pointer to a valid device context. * @param pControl Scroll button to draw. * @param bScrollLeft TRUE to draw the left button, FALSE to draw the right. */ void DrawRibbonScrollButton(CDC* pDC, CXTPControl* pControl, BOOL bScrollLeft); /** * @brief * Draws the top-left system button. * @param pDC Pointer to a valid device context. * @param pControl System button control. * @param rc Bounding rectangle of the control. */ void DrawRibbonFrameSystemButton(CDC* pDC, CXTPRibbonControlSystemButton* pControl, CRect rc); /** * @brief * This method is called to draw the ribbon group when the group is * minimized and only a button is displayed. When the button is * pressed, the group is displayed as a pop-up. * @param pDC Pointer to a valid device context. * @param pButton Button to draw. * @return TRUE if successful, FALSE otherwise. */ BOOL DrawRibbonGroupControlEntry(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to draw the ribbon group pop-up toolbar. * @param pDC Pointer to a valid device context. * @param pRibbonGroup Group to draw. */ void DrawRibbonGroupPopupToolBar(CDC* pDC, CXTPRibbonGroup* pRibbonGroup); /** * @brief * This method is called to draw the ribbon caption if EnableFrameTheme * was not called. * @param pDC Pointer to a valid device context. * @param pRibbonBar Pointer to the ribbon bar to draw the caption for. * @param bActive TRUE if the ribbon frame is active. */ virtual void DrawRibbonFrameCaptionBar(CDC* pDC, CXTPRibbonBar* pRibbonBar, BOOL bActive); /** * @brief * This method is called to draw the Ribbon caption. * @param pDC Pointer to a valid device context. * @param pRibbonBar Pointer to the ribbon bar to draw the caption for. * @param bActive TRUE if the ribbon frame is active. */ virtual void DrawRibbonFrameCaption(CDC* pDC, CXTPRibbonBar* pRibbonBar, BOOL bActive); /** * @brief * This method is called to draw ribbon Quick Access controls. * @param pDC Pointer to a valid device context. * @param pRibbonBar Pointer to the parent ribbon bar. */ virtual void DrawRibbonQuickAccessControls(CDC* pDC, CXTPRibbonBar* pRibbonBar); /** * @brief * This method is called to draw ribbon context headers. * @param pDC Pointer to a valid device context. * @param pContextHeaders Collection of context headers. * @param pRibbonBar Pointer to the parent ribbon bar. */ virtual void DrawRibbonFrameContextHeaders(CDC* pDC, CXTPRibbonBar* pRibbonBar, CXTPRibbonTabContextHeaders* pContextHeaders); /** * @brief * This member fills in the tab header and tab client area. It * will then draw tab client frame. * @param pRibbonBar Pointer to the ribbon bar to draw the tab control for. * @param pDC Pointer to a valid device context. * @param rcControl Bounding rectangle of the tab control. */ virtual void FillRibbonTabControl(CDC* pDC, CXTPRibbonBar* pRibbonBar, CRect rcControl); protected: virtual CXTPMarkupUIElement* GetTabContextHeader(CXTPRibbonTabContextHeader* pHeader); protected: COLORREF m_clrControlGroupOption; COLORREF m_clrGroupCaption; COLORREF m_clrQuickAccess; COLORREF m_clrQuickAccessDisabled; COLORREF m_clrQuickAccessBelow; COLORREF m_clrQuickAccessButtonHotBack; COLORREF m_clrQuickAccessButtonPressedBack; COLORREF m_clrBackstageSysButtonBack2013Normal; /**< The color of "back" button in backstage if the button is not selected. */ COLORREF m_clrBackstageSysButtonBack2013Highlighted; /**< The color of "back" button in backstage if the button is selected. */ CString m_strHighlightedPrefix; /**< The prefix of the file name for the backstage "back" button image used for the selected button. */ CString m_strNormalPrefix; /**< The prefix of the file name for the backstage "back" button image used for the not selected button. */ BOOL m_bLoaded; CXTPMarkupContext* m_pMarkupContext; /**< Store pointer to a CXTPMarkupContext object. */ CXTPMarkupThemePart m_parts[xtpRibbonThemePartCount]; CXTPMarkupThemePart m_systemPopupBarEntry; CXTPMarkupThemePart m_systemPopupBarButtonNormal; CXTPMarkupThemePart m_systemPopupBarButtonSelected; CXTPRibbonMarkupThemePartSystemMenu* m_pSystemMenuNormal; CXTPRibbonMarkupThemePartSystemMenu* m_pSystemMenuSelected; CXTPRibbonMarkupThemePartSystemMenu* m_pSystemMenuPopuped; CXTPRibbonMarkupThemePartGroup* m_pGroupNormal; CXTPRibbonMarkupThemePartGroup* m_pGroupHighlighted; CXTPRibbonMarkupThemePartGroup* m_pGroupPopupNormal; CXTPRibbonMarkupThemePartGroup* m_pGroupPopupPopuped; CXTPRibbonMarkupThemePartGroup* m_pGroupPopupSelected; CXTPRibbonMarkupThemePartGroup* m_pGroupPopupToolBar; CXTPMarkupThemePart* m_pBackstageBackButtonLeft; CXTPMarkupThemePart* m_pBackstageBackButtonRight; }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPRIBBONMARKUPTHEME_H__) /** @endcond */