X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/21fd55291b631eae9ccfd78866616aca6e573ebe..f2641bc2bffc818b44979292a238144bea620cda:/src/mac/carbon/stattext.cpp diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index f4757d19d7..16e9aca2fb 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -51,7 +51,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ; m_peer = new wxMacControl() ; verify_noerr(CreateStaticTextControl(MAC_WXHWND(parent->MacGetTopLevelWindowRef()),&bounds, str , - NULL , *m_peer ) ) ; + NULL , m_peer->GetControlRefAddr() ) ) ; MacPostControlCreate(pos,size) ; @@ -61,8 +61,7 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, wxSize wxStaticText::DoGetBestSize() const { ControlFontStyleRec controlFont ; - Size outSize ; - verify_noerr( GetControlData( *m_peer , kControlEntireControl , kControlFontStyleTag , sizeof(controlFont) , &controlFont , &outSize ) ) ; + verify_noerr( m_peer->GetData(kControlEntireControl , kControlFontStyleTag , &controlFont ) ) ; Point bounds ; SInt16 baseline ; @@ -79,6 +78,9 @@ wxSize wxStaticText::DoGetBestSize() const } if ( m_label.Length() == 0 ) bounds.h = 0 ; + + bounds.h += MacGetLeftBorderSize() + MacGetRightBorderSize() ; + bounds.v += MacGetTopBorderSize() + MacGetBottomBorderSize() ; return wxSize(bounds.h, bounds.v); } @@ -89,15 +91,14 @@ void wxStaticText::SetLabel(const wxString& st ) wxMacCFStringHolder str(m_label,m_font.GetEncoding() ) ; CFStringRef ref = str ; - SetControlData( *m_peer, kControlEntireControl , kControlStaticTextCFStringTag, sizeof( CFStringRef ), - &ref ); + verify_noerr( m_peer->SetData(kControlEntireControl , kControlStaticTextCFStringTag, ref ) ) ; if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) { + InvalidateBestSize(); SetSize( GetBestSize() ) ; - SetSizeHints(GetSize()); } - + Refresh() ; Update() ; } @@ -108,10 +109,10 @@ bool wxStaticText::SetFont(const wxFont& font) if ( ret ) { if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - { - SetSize( GetBestSize() ); - SetSizeHints(GetSize()); - } + { + InvalidateBestSize(); + SetSize( GetBestSize() ); + } } return ret;