/** * @file XTPShortcutBarPaintManager.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(__XTPSHORTCUTBARPAINTMANAGER_H__) # define __XTPSHORTCUTBARPAINTMANAGER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPWinThemeWrapper; /** * @brief * XTPShortcutBarPaintTheme is an enumeration used by CXTPShortcutBar to * set the theme of the control. * * Example: *
 * m_wndShortcutBar.SetTheme(xtpShortcutThemeOffice2003);
 * 
* @see * CXTPShortcutBar::GetCurrentTheme, CXTPShortcutBar::SetTheme, CXTPShortcutBar::SetCustomTheme, * xtpShortcutThemeOffice2000, xtpShortcutThemeOfficeXP, xtpShortcutThemeOffice2003 */ enum XTPShortcutBarPaintTheme { xtpShortcutThemeResource = 3, /**< Office 2007/2010 style theme. */ xtpShortcutThemeOffice2000 = 0, /**< Office 2000 style theme. */ xtpShortcutThemeOfficeXP = 1, /**< Office XP style theme. */ xtpShortcutThemeOffice2003 = 2, /**< Office 2003 style theme. */ xtpShortcutThemeOffice2007 = 3, /**< Office 2007 style theme. */ xtpShortcutThemeOffice2010 = 3, /**< Office 2010 style theme. */ xtpShortcutThemeNativeWinXP = 4, /**< Native Windows XP theme. */ xtpShortcutThemeOffice2013 = 5, /**< Office 2013 style theme. */ xtpShortcutThemeOffice2016 = xtpShortcutThemeOffice2013, /**< Office 2016 style theme. */ xtpShortcutThemeVisualStudio2015 = 6, /**< Visual Studio 2015 style theme. */ xtpShortcutThemeNativeWindows10 = 7, /**< Native Windows 10 theme. */ xtpShortcutThemeVisualStudio2017 = 8, /**< Visual Studio 2017 style theme. */ xtpShortcutThemeVisualStudio2019 = 9, /**< Visual Studio 2019 style theme. */ xtpShortcutThemeVisualStudio2022 = 10, /**< Visual Studio 2022 style theme. */ xtpShortcutThemeNativeWindows11 = 11, /**< Native Windows 11 theme. */ }; class CXTPShortcutBar; class CXTPShortcutBarItem; class CXTPShortcutBarPane; class CXTPShortcutBarPaneItem; class CXTPImageManagerIcon; /** * @brief * CXTPShortcutBarPaintManager is a standalone class used * as a paint manager for a shortcut bar control. */ class _XTP_EXT_CLASS CXTPShortcutBarPaintManager : public CXTPCmdTarget { public: /** * @brief * Constructs a CXTPShortcutBarPaintManager object. */ CXTPShortcutBarPaintManager(); /** * @brief * Destroys a CXTPShortcutBarPaintManager object, handles cleanup and deallocation. */ virtual ~CXTPShortcutBarPaintManager(); public: /** * @brief * Refreshes the visual metrics of the shortcut bar paint manager. * @details * This method refreshes all of the visual metrics of the shortcut bar * (pane caption color, pane font, pane caption height, etc.). */ virtual void RefreshMetrics(); /** * @brief * Draws a specified item for the shortcut bar control. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarItem object to be drawn. */ virtual void DrawShortcutItem(CDC* pDC, CXTPShortcutBarItem* pItem); /** * @brief * Fills the client area of the shortcut bar control. * @param pDC Pointer to the client device context. * @param pShortcutBar Pointer to the shortcut bar control. */ virtual void FillShortcutBar(CDC* pDC, CXTPShortcutBar* pShortcutBar) = 0; /** * @brief * Draws the frame for the shortcut bar control. * @param pDC Pointer to the client device context. * @param pShortcutBar Pointer to the shortcut bar control. * @details * The frame is the border drawn around the entire shortcut bar. */ virtual void DrawShortcutBarFrame(CDC* pDC, CXTPShortcutBar* pShortcutBar) = 0; /** * @brief * Fills a specified item for the shortcut bar control. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarItem object to be filled. */ virtual void FillShortcutItemEntry(CDC* pDC, CXTPShortcutBarItem* pItem) = 0; /** * @brief * Draws the gripper for the shortcut bar control. * @param pDC Pointer to the client device context. * @param pShortcutBar Pointer to the shortcut bar control. * @param bDraw TRUE to draw the gripper, FALSE to only * retrieve the size of the gripper. * @return * The size of the gripper. */ virtual int DrawGripper(CDC* pDC, CXTPShortcutBar* pShortcutBar, BOOL bDraw) = 0; /** * @brief * Draws the caption for a specified shortcut bar pane. * @param pDC Pointer to the client device context. * @param pPane Pointer to the CXTPShortcutBarPane object to be drawn. * @param bDraw TRUE to draw the shortcut bar pane caption, FALSE to only * retrieve the size of the shortcut bar pane caption. * @details * Panes of the shortcut bar are displayed in the shortcut bar's * client area. Each pane consists of a caption and one or more * sub-panes. Each sub-pane has its own caption and is drawn by * the DrawPaneItemCaption method. * * The caption of the shortcut bar pane is the bar on the top the pane. * The caption of the shortcut bar pane is set when the * pane is created by the CXTPShortcutBarPane::Create method. * * The caption of the shortcut bar pane can be retrieved by using * the CXTPShortcutBarPane::GetCaption method. * * Shortcut bar panes have sub-items which also have captions that * are drawn by the DrawPaneItemCaption method. * @return * The size of the shortcut pane caption (i.e. 24 pixels). */ virtual int DrawPaneCaption(CDC* pDC, CXTPShortcutBarPane* pPane, BOOL bDraw); /** * @brief * Draws the caption for a specified shortcut bar pane item. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarPaneItem object to be drawn. * @param bDraw TRUE to draw the shortcut bar pane item caption, FALSE to only * retrieve the size of the shortcut bar pane item caption. * @details * Panes of the shortcut bar are displayed in the shortcut bar's * client area. Each pane consists of a caption and one or more * sub-panes. Each sub-pane has its own caption and is drawn by * the DrawPaneItemCaption method. * * The caption of the shortcut bar pane item is set when the * pane item is created by the CXTPShortcutBarPane::AddItem method. * * The sub-items of a shortcut bar pane can be retrieved by using * the CXTPShortcutBarPane::GetItem method. * @return * The size of the shortcut pane item caption. */ virtual int DrawPaneItemCaption(CDC* pDC, CXTPShortcutBarPaneItem* pItem, BOOL bDraw); /** * @brief * Draws a specified navigation item for the minimized shortcut bar control. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarItem object to be drawn. */ virtual void DrawNavigationItem(CDC* pDC, CXTPShortcutBarItem* pItem); /** * @brief * Fills a specified navigation item for the minimized shortcut bar control. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarItem object to be filled. */ virtual void FillNavigationItemEntry(CDC* pDC, CXTPShortcutBarItem* pItem); /** * @brief * Draws the expand button. * @param pDC Pointer to the client device context. * @param rc Client rectangle of the expand button. */ virtual void DrawExpandButton(CDC* pDC, CRect rc); virtual void DrawPaneCaptionMinimizeButton(CDC* pDC, CXTPShortcutBarPane* pPane); /** * @brief * Draws the image of a shortcut bar item. * @param pDC Pointer to the client device context. * @param pt Location at which to draw the image * within the specified device context. * @param sz Size of the image. * @param pImage Pointer to a CXTPImageManagerIcon object. * @param bSelected TRUE if the shortcut bar item is selected/has focus * (i.e. when the user clicks on the item). * @param bPressed TRUE if the shortcut bar item is currently pressed * (i.e. when the user is clicking on the item). * @param bChecked TRUE if the shortcut bar item is checked * (i.e. toggle buttons). * @param bEnabled TRUE to draw the item as enabled, * FALSE to draw the item as disabled. * @details * The DrawShortcutItem method uses this method to draw shortcut bar images. */ virtual void DrawImage(CDC* pDC, CPoint pt, CSize sz, CXTPImageManagerIcon* pImage, BOOL bSelected, BOOL bPressed, BOOL bChecked, BOOL bEnabled) = 0; public: /** * @brief * Draws the rectangle to be used to draw the shortcut bar items. * @param pDC Pointer to a valid device context. * @param rc Specifies the rectangle in logical units. * @param nPen Specifies the color used to paint the rectangle. * @param nBrush Specifies the color used to fill the rectangle. * @details * Rectangle is used to draw the rectangle of the shortcut bar items * in the Office XP theme. */ void Rectangle(CDC* pDC, CRect rc, int nPen, int nBrush); /** * @brief * Draws the "gripper" lines in the gripper. * @param pDC Pointer to the client device context. * @param x0 Specifies the logical x- coordinate of the start position of the line. * @param y0 Specifies the logical y- coordinate of the start position of the line. * @param x1 Specifies the logical x- coordinate of the end position of the line. * @param y1 Specifies the logical y- coordinate of the end position of the line. * @param nPen Specifies the color used to paint the line. */ void Line(CDC* pDC, int x0, int y0, int x1, int y1, int nPen); /** * @brief * Determines if the caption text of a specified expanded shortcut bar item * has been truncated. * @param pDC Pointer to the client device context. * @param pItem Pointer to the CXTPShortcutBarItem object to check. * @details * The caption text of an expanded shortcut bar item is truncated if * the shortcut bar item is not wide enough to display the entirety of * the caption text. * @return * TRUE if the specified shortcut bar item is both expanded and * its caption text has been truncated, * FALSE if the specified shortcut bar item is either not expanded or * its caption text has not been truncated. */ BOOL IsShortcutItemTruncated(CDC* pDC, CXTPShortcutBarItem* pItem); virtual void FillPopupBack(CDC* pDC, CRect rc, CSize szGap); virtual void CreateFonts(); virtual void EnableOfficeFont(BOOL bEnable = TRUE); public: CXTPFont m_xtpFontText; /**< Text font. */ CXTPFont m_xtpFontPaneCaption; /**< Caption font. */ CXTPFont m_xtpFontPaneItemCaption; /**< Sub-caption font. */ CXTPFont m_xtpFontVerticalText; /**< Navigation button text font. */ XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntText, m_xtpFontText, GetTextFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntPaneCaption, m_xtpFontPaneCaption, GetPaneCaptionFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntPaneItemCaption, m_xtpFontPaneItemCaption, GetPaneItemCaptionFontHandle); XTP_SUBSTITUTE_GDI_MEMBER_WITH_CACHED(CFont, m_fntVerticalText, m_xtpFontVerticalText, GetVerticalTextFontHandle); int m_nPaneItemHeight; /**< Height of sub-pane caption. */ CXTPImageManagerIcon* m_pExpandIcon; /**< Pointer to expand icon. */ CXTPImageManager* m_pImageManager; BOOL m_bNavigationButton; /**< TRUE if navigation button small */ int m_nNormalIconWidth; /**< Width of the icons. */ int m_nExpandedIconWidth; /**< Width of the expanded icons. */ BOOL m_bBoldItemCaptionFont; /**< TRUE to draw item with bold font. */ BOOL m_bClearTypeTextQuality; /**< TRUE to use ClearType font. */ BOOL m_bUseStandardFont; /**< TRUE to use standard font. */ CRect m_rcCaptionPadding; /**< Padding of pane caption. */ CRect m_rcItemCaptionPadding; /**< Padding of item caption. */ CString m_strOfficeFont; /**< TRUE to use Office Tahoma font. */ BOOL m_bShowBorder; BOOL m_bDrawTextNoPrefix; public: CXTPPaintManagerColor m_clrPushedText; /**< Color of caption text when an CXTPShortcutBarItem is pressed. */ CXTPPaintManagerColor m_clrSelectedText; /**< Color of caption text when an CXTPShortcutBarItem is selected (this happens after the item is clicked). */ CXTPPaintManagerColor m_clrHotText; /**< Color of caption text when the mouse cursor is positioned over an CXTPShortcutBarItem. */ CXTPPaintManagerColor m_clrNormalText; /**< Color of caption text when an CXTPShortcutBarItem is displayed normally. */ CXTPPaintManagerColor m_clrDisabledText; /**< Color of caption text when an CXTPShortcutBarItem is disabled. */ CXTPPaintManagerColorGradient m_grcSelected; /**< Color gradient of currently selected item. */ CXTPPaintManagerColorGradient m_grcHot; /**< Color gradient of "hot" items. An item is hot when the mouse cursor is positioned over the item. */ CXTPPaintManagerColorGradient m_grcPushed; /**< Color gradient of item when clicked on. This color is also used to color the currently selected item on mouse over (i.e. when the selected item is "hot"). */ CXTPPaintManagerColorGradient m_grcShortcutItem; /**< Color gradient of shortcut bar items. */ CXTPPaintManagerColor m_clrShortcutItemShadow; /**< Color of line border that goes around each item. */ CXTPPaintManagerColorGradient m_grcShortcutBarGripper; /**< Color gradient used to draw the shortcut bar gripper. */ CXTPPaintManagerColor m_clrPopupFrame; CXTPPaintManagerColor m_clrPopupBackground; COLORREF m_clrFlatBackground; COLORREF m_clrFlatTextColor; COLORREF m_clrAppSplitterFace; # ifdef _XTP_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_OLETYPELIB_EX(CXTPShortcutBarPaintManager); DECLARE_INTERFACE_MAP() afx_msg void OleRefreshMetrics(); afx_msg LPFONTDISP OleGetFont(); afx_msg void OleSetFont(LPFONTDISP pFontDisp); afx_msg OLE_COLOR OleGetFlatBackgroundColor(); afx_msg OLE_COLOR OleGetFlatTextColor(); afx_msg OLE_COLOR OleGetSplitterColor(); /** @endcond */ # endif }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSHORTCUTBARPAINTMANAGER_H__) /** @endcond */