X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d0604192a55216dd4d7494541ab32cfe4afd1ad0..fe802fc2edc8e3e78f812254582af0ee91da2ea0:/src/generic/scrlwing.cpp diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index efe09689d2..683fbdfe25 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -7,7 +7,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) wxWindows team -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -82,6 +82,8 @@ private: wxScrollHelper *m_scrollHelper; bool m_hasDrawnWindow; + + DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler) }; // ---------------------------------------------------------------------------- @@ -104,6 +106,8 @@ private: wxEventType m_eventType; int m_pos, m_orient; + + DECLARE_NO_COPY_CLASS(wxAutoScrollTimer) }; // ============================================================================ @@ -340,23 +344,18 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, m_xScrollPosition = xPos; m_yScrollPosition = yPos; - wxSize sz = m_targetWindow->GetSize(); - int x = noUnitsX * pixelsPerUnitX; - int y = noUnitsY * pixelsPerUnitY; - if (x == 0) - x = sz.x; - if (y == 0) - y = sz.y; - + int w = noUnitsX * pixelsPerUnitX; + int h = noUnitsY * pixelsPerUnitY; + // For better backward compatibility we set persisting limits // here not just the size. It makes SetScrollbars 'sticky' // emulating the old non-autoscroll behaviour. - m_targetWindow->SetVirtualSizeHints( x, y ); + m_targetWindow->SetVirtualSizeHints( w, h ); // The above should arguably be deprecated, this however we still need. - m_targetWindow->SetVirtualSize( x, y ); + m_targetWindow->SetVirtualSize( w, h ); if (do_refresh && !noRefresh) m_targetWindow->Refresh(TRUE, GetRect()); @@ -887,16 +886,19 @@ void wxScrollHelper::DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) co // Default OnSize resets scrollbars, if any void wxScrollHelper::HandleOnSize(wxSizeEvent& WXUNUSED(event)) { - if( m_win->GetAutoLayout() ) + if( m_win->GetAutoLayout() || m_targetWindow->GetAutoLayout() ) { if ( m_targetWindow != m_win ) m_targetWindow->FitInside(); m_win->FitInside(); -#if wxUSE_CONSTRAINTS - m_win->Layout(); -#endif + // FIXME: Something is really weird here... This should be + // called by FitInside above (and apparently is), yet the + // scrollsub sample will get the scrollbar wrong if resized + // quickly. This masks the bug, but is surely not the right + // answer at all. + AdjustScrollbars(); } else AdjustScrollbars(); @@ -952,7 +954,7 @@ void wxScrollHelper::HandleOnChar(wxKeyEvent& event) yScrollOld = m_yScrollPosition; int dsty; - switch ( event.KeyCode() ) + switch ( event.GetKeyCode() ) { case WXK_PAGEUP: case WXK_PRIOR: