if we return GetSize() from DoGetBestSize(), remember it as min size as well to prevent out best size from changing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34331 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2005-05-25 12:40:53 +00:00
parent 034e367709
commit c0bb586f50

View File

@@ -674,13 +674,19 @@ wxSize wxWindowBase::DoGetBestSize() const
} }
else // ! has children else // ! has children
{ {
// For a generic window there is no natural best size - just use // for a generic window there is no natural best size so, if the
// either the minimum size if there is one, or the current size. // minimal size is not set, use the current size but take care to
// These are returned as-is, unadjusted by the client size difference. // remember it as minimal size for the next time because our best size
if ( GetMinSize().IsFullySpecified() ) // should be constant: otherwise we could get into a situation when the
return GetMinSize(); // window is initially at some size, then expanded to a larger size and
else // then, when the containing window is shrunk back (because our initial
return GetSize(); // best size had been used for computing the parent min size), we can't
// be shrunk back any more because our best size is now bigger
if ( !GetMinSize().IsFullySpecified() )
wxConstCast(this, wxWindowBase)->SetMinSize(GetSize());
// return as-is, unadjusted by the client size difference.
return GetMinSize();
} }
// Add any difference between size and client size // Add any difference between size and client size