From 80cf014b438bf60a7b0b1a1231e119cec6ec4ae3 Mon Sep 17 00:00:00 2001 From: Ron Lee Date: Wed, 6 Nov 2002 14:21:51 +0000 Subject: [PATCH] Surely it was not intended for SetBestSize to ignore a fully specified size if passed one. In any case, this method seems removable to me, anyone care to confirm or deny that? git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/window.h | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/include/wx/window.h b/include/wx/window.h index 59a9769b1b..b65632afad 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -958,18 +958,21 @@ protected: // set the best size for the control if the default size was given: // replaces the fields of size == -1 with the best values for them and // calls SetSize() if needed + // + // This function is rather unfortunately named.. it's really just a + // smarter SetSize / convenience function for expanding wxDefaultSize. + // Note that it does not influence the value returned by GetBestSize + // at all. + // + // FIXME: Can't we just make this the behaviour of SetSize when + // wxSIZE_AUTO_* is in play and do away with this (undocumented) + // method altogether? + void SetBestSize(const wxSize& size) { - if ( size.x == -1 || size.y == -1 ) - { - wxSize sizeBest = DoGetBestSize(); - if ( size.x != -1 ) - sizeBest.x = size.x; - if ( size.y != -1 ) - sizeBest.y = size.y; + wxSize best( DoGetBestSize() ); - SetSize(sizeBest); - } + SetSize( wxMax( size.x, best.x ), wxMax( size.y, best.y ) ); } // more pure virtual functions