diff --git a/include/wx/generic/busyinfo.h b/include/wx/generic/busyinfo.h index d910668c86..df1c764f51 100644 --- a/include/wx/generic/busyinfo.h +++ b/include/wx/generic/busyinfo.h @@ -17,6 +17,7 @@ class WXDLLIMPEXP_FWD_CORE wxFrame; class WXDLLIMPEXP_FWD_CORE wxWindow; +class WXDLLIMPEXP_FWD_CORE wxControl; //-------------------------------------------------------------------------------- // wxBusyInfo @@ -37,12 +38,16 @@ public: Init(wxBusyInfoFlags().Parent(parent).Label(message)); } + void UpdateText(const wxString& str); + void UpdateLabel(const wxString& str); + virtual ~wxBusyInfo(); private: void Init(const wxBusyInfoFlags& flags); wxFrame *m_InfoFrame; + wxControl *m_text; wxDECLARE_NO_COPY_CLASS(wxBusyInfo); }; diff --git a/interface/wx/busyinfo.h b/interface/wx/busyinfo.h index f0ecefe509..5334bb0f6a 100644 --- a/interface/wx/busyinfo.h +++ b/interface/wx/busyinfo.h @@ -111,6 +111,23 @@ public: */ wxBusyInfo(const wxString& msg, wxWindow* parent = NULL); + /** + Update the information text. + + The @a text string may contain markup as described in + wxControl::SetLabelMarkup(). + + @since 3.1.3 + */ + void UpdateText(const wxString& str); + + /** + Same as UpdateText() but doesn't interpret the string as containing markup. + + @since 3.1.3 + */ + void UpdateLabel(const wxString& str); + /** Hides and closes the window containing the information text. */ diff --git a/src/generic/busyinfo.cpp b/src/generic/busyinfo.cpp index 458b21cc5d..ad979a1158 100644 --- a/src/generic/busyinfo.cpp +++ b/src/generic/busyinfo.cpp @@ -79,24 +79,21 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) // Vertically center the text in the window. sizer->AddStretchSpacer(); - wxControl* text; #if wxUSE_MARKUP + m_text = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), + wxDefaultPosition, + wxDefaultSize, + wxALIGN_CENTRE); if ( !flags.m_text.empty() ) - { - text = new wxStaticTextWithMarkupSupport(panel, wxID_ANY, wxString(), - wxDefaultPosition, - wxDefaultSize, - wxALIGN_CENTRE); - text->SetLabelMarkup(flags.m_text); - } + m_text->SetLabelMarkup(flags.m_text); else + m_text->SetLabelText(flags.m_label); +#else + m_text = new wxStaticText(panel, wxID_ANY, wxString()); + m_text->SetLabelText(flags.m_label); #endif // wxUSE_MARKUP - { - text = new wxStaticText(panel, wxID_ANY, wxString()); - text->SetLabelText(flags.m_label); - } - sizer->Add(text, wxSizerFlags().DoubleBorder().Centre()); + sizer->Add(m_text, wxSizerFlags().DoubleBorder().Centre()); sizer->AddStretchSpacer(); @@ -106,7 +103,7 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) { if ( title ) title->SetForegroundColour(flags.m_foreground); - text->SetForegroundColour(flags.m_foreground); + m_text->SetForegroundColour(flags.m_foreground); } if ( flags.m_background.IsOk() ) @@ -131,6 +128,16 @@ void wxBusyInfo::Init(const wxBusyInfoFlags& flags) m_InfoFrame->Update(); } +void wxBusyInfo::UpdateText(const wxString& str) +{ + m_text->SetLabelMarkup(str); +} + +void wxBusyInfo::UpdateLabel(const wxString& str) +{ + m_text->SetLabelText(str); +} + wxBusyInfo::~wxBusyInfo() { m_InfoFrame->Show(false);