]> git.saurik.com Git - wxWidgets.git/commitdiff
Let wxWindow::Fit[Inside]() work even for windows without children.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Sep 2012 07:50:07 +0000 (07:50 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 19 Sep 2012 07:50:07 +0000 (07:50 +0000)
The best [virtual] size of the window is usually determined by its children
but it's also possible to have a min size constraint set on the window sizer
so set the window to its best size in Fit() independently of whether it has
children or not.

Closes #14668.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/wincmn.cpp

index ae072ece15b39481f86ec380f301b90a21b41e51..13370f51c630f8e449b635438ae1240d04c2449a 100644 (file)
@@ -620,20 +620,13 @@ void wxWindowBase::DoCentre(int dir)
 // fits the window around the children
 void wxWindowBase::Fit()
 {
-    if ( !GetChildren().empty() )
-    {
-        SetSize(GetBestSize());
-    }
-    //else: do nothing if we have no children
+    SetSize(GetBestSize());
 }
 
 // fits virtual size (ie. scrolled area etc.) around children
 void wxWindowBase::FitInside()
 {
-    if ( GetChildren().GetCount() > 0 )
-    {
-        SetVirtualSize( GetBestVirtualSize() );
-    }
+    SetVirtualSize( GetBestVirtualSize() );
 }
 
 // On Mac, scrollbars are explicitly children.