best size fix for multi-line fields

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2006-12-20 08:45:48 +00:00
parent c0c677934f
commit 4d7e2cdad3

View File

@@ -73,12 +73,23 @@ bool wxStaticText::Create( wxWindow *parent,
}
wxSize wxStaticText::DoGetBestSize() const
{
Rect bestsize = { 0 , 0 , 0 , 0 } ;
Point bounds;
// try the built-in best size if available
m_peer->GetBestRect( &bestsize ) ;
if ( !EmptyRect( &bestsize ) )
{
bounds.h = bestsize.right - bestsize.left ;
bounds.v = bestsize.bottom - bestsize.top ;
}
else
{
ControlFontStyleRec controlFont;
OSStatus err = m_peer->GetData<ControlFontStyleRec>( kControlEntireControl, kControlFontStyleTag, &controlFont );
verify_noerr( err );
Point bounds;
SInt16 baseline;
wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
@@ -112,7 +123,7 @@ wxSize wxStaticText::DoGetBestSize() const
if ( m_label.empty() )
bounds.h = 0;
}
bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize();
bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize();