- int x = 0 ;
-
- int i = 0 ;
- long width, height ;
- bool linedrawn = true;
- while( paragraph.Length() > 0 )
- {
- dc.GetTextExtent( paragraph , &width , &height ) ;
-
- if ( width > m_width )
+ Rect bestsize = { 0 , 0 , 0 , 0 } ;
+ Point bounds;
+
+ // try the built-in best size if available
+ Boolean former = m_peer->GetData<Boolean>( kControlStaticTextIsMultilineTag);
+ m_peer->SetData( kControlStaticTextIsMultilineTag, (Boolean)0 );
+ m_peer->GetBestRect( &bestsize ) ;
+ m_peer->SetData( kControlStaticTextIsMultilineTag, former );
+ 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 );
+
+ SInt16 baseline;
+ wxMacCFStringHolder str( m_label, m_font.GetEncoding() );
+
+ if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )