Rhino C++ API  8.6
Public Member Functions | List of all members
CRhinoUiDialogScrollHelper Class Reference

#include <RhinoSdkUiDialog.h>

Public Member Functions

 CRhinoUiDialogScrollHelper ()
 
 ~CRhinoUiDialogScrollHelper ()
 
void Attach (CWnd *pWnd)
 
void Detach ()
 
CSize DisplaySize () const
 
void EnableScrollBar (int nBar, bool bEnable=true)
 
void EnableScrollBars (bool bEnable=true)
 Enables or disables the scroll bars (without hiding them). More...
 
void OnHScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 
BOOL32 OnMouseWheel (UINT nFlags, short zDelta, CPoint pt)
 
void OnSize (UINT nType, int cx, int cy)
 
void OnVScroll (UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
 
CSize PageSize () const
 Returns the current page size. More...
 
CSize ScrollPos () const
 Returns the current scroll position. This might be in OnPaint() overrides. More...
 
void ScrollToOrigin (bool bScrollLeft, bool bScrollTop)
 Scroll back to top, left, or top-left corner of the window. More...
 
void SetDisplaySize (CRect rect)
 
void SetDisplaySize (int width, int height)
 

Detailed Description

This helper class will add scroll bars to any dialog.

References: MSDN ID 262954: How to create a resizable dialog box with scroll bars in Visual C++. MSDN ID 152252: How To Get 32-bit Scroll Position During Scroll Messages. "Programming Windows with MFC, 2nd Edition", by Jeff Prosise.

Remarks: Make sure your dialog has the WS_HSCROLL and/or WS_VSCROLL styles. Your dialog should also have a "Resizing" or "None" border.

Constructor & Destructor Documentation

◆ CRhinoUiDialogScrollHelper()

CRhinoUiDialogScrollHelper::CRhinoUiDialogScrollHelper ( )

◆ ~CRhinoUiDialogScrollHelper()

CRhinoUiDialogScrollHelper::~CRhinoUiDialogScrollHelper ( )

Member Function Documentation

◆ Attach()

void CRhinoUiDialogScrollHelper::Attach ( CWnd *  pWnd)

Call this in your dialog's constructor For example: m_scroller = new CRhinoUiDialogScrollHelper(); if( m_scroller ) m_scroller->Attach( this );

◆ Detach()

void CRhinoUiDialogScrollHelper::Detach ( )

◆ DisplaySize()

CSize CRhinoUiDialogScrollHelper::DisplaySize ( ) const

◆ EnableScrollBar()

void CRhinoUiDialogScrollHelper::EnableScrollBar ( int  nBar,
bool  bEnable = true 
)

◆ EnableScrollBars()

void CRhinoUiDialogScrollHelper::EnableScrollBars ( bool  bEnable = true)

Enables or disables the scroll bars (without hiding them).

◆ OnHScroll()

void CRhinoUiDialogScrollHelper::OnHScroll ( UINT  nSBCode,
UINT  nPos,
CScrollBar *  pScrollBar 
)

Your dialog should implement these message handlers, and them forward those messages to these handlers.

◆ OnMouseWheel()

BOOL32 CRhinoUiDialogScrollHelper::OnMouseWheel ( UINT  nFlags,
short  zDelta,
CPoint  pt 
)

◆ OnSize()

void CRhinoUiDialogScrollHelper::OnSize ( UINT  nType,
int  cx,
int  cy 
)

◆ OnVScroll()

void CRhinoUiDialogScrollHelper::OnVScroll ( UINT  nSBCode,
UINT  nPos,
CScrollBar *  pScrollBar 
)

◆ PageSize()

CSize CRhinoUiDialogScrollHelper::PageSize ( ) const

Returns the current page size.

◆ ScrollPos()

CSize CRhinoUiDialogScrollHelper::ScrollPos ( ) const

Returns the current scroll position. This might be in OnPaint() overrides.

◆ ScrollToOrigin()

void CRhinoUiDialogScrollHelper::ScrollToOrigin ( bool  bScrollLeft,
bool  bScrollTop 
)

Scroll back to top, left, or top-left corner of the window.

◆ SetDisplaySize() [1/2]

void CRhinoUiDialogScrollHelper::SetDisplaySize ( CRect  rect)

Set the base display size. When the dialog size is smaller than the display size, then scrollbars will appear. Set either the display width or height to zero if you don't want to enable the scroll bar in that direction. Best to call this in your OnInitDialog() member before calling the base class. For example: if( m_scroller ) { CRect rect; GetClientRect( rect ); m_scroller->SetDisplaySize( rect ); }

◆ SetDisplaySize() [2/2]

void CRhinoUiDialogScrollHelper::SetDisplaySize ( int  width,
int  height 
)