added ScrollLines/Pages

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-29 22:47:40 +00:00
parent c57e33394c
commit b9b3393e48
3 changed files with 30 additions and 0 deletions

View File

@@ -118,6 +118,9 @@ public:
virtual void ScrollWindow( int dx, int dy, virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = (wxRect *) NULL ); const wxRect* rect = (wxRect *) NULL );
virtual void ScrollLines(int lines);
virtual void ScrollPages(int pages);
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
virtual void SetDropTarget( wxDropTarget *dropTarget ); virtual void SetDropTarget( wxDropTarget *dropTarget );
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP

View File

@@ -663,6 +663,15 @@ public:
virtual void ScrollWindow( int dx, int dy, virtual void ScrollWindow( int dx, int dy,
const wxRect* rect = (wxRect *) NULL ) = 0; const wxRect* rect = (wxRect *) NULL ) = 0;
// scrolls window by line/page: note that not all controls support this
virtual void ScrollLines(int WXUNUSED(lines)) { }
virtual void ScrollPages(int WXUNUSED(pages)) { }
void LineUp() { ScrollLines(-1); }
void LineDown() { ScrollLines(1); }
void PageUp() { ScrollPages(-1); }
void PageDown() { ScrollPages(1); }
// context-sensitive help // context-sensitive help
// ---------------------- // ----------------------

View File

@@ -940,6 +940,24 @@ void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect)
::ScrollWindow(GetHwnd(), dx, dy, prect ? &rect : NULL, NULL); ::ScrollWindow(GetHwnd(), dx, dy, prect ? &rect : NULL, NULL);
} }
static void ScrollVertically(int kind, int count)
{
}
void wxWindowMSW::ScrollLines(int lines)
{
bool down = lines > 0;
ScrollVertically(down ? SB_LINEDOWN : SB_LINEUP, down ? lines : -lines);
}
void wxWindowMSW::ScrollPages(int pages)
{
bool down = pages > 0;
ScrollVertically(down ? SB_PAGEDOWN : SB_PAGEUP, down ? pages : -pages);
}
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// subclassing // subclassing
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------