X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1d7de5ae0c53162b57ac20cfed04264f0f27b30..adb799d6ef8e1ba754ab08b26e64fa40219f95f8:/src/mac/carbon/stattext.cpp diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index c6a6dd4e1a..e2bd22ed23 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -66,7 +66,16 @@ wxSize wxStaticText::DoGetBestSize() const Point bounds ; SInt16 baseline ; wxMacCFStringHolder str(m_label , m_font.GetEncoding() ) ; - verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , m_font.MacGetThemeFontID() , kThemeStateActive , false , &bounds , &baseline ) ) ; + if ( m_font.MacGetThemeFontID() != kThemeCurrentPortFont ) + verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , m_font.MacGetThemeFontID() , kThemeStateActive , false , &bounds , &baseline ) ) ; + else + { + wxMacWindowStateSaver sv( this ) ; + ::TextFont( m_font.MacGetFontNum() ) ; + ::TextSize( (short)( m_font.MacGetFontSize()) ) ; + ::TextFace( m_font.MacGetFontStyle() ) ; + verify_noerr( GetThemeTextDimensions( (m_label.Length() > 0 ? ((CFStringRef) str ) : CFSTR(" ") ) , kThemeCurrentPortFont , kThemeStateActive , false , &bounds , &baseline ) ) ; + } if ( m_label.Length() == 0 ) bounds.h = 0 ; return wxSize(bounds.h, bounds.v); @@ -83,7 +92,10 @@ void wxStaticText::SetLabel(const wxString& st ) &ref ); if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { SetSize( GetBestSize() ) ; + SetSizeHints(GetSize()); + } Update() ; } @@ -95,7 +107,10 @@ bool wxStaticText::SetFont(const wxFont& font) if ( ret ) { if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { SetSize( GetBestSize() ); + SetSizeHints(GetSize()); + } } return ret;