/** * @file XTPCommandBarsThemeRibbon.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(__XTPRIBBONTHEME_H__) # define __XTPRIBBONTHEME_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * The CXTPRibbonTheme class is used to enable a Ribbon style theme for Command Bars. * @see * CXTPPaintManager::SetTheme */ class _XTP_EXT_CLASS CXTPRibbonTheme : public CXTPResourceTheme { /** @cond */ DECLARE_DYNAMIC(CXTPRibbonTheme) /** @endcond */ public: /** * @brief * Constructs a CXTPRibbonTheme object. */ CXTPRibbonTheme(); /** * @brief * Destroys a CXTPRibbonTheme object, handles cleanup and deallocation. */ virtual ~CXTPRibbonTheme(); public: /** * @brief * This method is called to refresh the visual metrics of the manager. */ virtual void RefreshMetrics(); protected: protected: /** * @brief * This method is called to fill the control's face. * @param pDC Pointer to a valid device context. * @param pButton Pointer to a CXTPControl object to draw. */ virtual void DrawControlEntry(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to determine the offset of a pop-up bar. * @param rc Control's bounding rectangle. * @param pControl Pointer to a CXTPControl object. * @param bVertical TRUE if the control is docked vertically. */ virtual void AdjustExcludeRect(CRect& rc, CXTPControl* pControl, BOOL bVertical); /** * @brief * This method is called to draw the frame for the SplitButton * control. * @param pDC Pointer to a valid device context. * @param pButton Pointer to a CXTPControl object. * @param rc Bounding rectangle to draw. */ virtual void DrawSplitButtonFrame(CDC* pDC, CXTPControl* pButton, CRect rc); /** * @brief * This method is called to draw a pop-up bar's right gripper. * @param pDC Pointer to a valid device context. * @param xPos Specifies the logical x-coordinate of the upper-left corner of * the rectangle. * @param yPos Specifies the logical y-coordinate of the upper-left corner of * the destination rectangle. * @param cx Specifies the width of the rectangle. * @param cy Specifies the height of the rectangle. * @param bExpanded TRUE if expanded. */ virtual void DrawPopupBarGripper(CDC* pDC, int xPos, int yPos, int cx, int cy, BOOL bExpanded = FALSE); /** * @brief * This method is called to fill the command bar's face. * @param pDC Pointer to a valid device context. * @param pBar Pointer to a CXTPCommandBar object to draw. */ virtual void FillCommandBarEntry(CDC* pDC, CXTPCommandBar* pBar); /** * @brief * This method is called to fill the control's face. * @param pDC Pointer to a valid device context. * @param rc Rectangle to draw. * @param bSelected TRUE if the control is selected. * @param bPressed TRUE if the control is pushed. * @param bEnabled TRUE if the control is enabled. * @param bChecked TRUE if the control is checked. * @param bPopuped TRUE if the control is pop-up'ed. * @param barType Parent's bar type. * @param barPosition Parent's bar position. */ virtual void DrawRectangle(CDC* pDC, CRect rc, BOOL bSelected, BOOL bPressed, BOOL bEnabled, BOOL bChecked, BOOL bPopuped, XTPBarType barType, XTPBarPosition barPosition); /** * @brief * This method is called to fill the control's face. * @param pDC Pointer to a valid device context. * @param rc Rectangle to draw. * @param bSelected TRUE if the control is selected. * @param bPressed TRUE if the control is pushed. * @param bEnabled TRUE if the control is enabled. * @param bChecked TRUE if the control is checked. * @param bPopuped TRUE if the control is pop-up'ed. * @param barType Parent's bar type. * @param barPosition Parent's bar position. * @param nID Bar's control ID. */ virtual void DrawRectangle(CDC* pDC, CRect rc, BOOL bSelected, BOOL bPressed, BOOL bEnabled, BOOL bChecked, BOOL bPopuped, XTPBarType barType, XTPBarPosition barPosition, int nID); /** * @brief * This method is called to fill the control's face. * @param pDC Pointer to a valid device context. * @param pButton pointer to a button * @return * TRUE if the rectange was drawn, otherwise FALSE. */ virtual BOOL DrawRectangle(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to draw a command bar's separator. * @param pDC Pointer to a valid device context. * @param pBar Pointer to a CXTPCommandBar object. * @param pControl Pointer to a CXTPControl object. * @param bDraw TRUE to draw; FALSE to retrieve the size of the separator. * @return * Size of the separator. */ virtual CSize DrawCommandBarSeparator(CDC* pDC, CXTPCommandBar* pBar, CXTPControl* pControl, BOOL bDraw); /** * @brief * This method is called to draw the command bar's gripper. * @param pDC Pointer to a valid device context. * @param pBar Pointer to a CXTPCommandBar object. * @param bDraw TRUE to draw; FALSE to retrieve the size of the gripper. * @return * Size of the gripper. */ virtual CSize DrawCommandBarGripper(CDC* pDC, CXTPCommandBar* pBar, BOOL bDraw = TRUE); /** * @brief * This method is called to fill a status bar. * @param pDC Pointer to a valid device context. * @param pBar Pointer to a CXTPStatusBar object. */ virtual void FillStatusBar(CDC* pDC, CXTPStatusBar* pBar); /** * @brief * This method is called to draw the status bar's gripper. * @param pDC Pointer to a valid device context. * @param rcClient Client rectangle of the status bar. */ virtual void DrawStatusBarGripper(CDC* pDC, CRect rcClient); /** * @brief * This method is called to draw the frame of a single cell of the status bar. * @param pDC Pointer to a valid device context. * @param rc CRect object specifying the size of the area. * @param pPane The status bar pane to draw. * @param bGripperPane TRUE if the pane is the last cell of the status bar. */ virtual void DrawStatusBarPaneBorder(CDC* pDC, CRect rc, CXTPStatusBarPane* pPane, BOOL bGripperPane); /** * @brief * This method is called to draw the pane separator of status bar panes. * @param pDC Pointer to a valid device context. * @param rc CRect object specifying the size of the area. * @param pPane The status bar pane to draw the separator by. */ virtual void DrawStatusBarPaneSeparator(CDC* pDC, CRect rc, CXTPStatusBarPane* pPane); /** * @brief * This method is called to draw the status bar switch pane. * @param pDC Pointer to a valid device context. * @param rcItem CRect object specifying the size of the area. * @param pPane The status bar switch pane to draw. * @return Pane width value. */ virtual int DrawStatusBarSwitchPane(CDC* pDC, CRect rcItem, CXTPStatusBarSwitchPane* pPane); /** * @brief * This method retrieves a buttons text color. * @param bSelected TRUE if the control is selected. * @param bPressed TRUE if the control is pushed. * @param bEnabled TRUE if the control is enabled. * @param bChecked TRUE if the control is checked. * @param bPopuped TRUE if the control is pop-up'ed. * @param barType Parent's bar type. * @param barPosition Parent's bar position. * @return Returns buttons text color */ virtual COLORREF GetRectangleTextColor(BOOL bSelected, BOOL bPressed, BOOL bEnabled, BOOL bChecked, BOOL bPopuped, XTPBarType barType, XTPBarPosition barPosition); /** * @brief * This method returns a control text color to draw. * @param pButton Pointer to a CXTPControl object to draw. * @return * Button text color. */ virtual COLORREF GetControlTextColor(CXTPControl* pButton); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. * @param bDraw TRUE to draw; FALSE to retrieve the size of the control. * @param pControlEdit Edit control to draw. * @return * Size of the control. */ CSize DrawControlEdit(CDC* pDC, CXTPControlEdit* pControlEdit, BOOL bDraw); /** * @brief * This method is called to draw the control. * @param pDC Pointer to a valid device context. * @param pComboBox ComboBox to draw. * @param bDraw TRUE to draw; FALSE to retrieve the size of the control. * @return * Size of the control. */ CSize DrawControlComboBox(CDC* pDC, CXTPControlComboBox* pComboBox, BOOL bDraw); /** * @brief * This method returns the edit control back color to draw. * @param pControl Points to a CXTPControl object to get the back color from. * @return * Edit control back color. */ virtual COLORREF GetControlEditBackColor(CXTPControl* pControl); /** * @brief * Retrieves the base theme of the manager. * @return * Returns the base theme. */ virtual XTPPaintTheme BaseTheme() { return xtpThemeRibbon; } /** * @brief * This method is called to set the bounding region for a pop-up bar. * @param pCommandBar Pointer to the pop-up bar in which the bounding region must be set. */ virtual void SetCommandBarRegion(CXTPCommandBar* pCommandBar); /** * @brief * This method is called to draw a menu split button dropdown rect. * @param pDC Pointer to a valid device context. * @param pButton Split button to draw. */ virtual void DrawSplitButtonPopup(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to a draw menu pop-up glyph. * @param pDC Pointer to a valid device context. * @param pButton Pop-up button to draw the glyph. */ virtual void DrawControlPopupGlyph(CDC* pDC, CXTPControl* pButton); /** * @brief * This method is called to draw a menu label background. * @param pDC Pointer to a valid device context. * @param rc Bounding rectangle of the button. */ virtual void FillPopupLabelEntry(CDC* pDC, CRect rc); /** * @brief * This method is called to set a rounded rectangle region for a window. * @param pWnd Window to set region to. */ void SetRoundRectRegion(CWnd* pWnd); /** * @brief * This method is called to draw a ribbon keyboard tip. * @param pDC Pointer to a valid device context. * @param pWnd Keyboard tip window. * @param bSetRegion TRUE to set region. */ virtual void DrawKeyboardTip(CDC* pDC, CXTPCommandBarKeyboardTip* pWnd, BOOL bSetRegion); /** * @brief * This method is called to draw the specified controls. * @param pDC Pointer to a valid device context. * @param controlType Special control enumerator. * @param pButton Pointer to a CXTPControl object to draw. * @param pBar Parent CXTPCommandBar object. * @param bDraw TRUE to draw; FALSE to retrieve the size of the * control. * @param lpParam Specified parameter. * @return * Size of the control. */ virtual CSize DrawSpecialControl(CDC* pDC, XTPSpecialControl controlType, CXTPControl* pButton, CXTPCommandBar* pBar, BOOL bDraw, LPVOID lpParam); /** * @brief * This method is called to draw the resize gripper for the pop-up window. * @param pDC Pointer to a valid device context. * @param rcGripper CRect object specifying the size of the area. * @param nFlags Options for gripper. */ void DrawPopupResizeGripper(CDC* pDC, CRect rcGripper, int nFlags); /** * @brief * Call this member function to draw a check mark. * @param pDC Pointer to a valid device context * @param rcCheck Specifies the rectangle in logical units. * @param clr Color to fill. * @param bEnabled Specifies whether the checkmark will be drawn enabled or disabled. */ virtual void DrawPopupBarCheckMark(CDC* pDC, CRect rcCheck, BOOL bEnabled, COLORREF clr); /** * @brief * Call this member function to draw a radio button. * @param pDC Pointer to a valid device context. * @param rcCheck Specifies the rectangle in logical units. * @param clr Color to fill. * @param bEnabled TRUE to enable, FALSE to disable the button. */ virtual void DrawPopupBarRadioMark(CDC* pDC, CRect rcCheck, BOOL bEnabled, COLORREF clr); public: /** * @brief * Call this member function to set the current ribbon paint manager. * @param pRibbonPaintManager Pointer to a valid ribbon paint manager. */ void SetRibbonPaintManager(CXTPRibbonPaintManager* pRibbonPaintManager); protected: /** * @brief * Determines if images are available. * @return * TRUE if images exist in the application. */ BOOL IsImagesAvailable(); /** @cond */ virtual void DrawDropDownGlyph(CDC* pDC, CXTPControl* pControl, CPoint pt, BOOL bSelected, BOOL bPopuped, BOOL bEnabled, BOOL bVert); virtual CSize DrawControlCheckBoxMark(CDC* pDC, CRect rc, BOOL bDraw, BOOL bSelected, BOOL bPressed, BOOL bChecked, BOOL bEnabled); virtual CSize DrawControlCheckBoxMark(CDC* pDC, CXTPControl* pButton, CRect rc, BOOL bDraw); virtual CSize DrawControlRadioButtonMark(CDC* pDC, CRect rc, BOOL bDraw, BOOL bSelected, BOOL bPressed, BOOL bChecked, BOOL bEnabled); /** @endcond */ protected: friend class CXTPRibbonBar; protected: COLORREF m_clrControlEditNormal; /**< Edit control color */ COLORREF m_clrControlEditSelected; /**< Edit control selected color */ COLORREF m_clrControlEditDisabledBorder; /**< Edit disabled border */ COLORREF m_clrRibbonText; /**< Ribbon text color */ COLORREF m_clrRibbonGrayText; /**< Gray text of the ribbon. */ COLORREF m_clrMenuPopupSeparator; /**< Pop-up separator color. */ COLORREF m_clrMenuPopupGripperShadow; /**< Pop-up gripper shadow color. */ BOOL m_bOffice2010Style; }; /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPRIBBONTHEME_H__) /** @endcond */