- wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
- wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
-
-
- if( m_gauge )
- m_gauge->SetValue(value + 1);
-
- if( !newmsg.IsEmpty() )
- m_msg->SetLabel(newmsg);
-
- if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
- {
- unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
- unsigned long estimated = elapsed * m_maximum / value;
- unsigned long remaining = estimated - elapsed;
-
- SetTimeLabel(elapsed, m_elapsed);
- SetTimeLabel(estimated, m_estimated);
- SetTimeLabel(remaining, m_remaining);
- }
-
- if ( (value == m_maximum ) && !m_AutoHide )
- {
- if ( m_btnAbort )
- {
- // tell the user what he should do...
- m_btnAbort->SetLabel(_("Close"));
- }
-
- if ( !newmsg )
- {
- // also provide the finishing message if the application didn't
- m_msg->SetLabel(_("Done."));
- }
-
- // so that we return TRUE below and that out [Cancel] handler knew what
- // to do
- m_state = Finished;
-
- wxYield();
-
- (void)ShowModal();
- }
- else
- {
- // update the display
- wxYield();
- }
- #ifdef __WXMAC__
- MacUpdateImmediately() ;
- #endif
-
- return m_state != Canceled;
+ wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
+ wxASSERT_MSG( value <= m_maximum, wxT("invalid progress value") );
+
+ if ( m_gauge )
+ m_gauge->SetValue(value + 1);
+
+ if ( !newmsg.IsEmpty() )
+ {
+#ifdef __WXMSW__
+ // this seems to be necessary or garbage is left when the new label is
+ // longer than the old one
+ m_msg->SetLabel(wxEmptyString);
+#endif // MSW
+
+ m_msg->SetLabel(newmsg);
+
+ wxYield();
+ }
+
+ if ( (m_elapsed || m_remaining || m_estimated) && (value != 0) )
+ {
+ unsigned long elapsed = wxGetCurrentTime() - m_timeStart;
+ unsigned long estimated = elapsed * m_maximum / value;
+ unsigned long remaining = estimated - elapsed;
+
+ SetTimeLabel(elapsed, m_elapsed);
+ SetTimeLabel(estimated, m_estimated);
+ SetTimeLabel(remaining, m_remaining);
+ }
+
+ if ( (value == m_maximum ) && !(GetWindowStyle() & wxPD_AUTO_HIDE) )
+ {
+ if ( m_btnAbort )
+ {
+ // tell the user what he should do...
+ m_btnAbort->SetLabel(_("Close"));
+ }
+#ifdef __WXMSW__
+ else // enable the close button to give the user a way to close the dlg
+ {
+ EnableCloseButton(TRUE);
+ }
+#endif // __WXMSW__
+
+ if ( !newmsg )
+ {
+ // also provide the finishing message if the application didn't
+ m_msg->SetLabel(_("Done."));
+ }
+
+ // so that we return TRUE below and that out [Cancel] handler knew what
+ // to do
+ m_state = Finished;
+
+ wxYield();
+
+ (void)ShowModal();
+ }
+ else
+ {
+ // update the display
+ wxYield();
+ }
+
+#ifdef __WXMAC__
+ MacUpdateImmediately();
+#endif
+
+ return m_state != Canceled;