BEGIN_EVENT_TABLE(wxProgressDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxProgressDialog::OnCancel)
BEGIN_EVENT_TABLE(wxProgressDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxProgressDialog::OnCancel)
EVT_CLOSE(wxProgressDialog::OnClose)
END_EVENT_TABLE()
IMPLEMENT_CLASS(wxProgressDialog, wxDialog)
// ============================================================================
EVT_CLOSE(wxProgressDialog::OnClose)
END_EVENT_TABLE()
IMPLEMENT_CLASS(wxProgressDialog, wxDialog)
// ============================================================================
// ============================================================================
// ----------------------------------------------------------------------------
// ============================================================================
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
wxProgressDialog::wxProgressDialog(wxString const &title,
// ----------------------------------------------------------------------------
wxProgressDialog::wxProgressDialog(wxString const &title,
+#if defined(__WXMSW__) || defined(__WXPM__)
+ // we can't have values > 65,536 in the progress control under Windows, so
+ // scale everything down
+ m_factor = m_maximum / 65536 + 1;
+ m_maximum /= m_factor;
+#endif // __WXMSW__
+
long widthText;
dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
long widthText;
dc.GetTextExtent(message, &widthText, NULL, NULL, NULL, NULL);
// note that we can't use wxGA_SMOOTH because it happens to also mean
// wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra
// style argument to wxProgressDialog, perhaps.
// note that we can't use wxGA_SMOOTH because it happens to also mean
// wxDIALOG_MODAL and will cause the dialog to be modal. Have an extra
// style argument to wxProgressDialog, perhaps.
- m_gauge = new wxGauge(this, -1, maximum,
+ m_gauge = new wxGauge(this, -1, m_maximum,
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
#else // !MSW
c->centreX.SameAs(this, wxCentreX);
#endif // MSW/!MSW
c->bottom.SameAs(this, wxBottom, 2*LAYOUT_Y_MARGIN);
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
#else // !MSW
c->centreX.SameAs(this, wxCentreX);
#endif // MSW/!MSW
c->bottom.SameAs(this, wxBottom, 2*LAYOUT_Y_MARGIN);
// VZ: I like the labels be centered - if the others don't mind, you may
// remove "#ifdef __WXMSW__" and use it for all ports
// VZ: I like the labels be centered - if the others don't mind, you may
// remove "#ifdef __WXMSW__" and use it for all ports
c->left.SameAs(this, wxCentreX, LAYOUT_X_MARGIN);
#else // !MSW
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
c->left.SameAs(this, wxCentreX, LAYOUT_X_MARGIN);
#else // !MSW
c->right.SameAs(this, wxRight, 2*LAYOUT_X_MARGIN);
bool
wxProgressDialog::Update(int value, const wxString& newmsg)
{
wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
bool
wxProgressDialog::Update(int value, const wxString& newmsg)
{
wxASSERT_MSG( value == -1 || m_gauge, wxT("cannot update non existent dialog") );
- 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;
+ if ( !newmsg )
+ {
+ // also provide the finishing message if the application didn't
+ m_msg->SetLabel(_("Done."));
+ }
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// event handlers
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// destruction
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// destruction
// ----------------------------------------------------------------------------