From: Václav Slavík Date: Thu, 14 Feb 2008 13:41:56 +0000 (+0000) Subject: fixed wxSizer::SetSizeHints() to allow setting smaller size than before (e.g. when... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/428c07c0f8ea28bbda605c368040713db7a7e460 fixed wxSizer::SetSizeHints() to allow setting smaller size than before (e.g. when wxCollapsiblePane collapses) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index d080362274..38753c7544 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -921,12 +921,16 @@ void wxSizer::SetSizeHints( wxWindow *window ) // Preserve the window's max size hints, but set the // lower bound according to the sizer calculations. - wxSize size = Fit( window ); + // This is equivalent to calling Fit(), except that we need to set + // the size hints _in between_ the two steps performed by Fit + // (1. ComputeFittingClientSize, 2. SetClientSize). That's because + // otherwise SetClientSize() could have no effect if there already are + // size hints in effect that forbid requested client size. - window->SetSizeHints( size.x, - size.y, - window->GetMaxWidth(), - window->GetMaxHeight() ); + const wxSize clientSize = ComputeFittingClientSize(window); + + window->SetMinClientSize(clientSize); + window->SetClientSize(clientSize); } #if WXWIN_COMPATIBILITY_2_8