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:
parent
814a674531
commit
6818d0909e
@ -105,6 +105,9 @@ protected:
|
||||
// Converts seconds to HH:mm:ss format.
|
||||
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
|
||||
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
|
||||
// commonly during the program initialization, e.g. for the progress
|
||||
// dialogs shown from overridden wxApp::OnInit()).
|
||||
if ( !wxEventLoopBase::GetActive() )
|
||||
{
|
||||
m_tempEventLoop = new wxEventLoop;
|
||||
wxEventLoop::SetActive(m_tempEventLoop);
|
||||
}
|
||||
EnsureActiveEventLoopExists();
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
|
||||
// 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;
|
||||
}
|
||||
|
||||
void wxGenericProgressDialog::EnsureActiveEventLoopExists()
|
||||
{
|
||||
if ( !wxEventLoopBase::GetActive() )
|
||||
{
|
||||
m_tempEventLoop = new wxEventLoop;
|
||||
wxEventLoop::SetActive(m_tempEventLoop);
|
||||
}
|
||||
}
|
||||
|
||||
wxStaticText *
|
||||
wxGenericProgressDialog::CreateLabel(const wxString& text, wxSizer *sizer)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user