From b9b3393e48488d37af26cd833ca435b87bc24d73 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 29 Jul 2001 22:47:40 +0000 Subject: [PATCH] added ScrollLines/Pages git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11210 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/window.h | 3 +++ include/wx/window.h | 9 +++++++++ src/msw/window.cpp | 18 ++++++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index 25abce27c7..6e654f53f1 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -118,6 +118,9 @@ public: virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL ); + virtual void ScrollLines(int lines); + virtual void ScrollPages(int pages); + #if wxUSE_DRAG_AND_DROP virtual void SetDropTarget( wxDropTarget *dropTarget ); #endif // wxUSE_DRAG_AND_DROP diff --git a/include/wx/window.h b/include/wx/window.h index 7c90cd042d..f1534578e3 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -663,6 +663,15 @@ public: virtual void ScrollWindow( int dx, int dy, 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 // ---------------------- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 1a196846f7..4eeb736295 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -940,6 +940,24 @@ void wxWindowMSW::ScrollWindow(int dx, int dy, const wxRect *prect) ::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 // ---------------------------------------------------------------------------