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
This commit is contained in:
Robert Roebling
2002-01-30 16:01:34 +00:00
parent 23716407e1
commit f47ae6e7e9
4 changed files with 64 additions and 6 deletions

View File

@@ -320,6 +320,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY, int noUnitsX, int noUnitsY,
int xPos, int yPos, bool noRefresh ) 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_x = m_xScrollPixelsPerLine * m_xScrollPosition;
int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
@@ -355,6 +358,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
void wxScrolledWindow::AdjustScrollbars() void wxScrolledWindow::AdjustScrollbars()
{ {
// Update any invalidates areas before the get moved/scrolled.
Update();
int w, h; int w, h;
m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetClientSize( &w, &h );
@@ -429,6 +435,9 @@ void wxScrolledWindow::OnScroll(wxScrollWinEvent& event)
int nScrollInc = CalcScrollInc(event); int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0) return; if (nScrollInc == 0) return;
// Update any invalidates areas before the get moved/scrolled.
Update();
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
int newPos = m_xScrollPosition + nScrollInc; 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)) && if (((x_pos == -1) || (x_pos == m_xScrollPosition)) &&
((y_pos == -1) || (y_pos == m_yScrollPosition))) return; ((y_pos == -1) || (y_pos == m_yScrollPosition))) return;
// Update any invalidates areas before the get moved/scrolled.
Update();
if ((x_pos != -1) && (m_xScrollPixelsPerLine)) if ((x_pos != -1) && (m_xScrollPixelsPerLine))
{ {
int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); 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) if (y_pos == m_yScrollPosition)
return; return;
// Update any invalidates areas before the get moved/scrolled.
Update();
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar); GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar);
@@ -552,6 +567,9 @@ void wxScrolledWindow::GtkHScroll( float value )
if (x_pos == m_xScrollPosition) if (x_pos == m_xScrollPosition)
return; return;
// Update any invalidates areas before the get moved/scrolled.
Update();
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar); GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar);
@@ -690,12 +708,17 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
return nScrollInc; 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_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); 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) if (orient == wxHORIZONTAL)
{ {
int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5);

View File

@@ -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") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
// No scrolling requested.
if ((dx == 0) && (dy == 0)) return; if ((dx == 0) && (dy == 0)) return;
#if 1
m_clipPaintRegion = TRUE; m_clipPaintRegion = TRUE;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE; m_clipPaintRegion = FALSE;
/* #else
if (m_children.GetCount() > 0) if (m_children.GetCount() > 0)
{ {
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); 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 ); gdk_gc_unref( m_scrollGC );
} }
*/ #endif
} }
// Find the wxWindow at the current mouse position, also returning the mouse // Find the wxWindow at the current mouse position, also returning the mouse

View File

@@ -320,6 +320,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
int noUnitsX, int noUnitsY, int noUnitsX, int noUnitsY,
int xPos, int yPos, bool noRefresh ) 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_x = m_xScrollPixelsPerLine * m_xScrollPosition;
int old_y = m_yScrollPixelsPerLine * m_yScrollPosition; int old_y = m_yScrollPixelsPerLine * m_yScrollPosition;
@@ -355,6 +358,9 @@ void wxScrolledWindow::SetScrollbars (int pixelsPerUnitX, int pixelsPerUnitY,
void wxScrolledWindow::AdjustScrollbars() void wxScrolledWindow::AdjustScrollbars()
{ {
// Update any invalidates areas before the get moved/scrolled.
Update();
int w, h; int w, h;
m_targetWindow->GetClientSize( &w, &h ); m_targetWindow->GetClientSize( &w, &h );
@@ -429,6 +435,9 @@ void wxScrolledWindow::OnScroll(wxScrollWinEvent& event)
int nScrollInc = CalcScrollInc(event); int nScrollInc = CalcScrollInc(event);
if (nScrollInc == 0) return; if (nScrollInc == 0) return;
// Update any invalidates areas before the get moved/scrolled.
Update();
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
int newPos = m_xScrollPosition + nScrollInc; 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)) && if (((x_pos == -1) || (x_pos == m_xScrollPosition)) &&
((y_pos == -1) || (y_pos == m_yScrollPosition))) return; ((y_pos == -1) || (y_pos == m_yScrollPosition))) return;
// Update any invalidates areas before the get moved/scrolled.
Update();
if ((x_pos != -1) && (m_xScrollPixelsPerLine)) if ((x_pos != -1) && (m_xScrollPixelsPerLine))
{ {
int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); 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) if (y_pos == m_yScrollPosition)
return; return;
// Update any invalidates areas before the get moved/scrolled.
Update();
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar); GtkRange *range = GTK_RANGE(scrolledWindow->vscrollbar);
@@ -552,6 +567,9 @@ void wxScrolledWindow::GtkHScroll( float value )
if (x_pos == m_xScrollPosition) if (x_pos == m_xScrollPosition)
return; return;
// Update any invalidates areas before the get moved/scrolled.
Update();
GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget); GtkScrolledWindow *scrolledWindow = GTK_SCROLLED_WINDOW(m_widget);
GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar); GtkRange *range = GTK_RANGE(scrolledWindow->hscrollbar);
@@ -690,12 +708,17 @@ int wxScrolledWindow::CalcScrollInc(wxScrollWinEvent& event)
return nScrollInc; 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_widget != NULL, wxT("invalid window") );
wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") ); 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) if (orient == wxHORIZONTAL)
{ {
int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5); int max = (int)(m_hAdjust->upper - m_hAdjust->page_size + 0.5);

View File

@@ -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") ); wxCHECK_RET( m_wxwindow != NULL, wxT("window needs client area for scrolling") );
// No scrolling requested.
if ((dx == 0) && (dy == 0)) return; if ((dx == 0) && (dy == 0)) return;
#if 1
m_clipPaintRegion = TRUE; m_clipPaintRegion = TRUE;
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = FALSE; m_clipPaintRegion = FALSE;
/* #else
if (m_children.GetCount() > 0) if (m_children.GetCount() > 0)
{ {
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy ); 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 ); gdk_gc_unref( m_scrollGC );
} }
*/ #endif
} }
// Find the wxWindow at the current mouse position, also returning the mouse // Find the wxWindow at the current mouse position, also returning the mouse