Factor out wxGenericProgressDialog::EnsureActiveEventLoopExists()
Make this function reusable in order to allow it to be called from the native MSW wxProgressDialog implementation in the upcoming commit.
This commit is contained in:
@@ -105,6 +105,9 @@ protected:
|
|||||||
// Converts seconds to HH:mm:ss format.
|
// Converts seconds to HH:mm:ss format.
|
||||||
static wxString GetFormattedTime(unsigned long timeInSec);
|
static wxString GetFormattedTime(unsigned long timeInSec);
|
||||||
|
|
||||||
|
// Create a new event loop if there is no currently running one.
|
||||||
|
void EnsureActiveEventLoopExists();
|
||||||
|
|
||||||
// callback for optional abort button
|
// callback for optional abort button
|
||||||
void OnCancel(wxCommandEvent&);
|
void OnCancel(wxCommandEvent&);
|
||||||
|
|
||||||
|
@@ -160,11 +160,7 @@ bool wxGenericProgressDialog::Create( const wxString& title,
|
|||||||
// even if this means we have to start it ourselves (this happens most
|
// even if this means we have to start it ourselves (this happens most
|
||||||
// commonly during the program initialization, e.g. for the progress
|
// commonly during the program initialization, e.g. for the progress
|
||||||
// dialogs shown from overridden wxApp::OnInit()).
|
// dialogs shown from overridden wxApp::OnInit()).
|
||||||
if ( !wxEventLoopBase::GetActive() )
|
EnsureActiveEventLoopExists();
|
||||||
{
|
|
||||||
m_tempEventLoop = new wxEventLoop;
|
|
||||||
wxEventLoop::SetActive(m_tempEventLoop);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||||
// we have to remove the "Close" button from the title bar then as it is
|
// we have to remove the "Close" button from the title bar then as it is
|
||||||
@@ -363,6 +359,15 @@ wxString wxGenericProgressDialog::GetFormattedTime(unsigned long timeInSec)
|
|||||||
return timeAsHMS;
|
return timeAsHMS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxGenericProgressDialog::EnsureActiveEventLoopExists()
|
||||||
|
{
|
||||||
|
if ( !wxEventLoopBase::GetActive() )
|
||||||
|
{
|
||||||
|
m_tempEventLoop = new wxEventLoop;
|
||||||
|
wxEventLoop::SetActive(m_tempEventLoop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxStaticText *
|
wxStaticText *
|
||||||
wxGenericProgressDialog::CreateLabel(const wxString& text, wxSizer *sizer)
|
wxGenericProgressDialog::CreateLabel(const wxString& text, wxSizer *sizer)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user