/** * @file XTPPageScroller.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(__XTPPAGERSCROLLER_H__) # define __XTPPAGERSCROLLER_H__ /** @endcond */ # if _MSC_VER >= 1000 # pragma once # endif // _MSC_VER >= 1000 # include "Common/Base/Diagnostic/XTPDisableNoisyWarnings.h" /** * @brief * CXTPPageScroller is a CWnd derived class. Use CXTPPageScroller to define * a display area for a window that does not have enough display area to show * all of its content. * * The page scroller control creates a window container that provides arrows * to extend over the edges of the display area. If the window is larger than * the display area, then the arrows are attached to the edges of the window, * allowing it to be scrolled within the display area. Scrolling is supported * in either a horizontal or vertical direction. * * See ShortcutList and PageScroller examples. */ class _XTP_EXT_CLASS CXTPPageScroller : public CWnd { /** @cond */ DECLARE_DYNAMIC(CXTPPageScroller) /** @endcond */ public: /** * @brief * Constructs a CXTPPageScroller object. */ CXTPPageScroller(); /** * @brief * Destroys a CXTPPageScroller object, handles cleanup and deallocation. */ virtual ~CXTPPageScroller(); public: /** * @brief * This member function creates a pager child window and attaches it to * this CWnd object. * @param dwStyle Specifies the window style attributes. See the Remarks section * for a list of styles to use. * @param rect The size and position of the window, in client coordinates of * 'pParentWnd'. * @param pParentWnd The parent window. * @param nID The ID of the child window. * @return * Nonzero if successful, otherwise zero. * @details * Styles to be added or removed can be combined by using the bitwise * OR (|) operator. It can be one or more of the following:
* PGS_AUTOSCROLL: The pager control will scroll when the user * hovers the mouse over one of the scroll buttons. * PGS_DRAGNDROP: The contained window can be a drag-and-drop * target. The pager control will automatically scroll * if an item is dragged from outside the pager over * one of the scroll buttons. * PGS_HORZ: Creates a pager control that can be scrolled horizontally. * This style and the PGS_VERT style are mutually exclusive * and cannot be combined. * PGS_VERT: Creates a pager control that can be scrolled vertically. * This is the default direction; no direction style is * specified. This style and the PGS_HORZ style are mutually * exclusive and cannot be combined. */ virtual BOOL Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID); using CWnd::Create; /** * @brief * This member function sets the contained window for the pager control. * This command will not change the parent of the contained window. It only * assigns a window handle to the pager control for scrolling. In most * cases, the contained window will be a child window. If this is the case, * then the contained window should be a child of the pager control. * @param hwndChild Handle to the window to be contained. */ void SetChild(HWND hwndChild); /** * @brief * This member function forces the pager control to recalculate the * size of the contained window. Using this command will result in a * PGN_CALCSIZE notification being sent. */ void RecalcSize(); /** * @brief * This member function enables/disables mouse forwarding for the * pager control. When mouse forwarding is enabled, the pager control * forwards WM_MOUSEMOVE messages to the contained window. * @param bForward A BOOL value that determines if mouse forwarding is enabled or * disabled. If this value is nonzero, then mouse forwarding is * enabled. If this value is zero, then mouse forwarding is disabled. */ void ForwardMouse(BOOL bForward); /** * @brief * This member function sets the current background color for the pager * control. * @param clr A COLORREF value that contains the new background color of the * pager control. * @return * A COLORREF value that contains the previous background color. */ COLORREF SetBkColor(COLORREF clr); /** * @brief * This member function retrieves the current background color for * the pager control. * @return * A COLORREF value that contains the current background color. */ COLORREF GetBkColor(); /** * @brief * This member function sets the current border size for the pager * control. * @param iBorder New size of the border, in pixels. This value should not be * larger than the pager button or less than zero. If 'iBorder' * is too large, the border will be drawn the same size as the * button. If 'iBorder' is negative, the border size will be set * to zero. * @return * An integer value that contains the previous border size in pixels. */ int SetBorder(int iBorder); /** * @brief * This member function retrieves the current border size for the pager * control. * @return * An integer value that contains the current border size in pixels. */ int GetBorder(); /** * @brief * This member function sets the scroll position for the pager control. * @param iPos Integer value that contains the new scroll position in pixels. */ void SetPos(int iPos); /** * @brief * This member function retrieves the current scroll position of the * pager control. * @return * An integer value that contains the current scroll position in pixels. */ int GetPos(); /** * @brief * This member function sets the current button size for the pager * control. * @param iSize Integer value that contains the new button size in pixels. * @return * An integer value that contains the previous button size in pixels. */ int SetButtonSize(int iSize); /** * @brief * This member function retrieves the current button size for the pager * control. * @return * An integer value that contains the current button size in pixels. */ int GetButtonSize(); /** * @brief * This member function retrieves the state of the specified button * in a pager control. * @param iButton Indicates which button to retrieve the state for. See the description * for 'iButton' in PGM_GETBUTTONSTATE for a list of possible values. * @return * The state of the button specified in 'iButton'. See the return value * description in PGM_GETBUTTONSTATE for a list of possible values. */ DWORD GetButtonState(int iButton); /** * @brief * This member function retrieves a pager control's IDropTarget interface * pointer. * @param ppdt Address of an IDropTarget pointer that receives the interface * pointer. It is the caller's responsibility to call Release on this * pointer when it is no longer needed. */ void GetDropTarget(IDropTarget** ppdt); protected: /** @cond */ DECLARE_MESSAGE_MAP() //{{AFX_VIRTUAL(CXTPPageScroller) //}}AFX_VIRTUAL //{{AFX_MSG(CXTPPageScroller) //}}AFX_MSG /** @endcond */ }; ////////////////////////////////////////////////////////////////////// /** @cond */ AFX_INLINE void CXTPPageScroller::SetChild(HWND hwndChild) { _ASSERTE(::IsWindow(m_hWnd)); Pager_SetChild(m_hWnd, hwndChild); } AFX_INLINE void CXTPPageScroller::RecalcSize() { _ASSERTE(::IsWindow(m_hWnd)); Pager_RecalcSize(m_hWnd); } AFX_INLINE void CXTPPageScroller::ForwardMouse(BOOL bForward) { _ASSERTE(::IsWindow(m_hWnd)); Pager_ForwardMouse(m_hWnd, bForward); } AFX_INLINE COLORREF CXTPPageScroller::SetBkColor(COLORREF clr) { _ASSERTE(::IsWindow(m_hWnd)); return Pager_SetBkColor(m_hWnd, clr); } AFX_INLINE COLORREF CXTPPageScroller::GetBkColor() { _ASSERTE(::IsWindow(m_hWnd)); return Pager_GetBkColor(m_hWnd); } AFX_INLINE int CXTPPageScroller::SetBorder(int iBorder) { _ASSERTE(::IsWindow(m_hWnd)); return Pager_SetBorder(m_hWnd, iBorder); } AFX_INLINE int CXTPPageScroller::GetBorder() { _ASSERTE(::IsWindow(m_hWnd)); return Pager_GetBorder(m_hWnd); } AFX_INLINE void CXTPPageScroller::SetPos(int iPos) { _ASSERTE(::IsWindow(m_hWnd)); Pager_SetPos(m_hWnd, iPos); } AFX_INLINE int CXTPPageScroller::GetPos() { _ASSERTE(::IsWindow(m_hWnd)); return Pager_GetPos(m_hWnd); } AFX_INLINE int CXTPPageScroller::SetButtonSize(int iSize) { _ASSERTE(::IsWindow(m_hWnd)); return Pager_SetButtonSize(m_hWnd, iSize); } AFX_INLINE int CXTPPageScroller::GetButtonSize() { _ASSERTE(::IsWindow(m_hWnd)); return Pager_GetButtonSize(m_hWnd); } AFX_INLINE DWORD CXTPPageScroller::GetButtonState(int iButton) { _ASSERTE(::IsWindow(m_hWnd)); return Pager_GetButtonState(m_hWnd, iButton); } AFX_INLINE void CXTPPageScroller::GetDropTarget(IDropTarget** ppdt) { _ASSERTE(::IsWindow(m_hWnd)); Pager_GetDropTarget(m_hWnd, ppdt); } /** @endcond */ # include "Common/Base/Diagnostic/XTPEnableNoisyWarnings.h" /** @cond */ #endif // #if !defined(__XTPPAGERSCROLLER_H__) /** @endcond */