X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32be10a45d1d19df9b0841183ac9502ba8c2cc32..0e17930f4329ffc03e2fa89abb7d78deb2d935b5:/src/common/wincmn.cpp diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 1ffda0d589..30dc010510 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -215,7 +215,6 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent, const wxPoint& WXUNUSED(pos), const wxSize& WXUNUSED(size), long style, - const wxValidator& wxVALIDATOR_PARAM(validator), const wxString& name) { // ids are limited to 16 bits under MSW so if you care about portability, @@ -243,6 +242,20 @@ bool wxWindowBase::CreateBase(wxWindowBase *parent, SetName(name); SetParent(parent); + return true; +} + +bool wxWindowBase::CreateBase(wxWindowBase *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) +{ + if ( !CreateBase(parent, id, pos, size, style, name) ) + return false; + #if wxUSE_VALIDATORS SetValidator(validator); #endif // wxUSE_VALIDATORS @@ -593,19 +606,14 @@ wxSize wxWindowBase::DoGetBestSize() const } else // ! has children { - // for a generic window there is no natural best size so, if the - // minimal size is not set, use the current size but take care to - // remember it as minimal size for the next time because our best size - // should be constant: otherwise we could get into a situation when the - // window is initially at some size, then expanded to a larger size and - // then, when the containing window is shrunk back (because our initial - // 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 wxSize size = GetMinSize(); if ( !size.IsFullySpecified() ) { - size.SetDefaults(GetSize()); - wxConstCast(this, wxWindowBase)->SetMinSize(size); + // if the window doesn't define its best size we assume that it can + // be arbitrarily small -- usually this is not the case, of course, + // but we have no way to know what the limit is, it should really + // override DoGetBestClientSize() itself to tell us + size.SetDefaults(wxSize(1, 1)); } // return as-is, unadjusted by the client size difference.