/** * @file XTPMarqueeCtrl.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(__XTPMARQUEECTRL_H__) # define __XTPMARQUEECTRL_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPWinThemeWrapper; class CXTPMarqueeCtrlPaintManager; /** * @brief * CXTPMarqueeCtrl is a CProgressCtrl derived class. It is used to * create a customizable Marquee style progress control. Using the * SetMarquee method, you can set the speed, gap between marquee * chunks, width, and transparency for each chunk. See the sample * located in the Controls/MarqueeProgress for more details. */ class _XTP_EXT_CLASS CXTPMarqueeCtrl : public CProgressCtrl { /** @cond */ DECLARE_DYNAMIC(CXTPMarqueeCtrl) /** @endcond */ public: /** * @brief * Constructs a CXTPMarqueeCtrl object. */ CXTPMarqueeCtrl(); /** * @brief * Destroys a CXTPMarqueeCtrl object, handles cleanup and * deallocation. */ virtual ~CXTPMarqueeCtrl(); /** * @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 */ CXTPMarqueeCtrlPaintManager* 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(CXTPMarqueeCtrlPaintManager* pPaintManager = NULL); /** * @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 * This member is called to update the color and chunk bitmaps used * by the marquee progress control. */ void RefreshMetrics(); /** * @brief * Turns marquee mode on/off for the current progress bar control. * @param bMarqueeMode TRUE to turn marquee mode on, * FALSE to turn marquee mode off. * @param nInterval Time in milliseconds between updates of the * marquee animation. * @param nGap Size in pixels of the gap between each chunk * displayed in the marquee progress bar. * @param cx Size in pixels of each chunk displayed in the * marquee progress bar. * @param piTrans Array of 5 integers representing the amount of * transparency for each chunk displayed in the * marquee progress bar as a percent ranging from * 0 to 100. This method assumes that the array * contains 5 integers. * 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, 2, 12, piAlpha);
*
*/
void SetMarquee(BOOL bMarqueeMode = TRUE, int nInterval = 50, int nGap = 2, int cx = 12,
int* piTrans = NULL);
/**
* @brief
* Determines if the PBS_SMOOTH style has been set for the marquee
* progress bar.
* @return
* TRUE if the progress bar has PBS_SMOOTH style set, otherwise FALSE.
*/
BOOL IsSmooth();
/**
* @brief
* Determines if the PBS_VERTICAL style has been set for the marquee
* progress bar.
* @return
* TRUE if the progress bar has PBS_VERTICAL style set, otherwise FALSE.
*/
BOOL IsVertical();
/**
* @brief
* Determines if the PBS_MARQUEE style has been set for the marquee
* progress bar.
* @return
* TRUE if the progress bar has PBS_MARQUEE style set, otherwise FALSE.
*/
BOOL IsMarquee();
/**
* @brief
* This member function sets the background and progress indicator
* colors for the progress bar.
* @param crBack A COLORREF value that specifies the new background color.
* @param crChunk A COLORREF value that specifies the new progress indicator
* bar color.
*/
void SetColors(COLORREF crBack, COLORREF crChunk);
protected:
/**
* @brief
* This member function is called when the progress bar has been
* created or subclassed.
* @return
* TRUE if the control has been successfully initialized,
* otherwise FALSE.
*/
virtual BOOL OnInitControl();
/**
* @brief
* This member function is called to determine if Windows themes
* are enabled for the calling application.
* @return
* TRUE if Windows themes are enabled, otherwise FALSE.
*/
virtual BOOL UseWinThemes();
/** @cond */
//{{AFX_VIRTUAL(CXTPMarqueeCtrl)
virtual void PreSubclassWindow();
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
virtual BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
//{{AFX_MSG(CXTPMarqueeCtrl)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnTimer(UINT_PTR nIDEvent);
//}}AFX_MSG
afx_msg LRESULT OnSetTheme(WPARAM wParam, LPARAM lParam);
DECLARE_MESSAGE_MAP()
/** @endcond */
protected:
int m_nGap; /**< Size in pixels between each chunk in the marquee. */
int m_nPos; /**< Current position of the marquee animation. */
int m_cxChunk; /**< Size in pixels of each chunk in the marquee. */
BYTE m_chAlpha[5]; /**< Represents the transparency for each chunk in the marquee. */
BOOL m_bIsSubclassed; /**< TRUE if the progress bar was subclassed. */
/**
* progress.
*/
CXTPMarqueeCtrlPaintManager* m_pPaintManager; // Pointer to the progress bar paint manager.
friend class CXTPMarqueeCtrlPaintManager;
friend class CXTPMarqueeCtrlThemeResource;
};
/////////////////////////////////////////////////////////////////////////////
/** @cond */
AFX_INLINE CXTPMarqueeCtrlPaintManager* CXTPMarqueeCtrl::GetPaintManager() const
{
return m_pPaintManager;
}
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
/** @endcond */
# include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h"
/** @cond */
#endif // !defined(__XTPMARQUEECTRL_H__)
/** @endcond */