]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed wxSizer::SetSizeHints() to allow setting smaller size than before (e.g. when...
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 14 Feb 2008 13:41:56 +0000 (13:41 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 14 Feb 2008 13:41:56 +0000 (13:41 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/sizer.cpp

index d08036227403b24501535f6fd77333a2d9ab841f..38753c75446a6aeb495e744df27277ac3ee51611 100644 (file)
@@ -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