Let wxWindow::Fit[Inside]() work even for windows without children.

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
This commit is contained in:
Vadim Zeitlin 2012-09-19 07:50:07 +00:00
parent 4801d9613f
commit 089ef0bef7

View 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.