/** * @file XTPScrollBarCtrl.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(__XTPSCROLLBARCTRL_H__) # define __XTPSCROLLBARCTRL_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" class CXTPScrollBarContainerImpl; /** * @brief * Scrollbar control. * @details * Scroll bars provide easy navigation through a long list of items or a * large amount of information. They can also provide an analog representation * of current position. You can use a scroll bar as an input device or * indicator of speed or quantity.for example, to control the volume of a * computer game or to view the time elapsed in a timed process. */ class _XTP_EXT_CLASS CXTPScrollBarCtrl : public CScrollBar , public CXTPScrollBase { DECLARE_DYNCREATE(CXTPScrollBarCtrl); friend class CXTPScrollBarContainerImpl; public: /** * @brief * Constructs a CXTPScrollBarCtrl object */ CXTPScrollBarCtrl(); /** * @brief * Destroys a CXTPScrollBarCtrl object, handles cleanup and deallocation */ virtual ~CXTPScrollBarCtrl(); public: /** * @brief * Sets the scrollbar theme. * @param theme Scrollbar theme to be set; must be one of the values * defined by the XTPScrollBarTheme enumeration. */ void SetTheme(XTPScrollBarTheme theme); /** * @brief * This member is called to update color, text and other visual elements * of the control. */ virtual void RefreshMetrics(); /** * @brief * Obtains a pointer to the associated scrollbar paint manager. * @return * A pointer to the associated scrollbar paint manager */ virtual CXTPScrollBarPaintManager* GetScrollBarPaintManager() const; /** * @brief * The GetScrollInfo function retrieves the parameters of a scroll bar, * including the minimum and maximum scrolling positions, the page size, * and the position of the scroll box (thumb) * @param psi Pointer to a SCROLLINFO structure. Before calling GetScrollInfo, * set the cbSize member to sizeof(SCROLLINFO), and set the fMask * member to specify the scroll bar parameters to retrieve. Before returning, * the function copies the specified parameters to the appropriate members * of the structure. Refer to MSDN documentation for more details on SCROLLINFO * fields. */ virtual void GetScrollInfo(SCROLLINFO* psi); protected: /** * @brief * This member function is called from OnInitDialog or OnInitialUpdate * to initialize the control. */ void Init(); /** * @brief * Call this method to get XTP_SCROLLBAR_TRACKINFO information * @return * A pointer to XTP_SCROLLBAR_TRACKINFO information * @see * GetScrollBarPosInfo */ XTP_SCROLLBAR_TRACKINFO* GetScrollBarTrackInfo(); /** * @brief * Call this method to get XTP_SCROLLBAR_POSINFO information * @return * A pointer to XTP_SCROLLBAR_POSINFO information * @see * GetScrollBarTrackInfo */ XTP_SCROLLBAR_POSINFO* GetScrollBarPosInfo(); /** @cond */ CRect GetScrollBarRect(); BOOL IsScrollBarEnabled() const; CWnd* GetParentWindow() const; void DoScroll(int cmd, int pos); void RedrawScrollBar(); /** @endcond */ protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPScrollBarCtrl) virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void PreSubclassWindow(); //}}AFX_VIRTUAL //{{AFX_MSG(CXTPScrollBarCtrl) afx_msg LRESULT OnPrintClient(WPARAM wParam, LPARAM lParam); afx_msg void OnMouseLeave(); afx_msg void OnMouseMove(UINT nFlags, CPoint point); afx_msg void OnPaint(); afx_msg void OnDraw(CDC* pDC); afx_msg void OnEnable(BOOL bEnable); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point); afx_msg LRESULT OnSetScrollInfo(WPARAM wParam, LPARAM lParam); afx_msg LRESULT OnGetScrollInfo(WPARAM wParam, LPARAM lParam); afx_msg void OnSetFocus(CWnd* pOldWnd); afx_msg void OnContextMenu(CWnd* pWnd, CPoint pos); afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnSysColorChange(); //}}AFX_MSG /** @endcond */ protected: BOOL m_bPreSubclassInit; /**< TRUE is sub-classed. */ CXTPScrollBarPaintManager* m_pPaintManager; }; /** @cond */ AFX_INLINE CXTPScrollBarPaintManager* CXTPScrollBarCtrl::GetScrollBarPaintManager() const { return m_pPaintManager; } AFX_INLINE XTP_SCROLLBAR_TRACKINFO* CXTPScrollBarCtrl::GetScrollBarTrackInfo() { return m_pSBTrack; } AFX_INLINE XTP_SCROLLBAR_POSINFO* CXTPScrollBarCtrl::GetScrollBarPosInfo() { return &m_spi; } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // !defined(__XTPSCROLLBARCTRL_H__) /** @endcond */