X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/427ff66291af2d8dd34ff5ee68c81436997144a1..9556c0f1b3dec367bf2bdc3eef7b1d54668adcf7:/src/mac/carbon/stattext.cpp diff --git a/src/mac/carbon/stattext.cpp b/src/mac/carbon/stattext.cpp index b2a7d103da..1c0facdbf7 100644 --- a/src/mac/carbon/stattext.cpp +++ b/src/mac/carbon/stattext.cpp @@ -41,22 +41,17 @@ bool wxStaticText::Create(wxWindow *parent, wxWindowID id, long style, const wxString& name) { - SetName(name); - m_backgroundColour = parent->GetBackgroundColour() ; - m_foregroundColour = parent->GetForegroundColour() ; - - if ( id == -1 ) - m_windowId = (int)NewControlId(); - else - m_windowId = id; - - m_windowStyle = style; m_label = wxStripMenuCodes(label) ; - bool ret = wxControl::Create( parent, id, pos, size, style , wxDefaultValidator , name ); + if ( !wxControl::Create( parent, id, pos, size, style, + wxDefaultValidator , name ) ) + { + return false; + } + SetBestSize( size ) ; - return ret; + return true; } const wxString punct = wxT(" ,.-;:!?"); @@ -191,7 +186,7 @@ wxSize wxStaticText::DoGetBestSize() const wxString curLine; for ( const wxChar *pc = m_label; ; pc++ ) { - if ( *pc == wxT('\n') || *pc == wxT('\0') ) + if ( *pc == wxT('\n') || *pc == wxT('\r') || *pc == wxT('\0') ) { if ( !curLine ) { @@ -217,7 +212,7 @@ wxSize wxStaticText::DoGetBestSize() const heightTextTotal++; // FIXME: why is this necessary? } - if ( *pc == wxT('\n') ) { + if ( *pc == wxT('\n') || *pc == wxT('\r')) { curLine.Empty(); } else { @@ -238,8 +233,11 @@ void wxStaticText::SetLabel(const wxString& st ) SetTitle( st ) ; m_label = st ; if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { + // temporary fix until layout measurement and drawing are in synch again + Refresh() ; SetSize( GetBestSize() ) ; - + } Refresh() ; Update() ; } @@ -248,10 +246,17 @@ bool wxStaticText::SetFont(const wxFont& font) { bool ret = wxControl::SetFont(font); - // adjust the size of the window to fit to the label unless autoresizing is - // disabled - if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) - SetSize( GetBestSize() ); + if ( ret ) + { + // adjust the size of the window to fit to the label unless autoresizing is + // disabled + if ( !(GetWindowStyle() & wxST_NO_AUTORESIZE) ) + { + // temporary fix until layout measurement and drawing are in synch again + Refresh() ; + SetSize( GetBestSize() ); + } + } return ret; }