From b5a49d4c5267d4eb933d45ec615ac2ed374750dc Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 29 Mar 2002 18:01:50 +0000 Subject: [PATCH] A bit of scrolling works under GTK 2.0 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/private.h | 7 ++----- include/wx/gtk1/private.h | 7 ++----- samples/erase/erase.cpp | 11 +++++++++++ samples/erase/mondrian.xpm | 15 ++++++++------- src/gtk/window.cpp | 6 +++--- src/gtk1/window.cpp | 6 +++--- 6 files changed, 29 insertions(+), 23 deletions(-) diff --git a/include/wx/gtk/private.h b/include/wx/gtk/private.h index aa0dd2841e..93ea5878c4 100644 --- a/include/wx/gtk/private.h +++ b/include/wx/gtk/private.h @@ -87,12 +87,9 @@ #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel #endif -// VZ: I _think_ that in GTK+ 2.0 the scroll type is passed to the -// value_changed callback as a 2nd argument but I'm not at all sure about -// it, if this is false all occurences of this macro must be changed! #ifdef __WXGTK20__ - #define SCROLLBAR_CBACK_ARG GtkScrollType scrollType, - #define GET_SCROLL_TYPE(w) scrollType + #define SCROLLBAR_CBACK_ARG + #define GET_SCROLL_TYPE(w) GTK_SCROLL_JUMP #else #define SCROLLBAR_CBACK_ARG #define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type diff --git a/include/wx/gtk1/private.h b/include/wx/gtk1/private.h index aa0dd2841e..93ea5878c4 100644 --- a/include/wx/gtk1/private.h +++ b/include/wx/gtk1/private.h @@ -87,12 +87,9 @@ #define NOTEBOOK_PANEL(nb) GTK_NOTEBOOK(nb)->panel #endif -// VZ: I _think_ that in GTK+ 2.0 the scroll type is passed to the -// value_changed callback as a 2nd argument but I'm not at all sure about -// it, if this is false all occurences of this macro must be changed! #ifdef __WXGTK20__ - #define SCROLLBAR_CBACK_ARG GtkScrollType scrollType, - #define GET_SCROLL_TYPE(w) scrollType + #define SCROLLBAR_CBACK_ARG + #define GET_SCROLL_TYPE(w) GTK_SCROLL_JUMP #else #define SCROLLBAR_CBACK_ARG #define GET_SCROLL_TYPE(w) GTK_RANGE((w))->scroll_type diff --git a/samples/erase/erase.cpp b/samples/erase/erase.cpp index 9f159bbebc..d9f5cfc041 100644 --- a/samples/erase/erase.cpp +++ b/samples/erase/erase.cpp @@ -74,6 +74,8 @@ public: void OnPaint( wxPaintEvent &event ); void OnEraseBackground( wxEraseEvent &event ); + + wxBitmap m_bitmap; private: DECLARE_EVENT_TABLE() @@ -174,6 +176,10 @@ MyCanvas::MyCanvas( MyFrame *parent ) wxScrolledWindowStyle|wxNO_FULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER ) { SetScrollbars( 10, 10, 40, 100, 0, 0 ); + + m_bitmap = wxBitmap( mondrian_xpm ); + + new wxStaticBitmap( this, -1, m_bitmap, wxPoint(80,20) ); } void MyCanvas::OnPaint( wxPaintEvent &event ) @@ -181,6 +187,11 @@ void MyCanvas::OnPaint( wxPaintEvent &event ) wxPaintDC dc(this); PrepareDC( dc ); + dc.SetBrush( *wxBLACK_BRUSH ); + dc.DrawRectangle( 0,0,200,50 ); + + dc.DrawBitmap( m_bitmap, 10, 20, TRUE ); + #if 0 wxRegionIterator upd( GetUpdateRegion() ); while (upd) diff --git a/samples/erase/mondrian.xpm b/samples/erase/mondrian.xpm index 409f27a843..ad2e33a2b5 100644 --- a/samples/erase/mondrian.xpm +++ b/samples/erase/mondrian.xpm @@ -1,13 +1,14 @@ /* XPM */ static char *mondrian_xpm[] = { /* columns rows colors chars-per-pixel */ -"32 32 6 1", +"32 32 7 1", " c Black", ". c Blue", "X c #00bf00", "o c Red", "O c Yellow", "+ c Gray100", +"a c None", /* pixels */ " ", " oooooo +++++++++++++++++++++++ ", @@ -20,13 +21,13 @@ static char *mondrian_xpm[] = { " ", " ++++++ ++++++++++++++++++ .... ", " ++++++ ++++++++++++++++++ .... ", +" ++++++ +aaaaaaaaaaaaaaaa+ .... ", +" ++++++ +aaaaaaaaaaaaaaaa+ .... ", " ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ .... ", -" ++++++ ++++++++++++++++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", -" ++++++ ++++++++++++++++++ ++++ ", +" ++++++ +aaaaaaaaaaaaaaaa+ ", +" ++++++ +aaaaaaaaaaaaaaaa+ ++++ ", +" ++++++ +aaaaaaaaaaaaaaaa+ ++++ ", +" ++++++ +aaaaaaaaaaaaaaaa+ ++++ ", " ++++++ ++++++++++++++++++ ++++ ", " ++++++ ++++++++++++++++++ ++++ ", " ++++++ ++++++++++++++++++ ++++ ", diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 17175ec63d..38b3a20847 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -4092,10 +4092,10 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = FALSE; #else - gdk_window_scroll( GTK_PIZZA(m_wxwindow)->bin_window, -dx, -dy ); + gdk_window_scroll( GTK_PIZZA(m_wxwindow)->bin_window, dx, dy ); - GTK_PIZZA(m_wxwindow)->xoffset -= dx; - GTK_PIZZA(m_wxwindow)->yoffset -= dy; + GTK_PIZZA(m_wxwindow)->xoffset += dx; + GTK_PIZZA(m_wxwindow)->yoffset += dy; #endif diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 17175ec63d..38b3a20847 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -4092,10 +4092,10 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) m_clipPaintRegion = FALSE; #else - gdk_window_scroll( GTK_PIZZA(m_wxwindow)->bin_window, -dx, -dy ); + gdk_window_scroll( GTK_PIZZA(m_wxwindow)->bin_window, dx, dy ); - GTK_PIZZA(m_wxwindow)->xoffset -= dx; - GTK_PIZZA(m_wxwindow)->yoffset -= dy; + GTK_PIZZA(m_wxwindow)->xoffset += dx; + GTK_PIZZA(m_wxwindow)->yoffset += dy; #endif -- 2.45.2