X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f8845289521c7f53e95b6dfd8275daab8b05639..01ffa8f7f7acaf3851a436cf3e6975c43c46648c:/src/mac/carbon/stattext.cpp diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index 024cc6eed7..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() ) ; } - + Refresh() ; Update() ; } @@ -108,10 +109,10 @@ bool wxStaticText::SetFont(const wxFont& font) if ( ret ) { if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - { - InvalidateBestSize(); - SetSize( GetBestSize() ); - } + { + InvalidateBestSize(); + SetSize( GetBestSize() ); + } } return ret;