/** * @file XTPMarqueeCtrlPaintManager.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(__XTPMARQUEECTRLPAINTMANAGER_H__) # define __XTPMARQUEECTRLPAINTMANAGER_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPMarqueeCtrl; /** * @brief * The CXTPMarqueeCtrlPaintManager class is derived from CCmdTarget and * is used by the progress bar to perform all default drawing routines. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlPaintManager : public CCmdTarget { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlPaintManager) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlPaintManager(); /** * @brief * Default paint manager destructor. * @details * Handles cleanup and deallocation. */ virtual ~CXTPMarqueeCtrlPaintManager(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); /** * @brief * This member function is called by the progress bar to draw * the non-client borders. * @param pWndCtrl Points to a CXTPMarqueeCtrl object. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. */ virtual void DrawBackground(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CRect& rcClient); /** * @brief * This member function is called by the progress bar to draw * the client area of the control. * @param pWndCtrl Points to a CXTPMarqueeCtrl object. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DrawMarquee(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CRect& rcClient); /** * @brief * Used by the progress bar to determine if Windows themes should * be used to draw the control. * @param bCheckReady TRUE to perform an additional check IsAppThemeReady(). * @return * TRUE if the progress bar is drawn using default Windows themes. */ BOOL UsingWinThemes(BOOL bCheckReady = FALSE); /** * @brief * Call this member function to draw the control using the current * Windows theme. This will override any themes currently set. * @param bUseWinThemes TRUE to enable Windows themes. */ void UseWinThemes(BOOL bUseWinThemes = TRUE); /** * @brief * This member function sets the border color for the progress bar. * @param clrNew A COLORREF value that specifies the new border color. * @return * The COLORREF value used for the border. */ COLORREF SetBorderColor(COLORREF clrNew); /** * @brief * This member function sets the bar color for the progress bar. * @param clrNew A COLORREF value that specifies the new bar color. * @return * The COLORREF value used for the bar. */ COLORREF SetBarColor(COLORREF clrNew); /** * @brief * This member function sets the background color for the progress bar. * @param clrNew A COLORREF value that specifies the new background color. * @return * The COLORREF value used for the background. */ COLORREF SetBackColor(COLORREF clrNew); /** * @brief * This member function gets the border color for the progress bar. * @return * The COLORREF value used for the border. */ COLORREF GetBorderColor(); /** * @brief * This member function gets the bar color for the progress bar. * @return * The COLORREF value used for the bar. */ COLORREF GetBarColor(); /** * @brief * This member function gets the background color for the progress bar. * @return * The COLORREF value used for the background. */ COLORREF GetBackColor(); protected: /** * @brief * This member function is called by the progress bar to adjust * the bar drawing size; can be overridden in derived classes. * @param pDC Points to the device context used for drawing. * @param rcClient Represents client area to draw. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DeflateRect(CDC* pDC, CRect& rcClient); /** * @brief * This member function is called by the progress bar to draw a section of the * progress indicator. * @param pWndCtrl Points to the CXTPMarqueeCtrl object. * @param pDC Points to the device context used for drawing. * @param dcChunk Reference to a CXTPCompatibleDC device context. * @param i Index value for the item drawn. * @param x Left position. * @param y Top position. * @param cx Item width. * @param cy Item height. */ virtual void DrawChunk(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CXTPCompatibleDC& dcChunk, int i, int& x, int& y, int cx, int cy); BOOL m_bUseWinTheme; /**< TRUE when using Windows themes. */ XTPControlTheme m_nTheme; /**< Theme identifier. */ CXTPWinThemeWrapper m_winTheme; /**< Wrapper used when drawing Windows themes. */ CXTPPaintManagerColor m_clr3DHilite; /**< An RGB value representing the border color. */ CXTPPaintManagerColor m_clr3DShadow; /**< An RGB value representing the border color. */ CXTPPaintManagerColor m_clrBar; /**< An RGB value representing the bar color. */ CXTPPaintManagerColor m_clrBack; /**< An RGB value representing the back color. */ }; /** @cond */ //--------------------------------------------------------------------------- // Inline functions. //--------------------------------------------------------------------------- AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::SetBorderColor(COLORREF clrNew) { m_clr3DHilite.SetCustomValue(clrNew); m_clr3DShadow.SetCustomValue(clrNew); return m_clr3DShadow; } AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::SetBarColor(COLORREF clrNew) { m_clrBar.SetCustomValue(clrNew); return m_clrBar; } AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::SetBackColor(COLORREF clrNew) { m_clrBack.SetCustomValue(clrNew); return m_clrBack; } AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::GetBorderColor() { return m_clr3DShadow; } AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::GetBarColor() { return m_clrBar; } AFX_INLINE COLORREF CXTPMarqueeCtrlPaintManager::GetBackColor() { return m_clrBack; } /** @endcond */ /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a flat style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeFlat : public CXTPMarqueeCtrlPaintManager { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeFlat) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeFlat(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); protected: /** * @brief * This member function is called by the progress bar to adjust * the bar drawing size; can be overridden in derived classes. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DeflateRect(CDC* pDC, CRect& rcClient); /** * @brief * This member function is called by the progress bar to draw * the client area of the control. * @param pWndCtrl Points to a CXTPMarqueeCtrl object. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DrawMarquee(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CRect& rcClient); }; /** * @brief * The CXTPMarqueeCtrlThemeUltraFlat class is derived from CXTPMarqueeCtrlThemeFlat * and is used by the progress bar to draw a flat style progress bar with * no borders. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeUltraFlat : public CXTPMarqueeCtrlThemeFlat { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeUltraFlat) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeUltraFlat(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw an Office 2000 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeOffice2000 : public CXTPMarqueeCtrlPaintManager { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeOffice2000) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeOffice2000(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); }; /** * @brief * The CXTPMarqueeCtrlThemeXP class is derived from CXTPMarqueeCtrlThemeFlat * and is used by the progress bar to draw an Office XP style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeOfficeXP : public CXTPMarqueeCtrlThemeOffice2000 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeOfficeXP) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeOfficeXP(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw an Office 2003 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeOffice2003 : public CXTPMarqueeCtrlThemeOffice2000 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeOffice2003) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeOffice2003(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw an progress bar using a resource DLL. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeResource : public CXTPMarqueeCtrlThemeOffice2000 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeResource) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeResource(); /** * @brief * This member function is called by the progress bar to draw * the non-client borders. * @param pWndCtrl Points to a CXTPMarqueeCtrl object. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. */ virtual void DrawBackground(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CRect& rcClient); /** * @brief * This member function is called by the progress bar to draw a section of the * progress indicator. * @param pWndCtrl Points to the CXTPMarqueeCtrl object. * @param pDC Points to the device context used for drawing. * @param dcChunk Reference to a CXTPCompatibleDC device context. * @param i Index value for the item drawn. * @param x Left position. * @param y Top position. * @param cx Item width. * @param cy Item height. */ virtual void DrawChunk(CXTPMarqueeCtrl* pWndCtrl, CDC* pDC, CXTPCompatibleDC& dcChunk, int i, int& x, int& y, int cx, int cy); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw an Office 2013 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeOffice2013 : public CXTPMarqueeCtrlThemeOffice2000 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeOffice2013) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeOffice2013(); /** * @brief * This member function performs initialization for the Paint * Manager. * @details * Initializes all drawing defaults (fonts, colors, etc.). */ virtual void RefreshMetrics(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a Visual Studio 2015 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeVisualStudio2015 : public CXTPMarqueeCtrlThemeOffice2013 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeVisualStudio2015) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeVisualStudio2015(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a Visual Studio 2017 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeVisualStudio2017 : public CXTPMarqueeCtrlThemeOffice2013 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeVisualStudio2017) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeVisualStudio2017(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a Visual Studio 2019 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeVisualStudio2019 : public CXTPMarqueeCtrlThemeOffice2013 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeVisualStudio2019) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeVisualStudio2019(); }; /** * @brief * The CXTPMarqueeCtrlThemeFlat class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a Visual Studio 2022 style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeVisualStudio2022 : public CXTPMarqueeCtrlThemeOffice2013 { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeVisualStudio2022) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeVisualStudio2022(); }; /** * @brief * The CXTPMarqueeCtrlThemeNativeWinXP class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a native Windows style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeNativeWinXP : public CXTPMarqueeCtrlPaintManager { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeNativeWinXP) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeNativeWinXP(); protected: /** * @brief * This member function is called by the progress bar to adjust * the bar drawing size; can be overridden in derived classes. * @param ds Struct used by the progress bar during paint operations. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DeflateRect(XTPPROGRESSDRAWSTRUCT& ds); using CXTPMarqueeCtrlPaintManager::DeflateRect; }; /** * @brief * The CXTPMarqueeCtrlThemeNativeWindows class is derived from CXTPMarqueeCtrlPaintManager * and is used by the progress bar to draw a native Windows style progress bar. */ class _XTP_EXT_CLASS CXTPMarqueeCtrlThemeNativeWindows : public CXTPMarqueeCtrlPaintManager { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrlThemeNativeWindows) /** @endcond */ public: /** * @brief * Default paint manager constructor. * @details * Handles initial initialization. * @see * RefreshMetrics() */ CXTPMarqueeCtrlThemeNativeWindows(); protected: /** * @brief * This member function is called by the progress bar to adjust * the bar drawing size; can be overridden in derived classes. * @param pDC Pointer to a valid device context. * @param rcClient Size of the non-client border area. * @see * XTPPROGRESSDRAWSTRUCT */ virtual void DeflateRect(CDC* pDC, CRect& rcClient); }; # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPMARQUEECTRLPAINTMANAGER_H__) /** @endcond */