1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        wx/msw/progdlg.h
3 // Purpose:     wxProgressDialog
4 // Author:      Rickard Westerlund
5 // Created:     2010-07-22
6 // Copyright:   (c) 2010 wxWidgets team
7 // Licence:     wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9 
10 #ifndef _WX_PROGDLG_H_
11 #define _WX_PROGDLG_H_
12 
13 class wxProgressDialogTaskRunner;
14 class wxProgressDialogSharedData;
15 
16 class WXDLLIMPEXP_CORE wxProgressDialog : public wxGenericProgressDialog
17 {
18 public:
19     wxProgressDialog(const wxString& title, const wxString& message,
20                      int maximum = 100,
21                      wxWindow *parent = NULL,
22                      int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
23 
24     virtual ~wxProgressDialog();
25 
26     virtual bool Update(int value, const wxString& newmsg = wxEmptyString, bool *skip = NULL);
27     virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool *skip = NULL);
28 
29     void Resume();
30 
31     int GetValue() const;
32     wxString GetMessage() const;
33 
34     void SetRange(int maximum);
35 
36     // Return whether "Cancel" or "Skip" button was pressed, always return
37     // false if the corresponding button is not shown.
38     bool WasSkipped() const;
39     bool WasCancelled() const;
40 
41     virtual void SetTitle(const wxString& title);
42     virtual wxString GetTitle() const;
43 
44     virtual bool Show( bool show = true );
45 
46     // Must provide overload to avoid hiding it (and warnings about it)
Update()47     virtual void Update() { wxGenericProgressDialog::Update(); }
48 
49     virtual WXWidget GetHandle() const;
50 
51 private:
52     // Performs common routines to Update() and Pulse(). Requires the
53     // shared object to have been entered.
54     bool DoNativeBeforeUpdate(bool *skip);
55 
56     // Updates the various timing informations for both determinate
57     // and indeterminate modes. Requires the shared object to have
58     // been entered.
59     void UpdateExpandedInformation(int value);
60 
61     wxProgressDialogTaskRunner *m_taskDialogRunner;
62 
63     wxProgressDialogSharedData *m_sharedData;
64 
65     // Store the message and title we currently use to be able to return it
66     // from Get{Message,Title}()
67     wxString m_message,
68              m_title;
69 
70     wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxProgressDialog);
71 };
72 
73 #endif // _WX_PROGDLG_H_
74