diff --git a/docs/changes.txt b/docs/changes.txt index 57a467c1d5..cee2f56d59 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -177,6 +177,7 @@ All: - fixed wxLANGUAGE_CHINESE_TAIWAN to use zh_TW catalogs - added missing wx/quantize.h to install +- improved wxScrolledWindow/sizer interaction Unix (GUI): @@ -197,7 +198,7 @@ wxGTK: wxMSW: -- no longer take ampersand into account in wxStaticText::GetBestSize. +- no longer take ampersand into account in wxStaticText::GetBestSize 2.4.0 ----- diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 1fc2138406..f2c89b1220 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -622,10 +622,8 @@ wxSize wxWindowBase::DoGetVirtualSize() const { wxSize s( GetClientSize() ); - if( m_virtualSize.GetWidth() != -1 ) - s.SetWidth( m_virtualSize.GetWidth() ); - if( m_virtualSize.GetHeight() != -1 ) - s.SetHeight( m_virtualSize.GetHeight() ); + return wxSize( wxMax( m_virtualSize.GetWidth(), s.GetWidth() ), + wxMax( m_virtualSize.GetHeight(), s.GetHeight() ) ); return s; } diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index d1863b286a..f9965cfe15 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -344,19 +344,15 @@ void wxScrollHelper::SetScrollbars(int pixelsPerUnitX, // here not just the size. It makes SetScrollbars 'sticky' // emulating the old non-autoscroll behaviour. + int w = noUnitsX * pixelsPerUnitX; + int h = noUnitsY * pixelsPerUnitY; + wxSize sz = m_targetWindow->GetClientSize(); -#if 1 - int x = wxMax(noUnitsX * pixelsPerUnitX, sz.x); - int y = wxMax(noUnitsY * pixelsPerUnitY, sz.y); -#else - int x = noUnitsX * pixelsPerUnitX; - int y = noUnitsY * pixelsPerUnitY; -#endif - 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 +883,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(); diff --git a/src/gtk/scrolwin.cpp b/src/gtk/scrolwin.cpp index aa8a2d6566..c884a12529 100644 --- a/src/gtk/scrolwin.cpp +++ b/src/gtk/scrolwin.cpp @@ -842,12 +842,19 @@ bool wxScrolledWindow::Layout() // Default OnSize resets scrollbars, if any void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) { - if( GetAutoLayout() ) + if( GetAutoLayout() || m_targetWindow->GetAutoLayout() ) { if( m_targetWindow != this ) m_targetWindow->FitInside(); FitInside(); + + // 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 { diff --git a/src/gtk1/scrolwin.cpp b/src/gtk1/scrolwin.cpp index aa8a2d6566..c884a12529 100644 --- a/src/gtk1/scrolwin.cpp +++ b/src/gtk1/scrolwin.cpp @@ -842,12 +842,19 @@ bool wxScrolledWindow::Layout() // Default OnSize resets scrollbars, if any void wxScrolledWindow::OnSize(wxSizeEvent& WXUNUSED(event)) { - if( GetAutoLayout() ) + if( GetAutoLayout() || m_targetWindow->GetAutoLayout() ) { if( m_targetWindow != this ) m_targetWindow->FitInside(); FitInside(); + + // 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 {