///////////////////////////////////////////////////////////////////////////////
-// Name: progdlgg.h
+// Name: wx/generic/progdlgg.h
// Purpose: wxGenericProgressDialog class
// Author: Karsten Ballueder
// Modified by: Francesco Montorsi
class WXDLLIMPEXP_CORE wxGenericProgressDialog : public wxDialog
{
public:
+ wxGenericProgressDialog();
wxGenericProgressDialog(const wxString& title, const wxString& message,
int maximum = 100,
wxWindow *parent = NULL,
virtual ~wxGenericProgressDialog();
+ bool Create(const wxString& title,
+ const wxString& message,
+ int maximum = 100,
+ wxWindow *parent = NULL,
+ int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
+
virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);
virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
// This enum is an implementation detail and should not be used
// by user code.
- enum ProgressDialogState
+ enum State
{
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
+ Finished, // finished, waiting to be removed from screen
+ Dismissed // was closed by user after finishing
};
protected:
- // This ctor is used by the native MSW implementation only.
- wxGenericProgressDialog(wxWindow *parent, int maximum, int style);
-
- void Create(const wxString& title,
- const wxString& message,
- int maximum,
- wxWindow *parent,
- int style);
+ // Update just the m_maximum field, this is used by public SetRange() but,
+ // unlike it, doesn't update the controls state. This makes it useful for
+ // both this class and its derived classes that don't use m_gauge to
+ // display progress.
+ void SetMaximum(int maximum);
// Return the labels to use for showing the elapsed/estimated/remaining
// times respectively.
- static wxString GetElapsedLabel() { return _("Elapsed time:"); }
- static wxString GetEstimatedLabel() { return _("Estimated time:"); }
- static wxString GetRemainingLabel() { return _("Remaining time:"); }
+ static wxString GetElapsedLabel() { return wxGetTranslation("Elapsed time:"); }
+ static wxString GetEstimatedLabel() { return wxGetTranslation("Estimated time:"); }
+ static wxString GetRemainingLabel() { return wxGetTranslation("Remaining time:"); }
// Similar to wxWindow::HasFlag() but tests for a presence of a wxPD_XXX
// Return the progress dialog style. Prefer to use HasPDFlag() if possible.
int GetPDStyle() const { return m_pdStyle; }
-
+ void SetPDStyle(int pdStyle) { m_pdStyle = pdStyle; }
// Updates estimated times from a given progress bar value and stores the
// results in provided arguments.
// the dialog was shown
void ReenableOtherWindows();
+ // Set the top level parent we store from the parent window provided when
+ // creating the dialog.
+ void SetTopParent(wxWindow* parent);
+
// return the top level parent window of this dialog (may be NULL)
wxWindow *GetTopParent() const { return m_parentTop; }
// continue processing or not (return value for Update())
- ProgressDialogState m_state;
+ State m_state;
// the maximum value
int m_maximum;
static void SetTimeLabel(unsigned long val, wxStaticText *label);
// common part of all ctors
- void Init(wxWindow *parent, int maximum, int style);
+ 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