small refactoring to avoid code duplication; renamed wxProgressDialog::UpdatePulse() to just Pulse(); added test for it in the dialogs sample (part of the patch 1551409 which somehow wasn't applied before)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42253 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-10-22 21:08:11 +00:00
parent 2baa2b0eef
commit f4aa7ec32b
4 changed files with 48 additions and 20 deletions

View File

@@ -438,18 +438,9 @@ wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
Hide();
}
}
else
else // not at maximum yet
{
// we have to yield because not only we want to update the display but
// also to process the clicks on the cancel and skip buttons
wxYieldIfNeeded() ;
if ( (m_skip) && (skip != NULL) && (*skip == false) )
{
*skip = true;
m_skip = false;
EnableSkip();
}
return DoAfterUpdate(skip);
}
// update the display in case yielding above didn't do it
@@ -458,8 +449,7 @@ wxProgressDialog::Update(int value, const wxString& newmsg, bool *skip)
return m_state != Canceled;
}
bool
wxProgressDialog::UpdatePulse(const wxString& newmsg, bool *skip)
bool wxProgressDialog::Pulse(const wxString& newmsg, bool *skip)
{
wxASSERT_MSG( m_gauge, wxT("cannot update non existent dialog") );
@@ -477,11 +467,18 @@ wxProgressDialog::UpdatePulse(const wxString& newmsg, bool *skip)
SetTimeLabel((unsigned long)-1, m_remaining);
}
return DoAfterUpdate(skip);
}
bool wxProgressDialog::DoAfterUpdate(bool *skip)
{
// we have to yield because not only we want to update the display but
// also to process the clicks on the cancel and skip buttons
wxYieldIfNeeded() ;
wxYieldIfNeeded();
if ( (m_skip) && (skip != NULL) && (*skip == false) )
Update();
if ( m_skip && skip && !*skip )
{
*skip = true;
m_skip = false;