From f47ae6e7e93db278822870ea41c35475d7d3d198 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Wed, 30 Jan 2002 16:01:34 +0000 Subject: [PATCH] Added various calls to wxWindow::Update() to wxScrolledWindow. This is ONE solution to the redraw problem of the new delayed refresh code. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/scrolwin.cpp | 25 ++++++++++++++++++++++++- src/gtk/window.cpp | 10 ++++++++-- src/gtk1/scrolwin.cpp | 25 ++++++++++++++++++++++++- src/gtk1/window.cpp | 10 ++++++++-- 4 files changed, 64 insertions(+), 6 deletions(-) diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index 1ed216acf6..d16768c30c 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -320,6 +320,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh ) { + // Update any invalidates areas before the get moved/scrolled. + Update(); + int old_x = m_xScrollPixelsPerLine * m_xScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; @@ -355,6 +358,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, void wxScrolledWindow::AdjustScrollbars() { + // Update any invalidates areas before the get moved/scrolled. + Update(); + int w, h; m_targetWindow->GetClientSize( &w, &h ); @@ -429,6 +435,9 @@ void wxScrolledWindow::OnScroll(wxScrollWinEvent& event) int nScrollInc = CalcScrollInc(event); if (nScrollInc == 0) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + if (orient == wxHORIZONTAL) { int newPos = m_xScrollPosition + nScrollInc; @@ -473,6 +482,9 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) if (((x_pos == -1) || (x_pos == m_xScrollPosition)) && ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + if ((x_pos != -1) && (m_xScrollPixelsPerLine)) { int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); @@ -525,6 +537,9 @@ void wxScrolledWindow::GtkVScroll( float value ) if (y_pos == m_yScrollPosition) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar); @@ -552,6 +567,9 @@ void wxScrolledWindow::GtkHScroll( float value ) if (x_pos == m_xScrollPosition) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar); @@ -690,12 +708,17 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event) return nScrollInc; } -void wxScrolledWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) +void wxScrolledWindow::SetScrollPos( int orient, int pos, bool refresh ) { wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + // Update any invalidates areas before the get moved/scrolled. + // We ignore the refresh parameter here because it is meant + // to control the behaviour AFTER scrolling happens. + Update(); + if (orient == wxHORIZONTAL) { int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index e7da1dd4e7..a1df18708a 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -4088,13 +4088,19 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + // No scrolling requested. if ((dx == 0) && (dy == 0)) return; + +#if 1 m_clipPaintRegion = TRUE; + gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); + m_clipPaintRegion = FALSE; -/* +#else + if (m_children.GetCount() > 0) { gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); @@ -4144,7 +4150,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) gdk_gc_unref( m_scrollGC ); } -*/ +#endif } // Find the wxWindow at the current mouse position, also returning the mouse diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index 1ed216acf6..d16768c30c 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -320,6 +320,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, int noUnitsX, int noUnitsY, int xPos, int yPos, bool noRefresh ) { + // Update any invalidates areas before the get moved/scrolled. + Update(); + int old_x = m_xScrollPixelsPerLine * m_xScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; @@ -355,6 +358,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY, void wxScrolledWindow::AdjustScrollbars() { + // Update any invalidates areas before the get moved/scrolled. + Update(); + int w, h; m_targetWindow->GetClientSize( &w, &h ); @@ -429,6 +435,9 @@ void wxScrolledWindow::OnScroll(wxScrollWinEvent& event) int nScrollInc = CalcScrollInc(event); if (nScrollInc == 0) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + if (orient == wxHORIZONTAL) { int newPos = m_xScrollPosition + nScrollInc; @@ -473,6 +482,9 @@ void wxScrolledWindow::Scroll( int x_pos, int y_pos ) if (((x_pos == -1) || (x_pos == m_xScrollPosition)) && ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + if ((x_pos != -1) && (m_xScrollPixelsPerLine)) { int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); @@ -525,6 +537,9 @@ void wxScrolledWindow::GtkVScroll( float value ) if (y_pos == m_yScrollPosition) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar); @@ -552,6 +567,9 @@ void wxScrolledWindow::GtkHScroll( float value ) if (x_pos == m_xScrollPosition) return; + // Update any invalidates areas before the get moved/scrolled. + Update(); + GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar); @@ -690,12 +708,17 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event) return nScrollInc; } -void wxScrolledWindow::SetScrollPos( int orient, int pos, bool WXUNUSED(refresh) ) +void wxScrolledWindow::SetScrollPos( int orient, int pos, bool refresh ) { wxCHECK_RET( m_widget != NULL, wxT("invalid window") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + // Update any invalidates areas before the get moved/scrolled. + // We ignore the refresh parameter here because it is meant + // to control the behaviour AFTER scrolling happens. + Update(); + if (orient == wxHORIZONTAL) { int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index e7da1dd4e7..a1df18708a 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -4088,13 +4088,19 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); + // No scrolling requested. if ((dx == 0) && (dy == 0)) return; + +#if 1 m_clipPaintRegion = TRUE; + gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); + m_clipPaintRegion = FALSE; -/* +#else + if (m_children.GetCount() > 0) { gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); @@ -4144,7 +4150,7 @@ void wxWindowGTK::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) gdk_gc_unref( m_scrollGC ); } -*/ +#endif } // Find the wxWindow at the current mouse position, also returning the mouse -- 2.45.2