- if (m_width <= 0 || m_height <= 0)
- return;
-
- if ( !IsWindowHilited( (WindowRef) MacGetRootWindow() ) &&
- ( GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE )
- || GetBackgroundColour() == wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE) ) )
- {
- dc.SetTextForeground( wxColour( 0x80 , 0x80 , 0x80 ) ) ;
- }
- else
- {
- dc.SetTextForeground( GetForegroundColour() ) ;
- }
-
- wxString paragraph;
- int i = 0 ;
- wxString text = m_label;
- while (i < text.Length())
- {
- paragraph += text[i];
-
- if (text[i] == 13 || text[i] == 10)
- DrawParagraph(dc, paragraph);
-
- ++i;
- }
- if (paragraph.Length() > 0)
- DrawParagraph(dc, paragraph);
+ 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() );
+
+ if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont )
+ {
+ err = GetThemeTextDimensions(
+ (!m_label.empty() ? (CFStringRef)str : CFSTR(" ")),
+ m_font.MacGetThemeFontID(), kThemeStateActive, false, &bounds, &baseline );
+ verify_noerr( err );
+ }
+ else
+ {
+#if wxMAC_USE_CORE_GRAPHICS
+ wxClientDC dc(const_cast<wxStaticText*>(this));
+ wxCoord width, height ;
+ dc.GetTextExtent( m_label , &width, &height);
+ bounds.h = width;
+ bounds.v = height;
+#else
+ wxMacWindowStateSaver sv( this );
+ ::TextFont( m_font.MacGetFontNum() );
+ ::TextSize( (short)(m_font.MacGetFontSize()) );
+ ::TextFace( m_font.MacGetFontStyle() );
+
+ err = GetThemeTextDimensions(
+ (!m_label.empty() ? (CFStringRef)str : CFSTR(" ")),
+ kThemeCurrentPortFont, kThemeStateActive, false, &bounds, &baseline );
+ verify_noerr( err );
+#endif
+ }
+
+ if ( m_label.empty() )
+ bounds.h = 0;
+
+ bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize();
+ bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize();
+
+ return wxSize( bounds.h, bounds.v );