calling SelectObject itself if a valid bitmap is passed.
- Reverted wxBuffered[Paint]DC to pre 2.7.1 state, added
wxAutoBufferedPaintDC and wxAutoBufferedPaintDCFactory.
+- Renamed wxProgressDialog::UpdatePulse() to just Pulse()
Unix Ports:
/* Switches the dialog to use a gauge in indeterminate mode and calls
wxGauge::Pulse() to show to the user a bit of progress */
- virtual bool UpdatePulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
+ virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
// Must provide overload to avoid hiding it (and warnings about it)
virtual void Update() { wxDialog::Update(); }
// updates the label message
void UpdateMessage(const wxString &newmsg);
+ // common part of Update() and Pulse(), returns true if not cancelled
+ bool DoAfterUpdate(bool *skip);
+
// shortcuts for enabling buttons
void EnableClose();
void EnableSkip(bool enable=true);
// wxPD_AUTO_HIDE | -- try this as well
wxPD_ELAPSED_TIME |
wxPD_ESTIMATED_TIME |
- wxPD_REMAINING_TIME |
- wxPD_SMOOTH);
+ wxPD_REMAINING_TIME
+ //wxPD_SMOOTH - makes indeterminate mode bar on WinXP very small
+ );
bool cont = true;
bool skip = false;
wxString msg;
+ // test both behaviours of wxProgressDialog:
+ // determinate mode for first 33% and last 33% of the time
+ // indeterminate mode from 33% to 66% of the progress
+ const int firstpart = max /3,
+ secondpart = 2 * max /3;
+ bool determinate = i < firstpart || i > secondpart;
+ bool indeterminate = !determinate;
+
if ( i == max )
{
msg = _T("That's all, folks!");
}
- else if ( i > max / 2 )
+ else if ( indeterminate )
+ {
+ msg = _T("Now test indeterminate mode");
+ }
+ else if ( i > secondpart )
{
- msg = _T("Only a half left (very long message)!");
+ msg = _T("Back to determinate mode");
}
+ if (determinate)
+ {
#if wxUSE_STOPWATCH && wxUSE_LONGLONG
if ( (i % (max/100)) == 0 ) // // only 100 updates, this makes it much faster
{
#else
cont = dialog.Update(i, msg, &skip);
#endif
+ }
+ else
+ {
+#if wxUSE_STOPWATCH && wxUSE_LONGLONG
+ if ( (i % (max/100)) == 0 ) // // only 100 updates, this makes it much faster
+ {
+ cont = dialog.Pulse(msg, &skip);
+ }
+#else
+ cont = dialog.Pulse(msg, &skip);
+#endif
+ }
if ( !cont )
{
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
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") );
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();
+
+ Update();
- if ( (m_skip) && (skip != NULL) && (*skip == false) )
+ if ( m_skip && skip && !*skip )
{
*skip = true;
m_skip = false;