X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b45ed7a273799b1b360482496a706a211eca6435..27005f3a3f26b3b7d413863c4e73c7c30ff6fcc1:/src/mac/stattext.cpp diff --git a/src/mac/stattext.cpp b/src/mac/stattext.cpp index 2d81d33b16..1c0facdbf7 100644 --- a/src/mac/stattext.cpp +++ b/src/mac/stattext.cpp @@ -186,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 ) { @@ -212,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 { @@ -233,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() ; } @@ -243,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; }