X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/be9b0663d945b0c28978ab42de2966e1f3afda94..341baa4c718000e49e632d7293888fc133196f74:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index a1014097e3..9ab5ebe316 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -358,17 +358,26 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, m_targetWindow->SetVirtualSize( w, h ); if (do_refresh && !noRefresh) - m_targetWindow->Refresh(TRUE, GetRect()); - - // TODO: check if we can use AdjustScrollbars always. -#ifdef __WXUNIVERSAL__ - AdjustScrollbars(); -#else - // This is also done by AdjustScrollbars, above + m_targetWindow->Refresh(TRUE, GetScrollRect()); + +#ifndef __WXUNIVERSAL__ + // If the target is not the same as the window with the scrollbars, + // then we need to update the scrollbars here, since they won't have + // been updated by SetVirtualSize(). + if ( m_targetWindow != m_win ) +#endif // !__WXUNIVERSAL__ + { + AdjustScrollbars(); + } +#ifndef __WXUNIVERSAL__ + else + { + // otherwise this has been done by AdjustScrollbars, above #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately() ; -#endif + m_targetWindow->Update() ; #endif + } +#endif // !__WXUNIVERSAL__ } // ---------------------------------------------------------------------------- @@ -488,15 +497,15 @@ void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event) if ( needsRefresh ) { - m_targetWindow->Refresh(TRUE, GetRect()); + m_targetWindow->Refresh(TRUE, GetScrollRect()); } else { - m_targetWindow->ScrollWindow(dx, dy, GetRect()); + m_targetWindow->ScrollWindow(dx, dy, GetScrollRect()); } #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately() ; + m_targetWindow->Update() ; #endif } @@ -569,7 +578,7 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) nScrollInc = noPositions - m_xScrollPosition; // As +ve as we can go } else - m_targetWindow->Refresh(TRUE, GetRect()); + m_targetWindow->Refresh(TRUE, GetScrollRect()); } else { @@ -593,7 +602,7 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) else { // VZ: why do we do this? (FIXME) - m_targetWindow->Refresh(TRUE, GetRect()); + m_targetWindow->Refresh(TRUE, GetScrollRect()); } } @@ -604,7 +613,7 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event) void wxScrollHelper::AdjustScrollbars() { #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately(); + m_targetWindow->Update(); #endif int w = 0, h = 0; @@ -743,22 +752,22 @@ void wxScrollHelper::AdjustScrollbars() { if (m_xScrollingEnabled) m_targetWindow->ScrollWindow( m_xScrollPixelsPerLine * (oldXScroll - m_xScrollPosition), 0, - GetRect() ); + GetScrollRect() ); else - m_targetWindow->Refresh(TRUE, GetRect()); + m_targetWindow->Refresh(TRUE, GetScrollRect()); } if (oldYScroll != m_yScrollPosition) { if (m_yScrollingEnabled) m_targetWindow->ScrollWindow( 0, m_yScrollPixelsPerLine * (oldYScroll-m_yScrollPosition), - GetRect() ); + GetScrollRect() ); else - m_targetWindow->Refresh(TRUE, GetRect()); + m_targetWindow->Refresh(TRUE, GetScrollRect()); } #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately(); + m_targetWindow->Update(); #endif } @@ -824,7 +833,7 @@ void wxScrollHelper::Scroll( int x_pos, int y_pos ) ((y_pos == -1) || (y_pos == m_yScrollPosition))) return; #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately(); + m_targetWindow->Update(); #endif int w, h; @@ -848,7 +857,7 @@ void wxScrollHelper::Scroll( int x_pos, int y_pos ) if (old_x != m_xScrollPosition) { m_win->SetScrollPos( wxHORIZONTAL, m_xScrollPosition ); m_targetWindow->ScrollWindow( (old_x-m_xScrollPosition)*m_xScrollPixelsPerLine, 0, - GetRect() ); + GetScrollRect() ); } } if ((y_pos != -1) && (m_yScrollPixelsPerLine)) @@ -869,12 +878,12 @@ void wxScrollHelper::Scroll( int x_pos, int y_pos ) if (old_y != m_yScrollPosition) { m_win->SetScrollPos( wxVERTICAL, m_yScrollPosition ); m_targetWindow->ScrollWindow( 0, (old_y-m_yScrollPosition)*m_yScrollPixelsPerLine, - GetRect() ); + GetScrollRect() ); } } #ifdef __WXMAC__ - m_targetWindow->MacUpdateImmediately(); + m_targetWindow->Update(); #endif }