From 11026f7b59168c36240b4db4c3deaef5dd936846 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sun, 16 Aug 1998 17:07:17 +0000 Subject: [PATCH] New scrolling for GTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@565 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/dc.h | 10 --------- include/wx/gtk/win_gtk.h | 6 ----- include/wx/gtk/window.h | 2 -- include/wx/gtk1/dc.h | 10 --------- include/wx/gtk1/win_gtk.h | 6 ----- include/wx/gtk1/window.h | 2 -- src/gtk/dc.cpp | 26 ++-------------------- src/gtk/dcclient.cpp | 2 -- src/gtk/win_gtk.c | 45 ++++++------------------------------- src/gtk/window.cpp | 47 +++++++++------------------------------ src/gtk1/dc.cpp | 26 ++-------------------- src/gtk1/dcclient.cpp | 2 -- src/gtk1/win_gtk.c | 45 ++++++------------------------------- src/gtk1/window.cpp | 47 +++++++++------------------------------ user/wxTest/wxTest.cpp | 13 +---------- 15 files changed, 41 insertions(+), 248 deletions(-) diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 35b9424414..e2a3af7b40 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -169,8 +169,6 @@ class wxDC: public wxObject virtual void GetLogicalOrigin( long *x, long *y ); virtual void SetDeviceOrigin( long x, long y ); virtual void GetDeviceOrigin( long *x, long *y ); - virtual void SetInternalDeviceOrigin( long x, long y ); - virtual void GetInternalDeviceOrigin( long *x, long *y ); virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); @@ -283,14 +281,6 @@ class wxDC: public wxObject // not sure what for, but what is a mm on a screen you don't know the size of? double m_mm_to_pix_x,m_mm_to_pix_y; - long m_internalDeviceOriginX,m_internalDeviceOriginY; // If un-scrolled is non-zero or - // d.o. changes with scrolling. - // Set using SetInternalDeviceOrigin(). - - long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes - // such as wxScrolledWindow - // using SetDeviceOrigin() - long m_deviceOriginX,m_deviceOriginY; // Sum of the two above. long m_logicalOriginX,m_logicalOriginY; // User defined. diff --git a/include/wx/gtk/win_gtk.h b/include/wx/gtk/win_gtk.h index 6bc8e3ea11..38901e8f1d 100644 --- a/include/wx/gtk/win_gtk.h +++ b/include/wx/gtk/win_gtk.h @@ -36,9 +36,6 @@ struct _GtkMyFixed GtkContainer container; GList *children; - - gint16 scroll_offset_x; - gint16 scroll_offset_y; }; struct _GtkMyFixedClass @@ -55,9 +52,6 @@ struct _GtkMyFixedChild guint gtk_myfixed_get_type (void); GtkWidget* gtk_myfixed_new (void); -void gtk_myfixed_set_offset (GtkMyFixed *myfixed, - gint16 x, - gint16 y); void gtk_myfixed_put (GtkMyFixed *myfixed, GtkWidget *widget, gint16 x, diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index d8ee284bf2..e0dc7aae9c 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -235,7 +235,6 @@ public: // cannot get private going yet bool HasVMT(); virtual void ImplementSetSize(); virtual void ImplementSetPosition(); - void GetDrawingOffset( long *x, long *y ); wxWindow *m_parent; wxList m_children; @@ -257,7 +256,6 @@ public: // cannot get private going yet bool m_isShown; bool m_isEnabled; wxString m_windowName; - long m_drawingOffsetX,m_drawingOffsetY; GtkWidget *m_widget; GtkWidget *m_wxwindow; diff --git a/include/wx/gtk1/dc.h b/include/wx/gtk1/dc.h index 35b9424414..e2a3af7b40 100644 --- a/include/wx/gtk1/dc.h +++ b/include/wx/gtk1/dc.h @@ -169,8 +169,6 @@ class wxDC: public wxObject virtual void GetLogicalOrigin( long *x, long *y ); virtual void SetDeviceOrigin( long x, long y ); virtual void GetDeviceOrigin( long *x, long *y ); - virtual void SetInternalDeviceOrigin( long x, long y ); - virtual void GetInternalDeviceOrigin( long *x, long *y ); virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); @@ -283,14 +281,6 @@ class wxDC: public wxObject // not sure what for, but what is a mm on a screen you don't know the size of? double m_mm_to_pix_x,m_mm_to_pix_y; - long m_internalDeviceOriginX,m_internalDeviceOriginY; // If un-scrolled is non-zero or - // d.o. changes with scrolling. - // Set using SetInternalDeviceOrigin(). - - long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes - // such as wxScrolledWindow - // using SetDeviceOrigin() - long m_deviceOriginX,m_deviceOriginY; // Sum of the two above. long m_logicalOriginX,m_logicalOriginY; // User defined. diff --git a/include/wx/gtk1/win_gtk.h b/include/wx/gtk1/win_gtk.h index 6bc8e3ea11..38901e8f1d 100644 --- a/include/wx/gtk1/win_gtk.h +++ b/include/wx/gtk1/win_gtk.h @@ -36,9 +36,6 @@ struct _GtkMyFixed GtkContainer container; GList *children; - - gint16 scroll_offset_x; - gint16 scroll_offset_y; }; struct _GtkMyFixedClass @@ -55,9 +52,6 @@ struct _GtkMyFixedChild guint gtk_myfixed_get_type (void); GtkWidget* gtk_myfixed_new (void); -void gtk_myfixed_set_offset (GtkMyFixed *myfixed, - gint16 x, - gint16 y); void gtk_myfixed_put (GtkMyFixed *myfixed, GtkWidget *widget, gint16 x, diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index d8ee284bf2..e0dc7aae9c 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -235,7 +235,6 @@ public: // cannot get private going yet bool HasVMT(); virtual void ImplementSetSize(); virtual void ImplementSetPosition(); - void GetDrawingOffset( long *x, long *y ); wxWindow *m_parent; wxList m_children; @@ -257,7 +256,6 @@ public: // cannot get private going yet bool m_isShown; bool m_isEnabled; wxString m_windowName; - long m_drawingOffsetX,m_drawingOffsetY; GtkWidget *m_widget; GtkWidget *m_wxwindow; diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 054ba0407c..68e5f74682 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -47,10 +47,6 @@ wxDC::wxDC(void) m_logicalOriginY = 0; m_deviceOriginX = 0; m_deviceOriginY = 0; - m_internalDeviceOriginX = 0; - m_internalDeviceOriginY = 0; - m_externalDeviceOriginX = 0; - m_externalDeviceOriginY = 0; m_logicalScaleX = 1.0; m_logicalScaleY = 1.0; @@ -286,32 +282,17 @@ void wxDC::GetLogicalOrigin( long *x, long *y ) void wxDC::SetDeviceOrigin( long x, long y ) { - m_externalDeviceOriginX = x; - m_externalDeviceOriginY = y; + m_deviceOriginX = x; + m_deviceOriginY = y; ComputeScaleAndOrigin(); }; void wxDC::GetDeviceOrigin( long *x, long *y ) { -// if (x) *x = m_externalDeviceOriginX; -// if (y) *y = m_externalDeviceOriginY; if (x) *x = m_deviceOriginX; if (y) *y = m_deviceOriginY; }; -void wxDC::SetInternalDeviceOrigin( long x, long y ) -{ - m_internalDeviceOriginX = x; - m_internalDeviceOriginY = y; - ComputeScaleAndOrigin(); -}; - -void wxDC::GetInternalDeviceOrigin( long *x, long *y ) -{ - if (x) *x = m_internalDeviceOriginX; - if (y) *y = m_internalDeviceOriginY; -}; - void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { m_signX = (xLeftRight ? 1 : -1); @@ -376,9 +357,6 @@ void wxDC::ComputeScaleAndOrigin(void) m_scaleX = m_logicalScaleX * m_userScaleX; m_scaleY = m_logicalScaleY * m_userScaleY; - m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX; - m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY; - // CMB: if scale has changed call SetPen to recalulate the line width if (m_scaleX != origScaleX || m_scaleY != origScaleY) { diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index e8473c5318..37e2ebbf25 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -118,8 +118,6 @@ wxPaintDC::wxPaintDC( wxWindow *window ) long x = 0; long y = 0; - window->GetDrawingOffset( &x, &y ); - SetInternalDeviceOrigin( -x, -y ); } wxPaintDC::~wxPaintDC(void) diff --git a/src/gtk/win_gtk.c b/src/gtk/win_gtk.c index e823bfa4a8..a6db981930 100644 --- a/src/gtk/win_gtk.c +++ b/src/gtk/win_gtk.c @@ -107,35 +107,9 @@ gtk_myfixed_new () myfixed = gtk_type_new (gtk_myfixed_get_type ()); - myfixed->scroll_offset_x = 0; - myfixed->scroll_offset_y = 0; - return GTK_WIDGET (myfixed); } -void -gtk_myfixed_set_offset (GtkMyFixed *myfixed, - gint16 x, - gint16 y) -{ - GtkWidget *widget; - - g_return_if_fail (myfixed != NULL); - g_return_if_fail (GTK_IS_MYFIXED (myfixed)); - - myfixed->scroll_offset_x = x; - myfixed->scroll_offset_y = y; - - widget = GTK_WIDGET( myfixed ); - - if (GTK_WIDGET_REALIZED( GTK_WIDGET(myfixed) )) - gdk_window_move_resize (widget->window, - widget->allocation.x + x, - widget->allocation.y + y, - 32000, - 32000); -} - void gtk_myfixed_put (GtkMyFixed *myfixed, GtkWidget *widget, @@ -150,8 +124,8 @@ gtk_myfixed_put (GtkMyFixed *myfixed, child_info = g_new (GtkMyFixedChild, 1); child_info->widget = widget; - child_info->x = x - myfixed->scroll_offset_x; - child_info->y = y - myfixed->scroll_offset_y; + child_info->x = x; + child_info->y = y; gtk_widget_set_parent (widget, GTK_WIDGET (myfixed)); @@ -188,8 +162,8 @@ gtk_myfixed_move (GtkMyFixed *myfixed, if (child->widget == widget) { - child->x = x - myfixed->scroll_offset_x; - child->y = y - myfixed->scroll_offset_y; + child->x = x; + child->y = y; if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed)) gtk_widget_queue_resize (GTK_WIDGET (myfixed)); @@ -250,8 +224,8 @@ gtk_myfixed_realize (GtkWidget *widget) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x + myfixed->scroll_offset_x; - attributes.y = widget->allocation.y + myfixed->scroll_offset_x; + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; attributes.width = 32000; attributes.height = 32000; attributes.wclass = GDK_INPUT_OUTPUT; @@ -331,12 +305,7 @@ gtk_myfixed_size_allocate (GtkWidget *widget, widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, - allocation->x + myfixed->scroll_offset_x, - allocation->y + myfixed->scroll_offset_y, - 32000, - 32000 - ); + gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 ); border_width = GTK_CONTAINER (myfixed)->border_width; diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 81628667f9..515eb483cc 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -746,8 +746,6 @@ wxWindow::wxWindow() m_oldVerticalPos = 0.0; m_isShown = FALSE; m_isEnabled = TRUE; - m_drawingOffsetX = 0; - m_drawingOffsetY = 0; m_pDropTarget = NULL; m_resizing = FALSE; } @@ -927,8 +925,6 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_windowSizer = NULL; m_sizerParent = NULL; m_autoLayout = FALSE; - m_drawingOffsetX = 0; - m_drawingOffsetY = 0; m_pDropTarget = NULL; m_resizing = FALSE; m_windowValidator = NULL; @@ -1008,7 +1004,12 @@ void wxWindow::PostCreation(void) */ if (m_widget && m_parent) gtk_widget_realize( m_widget ); - if (m_wxwindow) gtk_widget_realize( m_wxwindow ); + + if (m_wxwindow) + { + gtk_widget_realize( m_wxwindow ); + gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); + } SetCursor( wxSTANDARD_CURSOR ); @@ -1047,7 +1048,7 @@ bool wxWindow::DestroyChildren(void) if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) { delete child; - if (GetChildren()->Member(child)) delete node; + if (GetChildren()->Member(child)) delete node; } } } @@ -1645,19 +1646,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) { if (m_wxwindow) { - wxClientDC dc(this); - PrepareDC(dc); - long x = 0; - long y = 0; - dc.GetInternalDeviceOrigin( &x, &y ); - int w = 0; int h = 0; GetClientSize( &w, &h ); GdkRectangle gdk_rect; - gdk_rect.x = x; - gdk_rect.y = y; + gdk_rect.x = 0; + gdk_rect.y = 0; gdk_rect.width = w; gdk_rect.height = h; gtk_widget_draw( m_wxwindow, &gdk_rect ); @@ -1993,23 +1988,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, if (m_wxwindow->window) { if (orient == wxHORIZONTAL) - { -/* - m_drawingOffsetX = -16000; - - gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY ); -*/ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); - } else - { -/* - m_drawingOffsetY = -16000; - - gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY ); -*/ gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); - } gtk_widget_set_usize( m_widget, m_width, m_height ); } @@ -2078,6 +2059,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { if (!m_wxwindow) return; +/* bool refresh = FALSE; if ((m_drawingOffsetX == 0) && (m_drawingOffsetY == 0)) @@ -2098,9 +2080,9 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) if (refresh) Refresh(); -/* The code here is very nifty, but it doesn't work with overlapping windows... +*/ int cw = 0; int ch = 0; @@ -2131,13 +2113,6 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) if (dx != 0) rect.height = ch; else rect.height = abs(dy); Refresh( TRUE, &rect ); -*/ -} - -void wxWindow::GetDrawingOffset( long *x, long *y ) -{ - if (x) *x = m_drawingOffsetX; - if (y) *y = m_drawingOffsetY; } //------------------------------------------------------------------------------------- diff --git a/src/gtk1/dc.cpp b/src/gtk1/dc.cpp index 054ba0407c..68e5f74682 100644 --- a/src/gtk1/dc.cpp +++ b/src/gtk1/dc.cpp @@ -47,10 +47,6 @@ wxDC::wxDC(void) m_logicalOriginY = 0; m_deviceOriginX = 0; m_deviceOriginY = 0; - m_internalDeviceOriginX = 0; - m_internalDeviceOriginY = 0; - m_externalDeviceOriginX = 0; - m_externalDeviceOriginY = 0; m_logicalScaleX = 1.0; m_logicalScaleY = 1.0; @@ -286,32 +282,17 @@ void wxDC::GetLogicalOrigin( long *x, long *y ) void wxDC::SetDeviceOrigin( long x, long y ) { - m_externalDeviceOriginX = x; - m_externalDeviceOriginY = y; + m_deviceOriginX = x; + m_deviceOriginY = y; ComputeScaleAndOrigin(); }; void wxDC::GetDeviceOrigin( long *x, long *y ) { -// if (x) *x = m_externalDeviceOriginX; -// if (y) *y = m_externalDeviceOriginY; if (x) *x = m_deviceOriginX; if (y) *y = m_deviceOriginY; }; -void wxDC::SetInternalDeviceOrigin( long x, long y ) -{ - m_internalDeviceOriginX = x; - m_internalDeviceOriginY = y; - ComputeScaleAndOrigin(); -}; - -void wxDC::GetInternalDeviceOrigin( long *x, long *y ) -{ - if (x) *x = m_internalDeviceOriginX; - if (y) *y = m_internalDeviceOriginY; -}; - void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { m_signX = (xLeftRight ? 1 : -1); @@ -376,9 +357,6 @@ void wxDC::ComputeScaleAndOrigin(void) m_scaleX = m_logicalScaleX * m_userScaleX; m_scaleY = m_logicalScaleY * m_userScaleY; - m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX; - m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY; - // CMB: if scale has changed call SetPen to recalulate the line width if (m_scaleX != origScaleX || m_scaleY != origScaleY) { diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index e8473c5318..37e2ebbf25 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -118,8 +118,6 @@ wxPaintDC::wxPaintDC( wxWindow *window ) long x = 0; long y = 0; - window->GetDrawingOffset( &x, &y ); - SetInternalDeviceOrigin( -x, -y ); } wxPaintDC::~wxPaintDC(void) diff --git a/src/gtk1/win_gtk.c b/src/gtk1/win_gtk.c index e823bfa4a8..a6db981930 100644 --- a/src/gtk1/win_gtk.c +++ b/src/gtk1/win_gtk.c @@ -107,35 +107,9 @@ gtk_myfixed_new () myfixed = gtk_type_new (gtk_myfixed_get_type ()); - myfixed->scroll_offset_x = 0; - myfixed->scroll_offset_y = 0; - return GTK_WIDGET (myfixed); } -void -gtk_myfixed_set_offset (GtkMyFixed *myfixed, - gint16 x, - gint16 y) -{ - GtkWidget *widget; - - g_return_if_fail (myfixed != NULL); - g_return_if_fail (GTK_IS_MYFIXED (myfixed)); - - myfixed->scroll_offset_x = x; - myfixed->scroll_offset_y = y; - - widget = GTK_WIDGET( myfixed ); - - if (GTK_WIDGET_REALIZED( GTK_WIDGET(myfixed) )) - gdk_window_move_resize (widget->window, - widget->allocation.x + x, - widget->allocation.y + y, - 32000, - 32000); -} - void gtk_myfixed_put (GtkMyFixed *myfixed, GtkWidget *widget, @@ -150,8 +124,8 @@ gtk_myfixed_put (GtkMyFixed *myfixed, child_info = g_new (GtkMyFixedChild, 1); child_info->widget = widget; - child_info->x = x - myfixed->scroll_offset_x; - child_info->y = y - myfixed->scroll_offset_y; + child_info->x = x; + child_info->y = y; gtk_widget_set_parent (widget, GTK_WIDGET (myfixed)); @@ -188,8 +162,8 @@ gtk_myfixed_move (GtkMyFixed *myfixed, if (child->widget == widget) { - child->x = x - myfixed->scroll_offset_x; - child->y = y - myfixed->scroll_offset_y; + child->x = x; + child->y = y; if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed)) gtk_widget_queue_resize (GTK_WIDGET (myfixed)); @@ -250,8 +224,8 @@ gtk_myfixed_realize (GtkWidget *widget) GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); attributes.window_type = GDK_WINDOW_CHILD; - attributes.x = widget->allocation.x + myfixed->scroll_offset_x; - attributes.y = widget->allocation.y + myfixed->scroll_offset_x; + attributes.x = widget->allocation.x; + attributes.y = widget->allocation.y; attributes.width = 32000; attributes.height = 32000; attributes.wclass = GDK_INPUT_OUTPUT; @@ -331,12 +305,7 @@ gtk_myfixed_size_allocate (GtkWidget *widget, widget->allocation = *allocation; if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, - allocation->x + myfixed->scroll_offset_x, - allocation->y + myfixed->scroll_offset_y, - 32000, - 32000 - ); + gdk_window_move_resize (widget->window, allocation->x, allocation->y, 32000, 32000 ); border_width = GTK_CONTAINER (myfixed)->border_width; diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 81628667f9..515eb483cc 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -746,8 +746,6 @@ wxWindow::wxWindow() m_oldVerticalPos = 0.0; m_isShown = FALSE; m_isEnabled = TRUE; - m_drawingOffsetX = 0; - m_drawingOffsetY = 0; m_pDropTarget = NULL; m_resizing = FALSE; } @@ -927,8 +925,6 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_windowSizer = NULL; m_sizerParent = NULL; m_autoLayout = FALSE; - m_drawingOffsetX = 0; - m_drawingOffsetY = 0; m_pDropTarget = NULL; m_resizing = FALSE; m_windowValidator = NULL; @@ -1008,7 +1004,12 @@ void wxWindow::PostCreation(void) */ if (m_widget && m_parent) gtk_widget_realize( m_widget ); - if (m_wxwindow) gtk_widget_realize( m_wxwindow ); + + if (m_wxwindow) + { + gtk_widget_realize( m_wxwindow ); + gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); + } SetCursor( wxSTANDARD_CURSOR ); @@ -1047,7 +1048,7 @@ bool wxWindow::DestroyChildren(void) if ((child = (wxWindow *)node->Data()) != (wxWindow *)NULL) { delete child; - if (GetChildren()->Member(child)) delete node; + if (GetChildren()->Member(child)) delete node; } } } @@ -1645,19 +1646,13 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) { if (m_wxwindow) { - wxClientDC dc(this); - PrepareDC(dc); - long x = 0; - long y = 0; - dc.GetInternalDeviceOrigin( &x, &y ); - int w = 0; int h = 0; GetClientSize( &w, &h ); GdkRectangle gdk_rect; - gdk_rect.x = x; - gdk_rect.y = y; + gdk_rect.x = 0; + gdk_rect.y = 0; gdk_rect.width = w; gdk_rect.height = h; gtk_widget_draw( m_wxwindow, &gdk_rect ); @@ -1993,23 +1988,9 @@ void wxWindow::SetScrollbar( int orient, int pos, int thumbVisible, if (m_wxwindow->window) { if (orient == wxHORIZONTAL) - { -/* - m_drawingOffsetX = -16000; - - gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY ); -*/ gtk_signal_emit_by_name( GTK_OBJECT(m_hAdjust), "changed" ); - } else - { -/* - m_drawingOffsetY = -16000; - - gtk_myfixed_set_offset( GTK_MYFIXED(m_wxwindow), m_drawingOffsetX, m_drawingOffsetY ); -*/ gtk_signal_emit_by_name( GTK_OBJECT(m_vAdjust), "changed" ); - } gtk_widget_set_usize( m_widget, m_width, m_height ); } @@ -2078,6 +2059,7 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) { if (!m_wxwindow) return; +/* bool refresh = FALSE; if ((m_drawingOffsetX == 0) && (m_drawingOffsetY == 0)) @@ -2098,9 +2080,9 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) if (refresh) Refresh(); -/* The code here is very nifty, but it doesn't work with overlapping windows... +*/ int cw = 0; int ch = 0; @@ -2131,13 +2113,6 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) if (dx != 0) rect.height = ch; else rect.height = abs(dy); Refresh( TRUE, &rect ); -*/ -} - -void wxWindow::GetDrawingOffset( long *x, long *y ) -{ - if (x) *x = m_drawingOffsetX; - if (y) *y = m_drawingOffsetY; } //------------------------------------------------------------------------------------- diff --git a/user/wxTest/wxTest.cpp b/user/wxTest/wxTest.cpp index 837fae3510..ad8a2296dc 100644 --- a/user/wxTest/wxTest.cpp +++ b/user/wxTest/wxTest.cpp @@ -434,7 +434,6 @@ const ID_ABOUT = 109; IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame ) BEGIN_EVENT_TABLE(MyFrame,wxFrame) - EVT_SIZE (MyFrame::OnSize) EVT_MENU (ID_OPEN, MyFrame::OnOpenDialog) EVT_MENU (ID_FONT, MyFrame::OnFontDialog) EVT_MENU (ID_MSG, MyFrame::OnMsg) @@ -474,21 +473,11 @@ MyFrame::MyFrame(void) : m_tb->SetMargins( 2, 2 ); m_tb->AddTool( 0, wxBitmap( list_xpm ), wxNullBitmap, FALSE, -1, -1, NULL, "This is a button" ); m_tb->AddTool( 0, wxBitmap( folder_xpm ), wxNullBitmap, TRUE, -1, -1, NULL, "This is a toggle" ); - m_tb->Layout(); + m_tb->Realize(); // m_timer.Start( 1000, TRUE ); }; -void MyFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) -{ - int x = 0; - int y = 0; - GetClientSize( &x, &y ); - - m_tb->SetSize( 1, 0, x-2, 42 ); - m_canvas-> SetSize( 0, 42, x, y-42 ); -}; - void MyFrame::OnDialog( wxCommandEvent &WXUNUSED(event) ) { MyDialog *dialog = new MyDialog( this ); -- 2.47.2