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
This commit is contained in:
Vadim Zeitlin 2014-10-24 21:54:44 +00:00
parent 011a1356a8
commit 30c93fd705

View File

@ -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();