/** * @file XTPControlSlider.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(__XTPCONTOLSLIDER_H__) # define __XTPCONTOLSLIDER_H__ /** @endcond */ # if _MSC_VER > 1000 # pragma once # endif // _MSC_VER > 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPControlSlider; /** * @brief * Inplace slider control of CXTPControlSlider. */ class _XTP_EXT_CLASS CXTPControlSliderCtrl : public CSliderCtrl { protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_MSG(CXTPControlSliderCtrl) afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg HBRUSH CtlColor(CDC* pDC, UINT nCtlColor); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnRButtonDown(UINT nFlags, CPoint point); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void HScroll(UINT nSBCode, UINT nPos); afx_msg void VScroll(UINT nSBCode, UINT nPos); //}}AFX_MSG BOOL OnWndMsg(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pResult); LRESULT OnWindowFromPoint(WPARAM, LPARAM); /** @endcond */ protected: CXTPControlSlider* m_pControl; /**< Parent CXTPControlSlider control */ private: friend class CXTPControlSlider; }; /** * @brief * CXTPControlSlider is a CXTPControl derived class. * It represents a slider control. */ class _XTP_EXT_CLASS CXTPControlSlider : public CXTPControl { /** @cond */ DECLARE_XTP_CONTROL(CXTPControlSlider) /** @endcond */ public: /** * @brief * Constructs a CXTPControlSlider object. */ CXTPControlSlider(); /** * @brief * Destroys a CXTPControlSlider object, handles cleanup and deallocation. */ virtual ~CXTPControlSlider(); public: /** * @brief * Call this member to set the current position of the slider. * @param nPos New position of the slider control. * @see * GetPos, SetRange */ void SetPos(int nPos); /** * @brief * Call this member to get the current position of the slider. * @return * The position of the slider control. * @see * SetPos */ int GetPos(); /** * @brief * Sets the upper and lower limits of the slider control's range. * @param nMin Specifies the lower limit of the range. * @param nMax Specifies the upper limit of the range. * @see * SetPos */ void SetRange(int nMin, int nMax); public: /** * @brief * This method is called when a control's enabled state is changed. */ virtual void OnEnabledChanged(); public: /** * @brief * Call this member to get a pointer to the in-place slider control. * * @return A pointer to the in-place slider control. */ CSliderCtrl* GetSliderCtrl() const; /** * @brief * Call this member to get the style of the slider control. * @return * The style of the slider control. * @see * SetSliderStyle */ DWORD GetSliderStyle() const; /** * @brief * Call this member to set the style of the slider control. * @param dwStyle The style to be set. * @see * GetSliderStyle */ void SetSliderStyle(DWORD dwStyle); protected: /** * @brief * This method is called when the position of the scrollbar is changed. * @param nSBCode Specifies a scrollbar code that indicates the user's scrolling request. * @param nPos Contains the current scroll-box position. */ virtual void OnScroll(UINT nSBCode, UINT nPos); protected: /** @cond */ BOOL HasFocus() const; CSize GetSize(CDC* pDC); void Draw(CDC* pDC); void SetRect(CRect rcControl); void SetParent(CXTPCommandBar* pParent); void SetHideFlags(DWORD dwFlags); void OnCalcDynamicSize(DWORD dwMode); void OnClick(BOOL bKeyboard = FALSE, CPoint pt = CPoint(0, 0)); virtual void OnThemeChanged(); virtual int GetCustomizeMinWidth() const; virtual BOOL IsCustomizeResizeAllow() const; void Copy(CXTPControl* pControl, BOOL bRecursive = FALSE); void DoPropExchange(CXTPPropExchange* pPX); /** @endcond */ protected: CXTPControlSliderCtrl* m_pSliderCtrl; /**< Pointer to slider control. */ int m_nMin; /**< Lower range. */ int m_nMax; /**< Upper range. */ int m_nPos; /**< Current position of slider. */ DWORD m_dwSliderStyle; /**< Slider style. */ CRect m_rcPadding; /**< Padding around slider. */ friend class CXTPControlSliderCtrl; # ifdef _XTP_COMMANDBARS_ACTIVEX /** @cond */ DECLARE_DISPATCH_MAP() DECLARE_INTERFACE_MAP() DECLARE_OLETYPELIB_EX(CXTPControlSlider); void OleRangeChanged(); /** @endcond */ # endif }; /** @cond */ AFX_INLINE BOOL CXTPControlSlider::IsCustomizeResizeAllow() const { return TRUE; } AFX_INLINE int CXTPControlSlider::GetCustomizeMinWidth() const { return 20; } /** @endcond */ AFX_INLINE CSliderCtrl* CXTPControlSlider::GetSliderCtrl() const { return m_pSliderCtrl; } /** @cond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" #endif // !defined(__XTPCONTOLSLIDER_H__) /** @endcond */