X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0e6c0513862fc9a33e5800526058193b7492d8b..01526d4f6cd7dd242e561aa24066f8ca0290a9ac:/src/mac/carbon/stattext.cpp?ds=sidebyside diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index f4757d19d7..f01e11f666 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -9,10 +9,12 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "stattext.h" #endif +#include "wx/wxprec.h" + #include "wx/app.h" #include "wx/stattext.h" #include "wx/notebook.h" @@ -51,7 +53,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 +63,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 +80,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 +93,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 +111,10 @@ bool wxStaticText::SetFont(const wxFont& font) if ( ret ) { if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - { - SetSize( GetBestSize() ); - SetSizeHints(GetSize()); - } + { + InvalidateBestSize(); + SetSize( GetBestSize() ); + } } return ret;