From 17c48da8ee3d9e1873b335cbd8a456cbed252161 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 3 May 2004 12:42:46 +0000 Subject: [PATCH] set min size to initial size when it is explicitly given git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/wincmn.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/common/wincmn.cpp b/src/common/wincmn.cpp index 09cc4d70af..beeea89932 100644 --- a/src/common/wincmn.cpp +++ b/src/common/wincmn.cpp @@ -598,21 +598,27 @@ void wxWindowBase::SetBestSize(const wxSize& size) { // the size only needs to be changed if the current size is incomplete, // i.e. one of the components was specified as default -- so if both - // were given, simply don't do anything + // were given, simply don't do anything and in particular don't call + // potentially expensive DoGetBestSize() + wxSize sizeBest; if ( size.x == -1 || size.y == -1 ) { - wxSize sizeBest = DoGetBestSize(); + sizeBest = DoGetBestSize(); if ( size.x != -1 ) sizeBest.x = size.x; if ( size.y != -1 ) sizeBest.y = size.y; SetSize(sizeBest); - - // don't shrink the control below its best size - m_minWidth = sizeBest.x; - m_minHeight = sizeBest.y; } + else // have explicit size + { + sizeBest = size; + } + + // don't shrink the control below its best size + m_minWidth = sizeBest.x; + m_minHeight = sizeBest.y; } // by default the origin is not shifted -- 2.45.2