- enum
- {
- Uncancelable = -1, // dialog can't be canceled
- Canceled, // can be cancelled and, in fact, was
- Continue, // can be cancelled but wasn't
- Finished // finished, waiting to be removed from screen
- } m_state;
+ State m_state;
+
+ // the maximum value
+ int m_maximum;
+
+#if defined(__WXMSW__ ) || defined(__WXPM__)
+ // the factor we use to always keep the value in 16 bit range as the native
+ // control only supports ranges from 0 to 65,535
+ size_t m_factor;
+#endif // __WXMSW__
+
+ // time when the dialog was created
+ unsigned long m_timeStart;
+ // time when the dialog was closed or cancelled
+ unsigned long m_timeStop;
+ // time between the moment the dialog was closed/cancelled and resume
+ unsigned long m_break;
+
+private:
+ // update the label to show the given time (in seconds)
+ static void SetTimeLabel(unsigned long val, wxStaticText *label);
+
+ // common part of all ctors
+ void Init();
+
+ // create the label with given text and another one to show the time nearby
+ // as the next windows in the sizer, returns the created control
+ wxStaticText *CreateLabel(const wxString& text, wxSizer *sizer);
+
+ // updates the label message
+ void UpdateMessage(const wxString &newmsg);
+
+ // common part of Update() and Pulse(), returns true if not cancelled
+ bool DoBeforeUpdate(bool *skip);
+
+ // common part of Update() and Pulse()
+ void DoAfterUpdate();
+
+ // shortcuts for enabling buttons
+ void EnableClose();
+ void EnableSkip(bool enable = true);
+ void EnableAbort(bool enable = true);
+ void DisableSkip() { EnableSkip(false); }
+ void DisableAbort() { EnableAbort(false); }
+
+ // the widget displaying current status (may be NULL)
+ wxGauge *m_gauge;
+ // the message displayed
+ wxStaticText *m_msg;
+ // displayed elapsed, estimated, remaining time
+ wxStaticText *m_elapsed,
+ *m_estimated,
+ *m_remaining;
+
+ // parent top level window (may be NULL)
+ wxWindow *m_parentTop;
+
+ // Progress dialog styles: this is not the same as m_windowStyle because
+ // wxPD_XXX constants clash with the existing TLW styles so to be sure we
+ // don't have any conflicts we just use a separate variable for storing
+ // them.
+ int m_pdStyle;