From 428c07c0f8ea28bbda605c368040713db7a7e460 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Thu, 14 Feb 2008 13:41:56 +0000 Subject: [PATCH] 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 --- src/common/sizer.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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 -- 2.50.0