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:
@@ -620,20 +620,13 @@ void wxWindowBase::DoCentre(int dir)
|
|||||||
// fits the window around the children
|
// fits the window around the children
|
||||||
void wxWindowBase::Fit()
|
void wxWindowBase::Fit()
|
||||||
{
|
{
|
||||||
if ( !GetChildren().empty() )
|
SetSize(GetBestSize());
|
||||||
{
|
|
||||||
SetSize(GetBestSize());
|
|
||||||
}
|
|
||||||
//else: do nothing if we have no children
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fits virtual size (ie. scrolled area etc.) around children
|
// fits virtual size (ie. scrolled area etc.) around children
|
||||||
void wxWindowBase::FitInside()
|
void wxWindowBase::FitInside()
|
||||||
{
|
{
|
||||||
if ( GetChildren().GetCount() > 0 )
|
SetVirtualSize( GetBestVirtualSize() );
|
||||||
{
|
|
||||||
SetVirtualSize( GetBestVirtualSize() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// On Mac, scrollbars are explicitly children.
|
// On Mac, scrollbars are explicitly children.
|
||||||
|
Reference in New Issue
Block a user