best size handling fix

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28022 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2004-06-25 11:33:39 +00:00
parent 2d1760d30f
commit 6d325d81bc

View File

@@ -96,7 +96,20 @@ wxSize wxButton::DoGetBestSize() const
charspace = 8 ;
}
Rect bestsize = { 0 , 0 , 0 , 0 } ;
short baselineoffset ;
::GetBestControlRect( *m_peer , &bestsize , &baselineoffset ) ;
int wBtn = 0 ;
if ( EmptyRect( &bestsize ) )
{
int wBtn = m_label.Length() * charspace + 12 ;
}
else
{
sz.x = bestsize.right - bestsize.left ;
sz.y = bestsize.bottom - bestsize.top ;
}
if (wBtn > sz.x || ( GetWindowStyle() & wxBU_EXACTFIT) )
sz.x = wBtn;