From 30c93fd705bf1229b1edef67eb619d2de4a4687f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 24 Oct 2014 21:54:44 +0000 Subject: [PATCH] Work around bad wxStaticText best size calculation under wxOSX. Expand wxStaticText controls in wxBusyInfo and centre them to avoid the problem with their contents being truncated when using markup under wxOSX. This should, of course, be fixed in wxStaticText itself, and when it is, this change should be reverted. But for now this at least allows wxBusyInfo to appear correctly under OS X. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@78065 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/busyinfo.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/generic/busyinfo.cpp b/src/generic/busyinfo.cpp index ec9798cd01..3b5252cd5e 100644 --- a/src/generic/busyinfo.cpp +++ b/src/generic/busyinfo.cpp @@ -48,21 +48,23 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) wxBoxSizer* const sizer = new wxBoxSizer(wxVERTICAL); - const wxSizerFlags sizerFlags = wxSizerFlags().DoubleBorder().Centre(); - if ( flags.m_icon.IsOk() ) { - sizer->Add(new wxStaticBitmap(panel, wxID_ANY, flags.m_icon), sizerFlags); + sizer->Add(new wxStaticBitmap(panel, wxID_ANY, flags.m_icon), + wxSizerFlags().DoubleBorder().Centre()); } wxControl* title; if ( !flags.m_title.empty() ) { - title = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString()); + title = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_CENTRE); title->SetFont(title->GetFont().Scaled(2)); title->SetLabelMarkup(flags.m_title); - sizer->Add(title, sizerFlags); + sizer->Add(title, wxSizerFlags().DoubleBorder().Expand()); } else { @@ -76,7 +78,10 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) #if wxUSE_MARKUP if ( !flags.m_text.empty() ) { - text = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString()); + text = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_CENTRE); text->SetLabelMarkup(flags.m_text); } else @@ -86,7 +91,7 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) text->SetLabelText(flags.m_label); } - sizer->Add(text, sizerFlags); + sizer->Add(text, wxSizerFlags().DoubleBorder().Centre()); sizer->AddStretchSpacer();