/** * @file XTPProgressCtrl.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(__XTPPROGRESSCTRL_H__) # define __XTPPROGRESSCTRL_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" # ifndef PBS_MARQUEE # define PBS_MARQUEE 0x08 # endif # ifndef PBM_SETMARQUEE # define PBM_SETMARQUEE (WM_USER + 10) # endif class CXTPProgressCtrlPaintManager; /** * @brief * The ProgressBar control shows the progress of a lengthy operation by * filling a rectangle with chunks from left to right. * @details * A ProgressBar control has a range and a current position. The range * represents the entire duration of the operation. The current position * represents the progress the application has made toward completing the * operation. The Max and Min properties set the limits of the range. * The Value property specifies the current position within that range. * Because chunks are used to fill in the control, the amount filled in * only approximates the Value property's current setting. Based on the * control's size, the Value property determines when to display the next * chunk. */ class _XTP_EXT_CLASS CXTPProgressCtrl : public CProgressCtrl { /** @cond */ DECLARE_DYNAMIC(CXTPProgressCtrl) /** @endcond */ public: /** * @brief * Constructs a CXTPProgressCtrl object. */ CXTPProgressCtrl(); /** * @brief * Handles cleanup, destroys object. */ virtual ~CXTPProgressCtrl(); /** * @brief * This member function obtains a pointer to the associated paint * manager object. The paint manager object is used for drawing * the date picker window. * @return * Pointer to the associated paint manager object. * @see * SetTheme, SetPaintManager */ CXTPProgressCtrlPaintManager* GetPaintManager() const; /** * @brief * This member function sets the new control drawing theme. * @param pPaintManager Pointer to the new paint manager object or derived * class. If NULL, then the default paint manager * object is set. * @details * Call this member function to set the paint manager object that is * used for drawing a date picker window. * @see * GetPaintManager */ void SetTheme(CXTPProgressCtrlPaintManager* pPaintManager = NULL); /** * @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 bar. */ 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 SetBkColor(COLORREF clrNew); /** * @brief * This member function sets the text color for the progress bar. * @param clrNew A COLORREF value that specifies the new text color. * @return * The COLORREF value used for text. */ COLORREF SetTextColor(COLORREF clrNew); /** * @brief * Turns marquee mode on/off for the current progress bar control. * @param fMarqueeMode TRUE to turn marquee mode on, * FALSE to turn marquee mode off. * @param nInterval Time in milliseconds between updates of the * marquee animation. * Example: * The following code example starts and stops the marquee * scrolling animation: *
	 * int piAlpha[5] = { 25, 50, 75, 100, 100 };
	 * m_wndProgress.SetMarquee(TRUE, 50);
	 * 
* @return True to turn on marquee mode, False to turn off */ BOOL SetMarquee(BOOL fMarqueeMode, int nInterval); /** * @brief * Call this member to switch the visual theme of the control. * @param nTheme New visual theme. Can be any of the values listed in the * Remarks section. * @details * nStyle can be one of the following: * xtpControlThemeDefault: Standard appearance style. * xtpControlThemeFlat: Flat appearance style. * xtpControlThemeUltraFlat: Ultra flat appearance style. * xtpControlThemeOffice2000: Office 2000 appearance style. * xtpControlThemeOfficeXP: Office XP appearance style. * xtpControlThemeOffice2003: Office 2003 appearance style. * xtpControlThemeResource: Office 2007 appearance style. */ void SetTheme(XTPControlTheme nTheme); /** * @brief * Gets the flat style appearance of the button control. * @details * The control will appear flat until the mouse pointer moves over it, * at which point it appears three-dimensional. * @return * TRUE if the flat style is used, otherwise FALSE. */ BOOL GetFlatStyle() const; /** * @brief * Sets the flat style appearance of the button control. * @param bFlatStyle TRUE to use the flat style, FALSE otherwise. * @details * The control will appear flat until the mouse pointer moves over it, * at which point it appears three-dimensional. */ void SetFlatStyle(BOOL bFlatStyle = TRUE); /** * @brief * Determines if the control is drawn using visual styles/SkinFramework, * if supported. * @details * This method enables Windows XP visual styles for the control. * This Control will draw using visual styles if both the control * and the operating system support it. * Visual styles and SkinFramework skins are specifications for * the appearance of controls. GetUseVisualStyle determines whether * to use the currently set Windows XP visual style. If using * SkinFramework, then it determines whether to use the currently set * style of the SkinFramework. * @return * TRUE if the currently set Windows XP visual style will be used to * theme the control. If using SkinFramework, then the currently set * style of the SkinFramework will be used to skin the control. * FALSE if the currently set appearance/style in the OS will be used. */ BOOL GetUseVisualStyle() const; /** * @brief * Enables Windows XP visual styles for the control. * @details * This method enables Windows XP visual styles for the control. * This Control will draw using visual styles if both the control * and the operating system support it. * Visual styles and SkinFramework skins are specifications for * the appearance of controls. GetUseVisualStyle determines whether * to use the currently set Windows XP visual style. If using * SkinFramework, then it determines whether to use the currently set * style of the SkinFramework. * @param bUseVisualStyle TRUE if the currently set Windows XP visual style * will be used to theme the control. If using * SkinFramework, then the currently set style of the * SkinFramework will be used to skin the control. * FALSE if the currently set appearance/style in the * OS will be used. */ void SetUseVisualStyle(BOOL bUseVisualStyle = TRUE); protected: /** * @brief * This member is called to update the color, text, and other visual * elements of the control. */ void RefreshMetrics(); /** * @brief * This member function is called by the progress bar to draw * non-client area borders. * @param pDC Pointer to a valid device context. * @param rc Size of the area to draw. */ void DrawNcBorders(CDC* pDC, CRect rc); /** * @brief * A helper for rendering the control appearance. * @param pDC Pointer to a valid device context. */ void DoPaint(CDC* pDC); /** * @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(); /** * @brief * This member function gets the text color for the progress bar. * @return * The COLORREF value used for the text. */ COLORREF GetTextColor(); /** * @brief * This member function check the progress bar for text. * @return * TRUE if the progress bar has text, otherwise returns FALSE. */ BOOL HasText(); /** @cond */ void Init(); void DoStep(int nStep); //{{AFX_VIRTUAL(CXTPProgressCtrl) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void PreSubclassWindow(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPProgressCtrl) afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnPaint(); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSysColorChange(); afx_msg void OnTimer(UINT_PTR nIDEvent); //}}AFX_MSG afx_msg LRESULT OnSetPos(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnStepIt(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnStartMarquee(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam); DECLARE_MESSAGE_MAP() /** @endcond */ protected: int m_nMarqueePos; /**< Position of the Marquee progress bar. */ int m_nMarqueeDelay; /**< TRUE if delay is enabled. */ BOOL m_bPreSubclassInit; /**< TRUE if the progress bar has been subsclassed. */ BOOL m_bFlatStyle; /**< TRUE if the progress bar is drawn flat (deprecated). */ CXTPProgressCtrlPaintManager* m_pPaintManager; /**< Pointer to the progress bar paint manager. */ }; ///////////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE CXTPProgressCtrlPaintManager* CXTPProgressCtrl::GetPaintManager() const { return m_pPaintManager; } AFX_INLINE BOOL CXTPProgressCtrl::SetMarquee(BOOL fMarqueeMode, int nInterval) { _ASSERTE(::IsWindow(m_hWnd)); return (BOOL)::SendMessage(m_hWnd, PBM_SETMARQUEE, (WPARAM)fMarqueeMode, (LPARAM)nInterval); } AFX_INLINE BOOL CXTPProgressCtrl::GetFlatStyle() const { return m_bFlatStyle; } AFX_INLINE void CXTPProgressCtrl::SetFlatStyle(BOOL bFlatStyle /* = TRUE*/) { m_bFlatStyle = bFlatStyle; if (m_hWnd) Invalidate(FALSE); } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPPROGRESSCTRL_H__) /** @endcond */