]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: progdlg.h | |
e54c96f1 | 3 | // Purpose: interface of wxProgressDialog |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxProgressDialog | |
7c913512 | 11 | |
23324ae1 FM |
12 | This class represents a dialog that shows a short message and a |
13 | progress bar. Optionally, it can display ABORT and SKIP buttons, | |
14 | the elapsed, remaining and estimated time for the end of the progress. | |
7c913512 | 15 | |
23324ae1 | 16 | @beginStyleTable |
8c6791e4 | 17 | @style{wxPD_APP_MODAL} |
23324ae1 FM |
18 | Make the progress dialog modal. If this flag is not given, it is |
19 | only "locally" modal - that is the input to the parent window is | |
20 | disabled, but not to the other ones. | |
8c6791e4 | 21 | @style{wxPD_AUTO_HIDE} |
23324ae1 FM |
22 | Causes the progress dialog to disappear from screen as soon as the |
23 | maximum value of the progress meter has been reached. | |
8c6791e4 | 24 | @style{wxPD_SMOOTH} |
23324ae1 | 25 | Causes smooth progress of the gauge control. |
8c6791e4 | 26 | @style{wxPD_CAN_ABORT} |
23324ae1 FM |
27 | This flag tells the dialog that it should have a "Cancel" button |
28 | which the user may press. If this happens, the next call to | |
29 | Update() will return @false. | |
8c6791e4 | 30 | @style{wxPD_CAN_SKIP} |
23324ae1 FM |
31 | This flag tells the dialog that it should have a "Skip" button |
32 | which the user may press. If this happens, the next call to | |
33 | Update() will return @true in its skip parameter. | |
8c6791e4 | 34 | @style{wxPD_ELAPSED_TIME} |
23324ae1 FM |
35 | This flag tells the dialog that it should show elapsed time (since |
36 | creating the dialog). | |
8c6791e4 | 37 | @style{wxPD_ESTIMATED_TIME} |
23324ae1 | 38 | This flag tells the dialog that it should show estimated time. |
8c6791e4 | 39 | @style{wxPD_REMAINING_TIME} |
23324ae1 FM |
40 | This flag tells the dialog that it should show remaining time. |
41 | @endStyleTable | |
7c913512 | 42 | |
23324ae1 FM |
43 | @library{wxbase} |
44 | @category{cmndlg} | |
45 | */ | |
46 | class wxProgressDialog : public wxDialog | |
47 | { | |
48 | public: | |
49 | /** | |
50 | Constructor. Creates the dialog, displays it and disables user input | |
b1b95a65 FM |
51 | for other windows, or, if @c wxPD_APP_MODAL flag is not given, for its |
52 | parent window only. | |
3c4f71cc | 53 | |
7c913512 | 54 | @param title |
4cc4bfaf | 55 | Dialog title to show in titlebar. |
7c913512 | 56 | @param message |
4cc4bfaf | 57 | Message displayed above the progress bar. |
7c913512 | 58 | @param maximum |
4cc4bfaf | 59 | Maximum value for the progress bar. |
af237ae4 FM |
60 | In the generic implementation the progress bar is constructed |
61 | only if this value is greater than zero. | |
7c913512 | 62 | @param parent |
4cc4bfaf | 63 | Parent window. |
7c913512 | 64 | @param style |
4cc4bfaf | 65 | The dialog style. See wxProgressDialog. |
23324ae1 FM |
66 | */ |
67 | wxProgressDialog(const wxString& title, const wxString& message, | |
68 | int maximum = 100, | |
4cc4bfaf | 69 | wxWindow* parent = NULL, |
23324ae1 FM |
70 | int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL); |
71 | ||
72 | /** | |
73 | Destructor. Deletes the dialog and enables all top level windows. | |
74 | */ | |
adaaa686 | 75 | virtual ~wxProgressDialog(); |
23324ae1 | 76 | |
af237ae4 FM |
77 | /** |
78 | Returns the last value passed to the Update() function or | |
79 | @c wxNOT_FOUND if the dialog has no progress bar. | |
80 | ||
81 | @since 2.9.0 | |
82 | */ | |
83 | int GetValue() const; | |
84 | ||
85 | /** | |
86 | Returns the maximum value of the progress meter, as passed to | |
87 | the constructor or @c wxNOT_FOUND if the dialog has no progress bar. | |
88 | ||
89 | @since 2.9.0 | |
90 | */ | |
91 | int GetRange() const; | |
92 | ||
93 | /** | |
94 | Returns the last message passed to the Update() function; | |
95 | if you always passed wxEmptyString to Update() then the message | |
96 | set through the constructor is returned. | |
97 | ||
98 | @since 2.9.0 | |
99 | */ | |
100 | wxString GetMessage() const; | |
101 | ||
23324ae1 | 102 | /** |
b1b95a65 FM |
103 | Works like Update() but makes the gauge control run in indeterminate mode |
104 | (see wxGauge documentation); sets the remaining and the estimated time labels | |
105 | (if present) to "Unknown" or to @a newmsg (if it's non-empty); moves the progress | |
106 | bar a bit to indicate that some progress was done. | |
23324ae1 | 107 | */ |
43c48e1e | 108 | virtual bool Pulse(const wxString& newmsg = wxEmptyString, bool* skip = NULL); |
23324ae1 FM |
109 | |
110 | /** | |
b1b95a65 | 111 | Can be used to continue with the dialog, after the user had clicked the "Abort" button. |
23324ae1 FM |
112 | */ |
113 | void Resume(); | |
114 | ||
115 | /** | |
116 | Updates the dialog, setting the progress bar to the new value and, if | |
b1b95a65 | 117 | given changes the message above it. Returns @true unless the "Cancel" button |
23324ae1 | 118 | has been pressed. |
b1b95a65 | 119 | |
23324ae1 | 120 | If @false is returned, the application can either immediately destroy the |
b1b95a65 FM |
121 | dialog or ask the user for the confirmation and if the abort is not confirmed |
122 | the dialog may be resumed with Resume() function. | |
3c4f71cc | 123 | |
7c913512 | 124 | @param value |
b1b95a65 FM |
125 | The new value of the progress meter. It should be less than or equal to |
126 | the maximum value given to the constructor and the dialog is closed if | |
4cc4bfaf | 127 | it is equal to the maximum. |
7c913512 | 128 | @param newmsg |
4cc4bfaf FM |
129 | The new messages for the progress dialog text, if it is |
130 | empty (which is the default) the message is not changed. | |
7c913512 | 131 | @param skip |
b1b95a65 FM |
132 | If "Skip" button was pressed since last Update() call, |
133 | this is set to @true. | |
23324ae1 | 134 | */ |
11e3af6e | 135 | virtual bool Update(int value, const wxString& newmsg = wxEmptyString, |
4cc4bfaf | 136 | bool* skip = NULL); |
23324ae1 | 137 | }; |
e54c96f1 | 138 |