Rhino C++ API
8.13
|
#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) |
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.
CRhinoUiDialogScrollHelper::CRhinoUiDialogScrollHelper | ( | ) |
CRhinoUiDialogScrollHelper::~CRhinoUiDialogScrollHelper | ( | ) |
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 );
void CRhinoUiDialogScrollHelper::Detach | ( | ) |
CSize CRhinoUiDialogScrollHelper::DisplaySize | ( | ) | const |
void CRhinoUiDialogScrollHelper::EnableScrollBar | ( | int | nBar, |
bool | bEnable = true |
||
) |
void CRhinoUiDialogScrollHelper::EnableScrollBars | ( | bool | bEnable = true | ) |
Enables or disables the scroll bars (without hiding them).
void CRhinoUiDialogScrollHelper::OnHScroll | ( | UINT | nSBCode, |
UINT | nPos, | ||
CScrollBar * | pScrollBar | ||
) |
Your dialog should implement these message handlers, and them forward those messages to these handlers.
BOOL32 CRhinoUiDialogScrollHelper::OnMouseWheel | ( | UINT | nFlags, |
short | zDelta, | ||
CPoint | pt | ||
) |
void CRhinoUiDialogScrollHelper::OnSize | ( | UINT | nType, |
int | cx, | ||
int | cy | ||
) |
void CRhinoUiDialogScrollHelper::OnVScroll | ( | UINT | nSBCode, |
UINT | nPos, | ||
CScrollBar * | pScrollBar | ||
) |
CSize CRhinoUiDialogScrollHelper::PageSize | ( | ) | const |
Returns the current page size.
CSize CRhinoUiDialogScrollHelper::ScrollPos | ( | ) | const |
Returns the current scroll position. This might be in OnPaint() overrides.
void CRhinoUiDialogScrollHelper::ScrollToOrigin | ( | bool | bScrollLeft, |
bool | bScrollTop | ||
) |
Scroll back to top, left, or top-left corner of the window.
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 ); }
void CRhinoUiDialogScrollHelper::SetDisplaySize | ( | int | width, |
int | height | ||
) |