]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/progdlg.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxProgressDialog
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
8 #define wxPD_CAN_ABORT 0x0001
9 #define wxPD_APP_MODAL 0x0002
10 #define wxPD_AUTO_HIDE 0x0004
11 #define wxPD_ELAPSED_TIME 0x0008
12 #define wxPD_ESTIMATED_TIME 0x0010
13 #define wxPD_SMOOTH 0x0020
14 #define wxPD_REMAINING_TIME 0x0040
15 #define wxPD_CAN_SKIP 0x0080
18 @class wxGenericProgressDialog
20 This class represents a dialog that shows a short message and a
21 progress bar. Optionally, it can display ABORT and SKIP buttons, and
22 the elapsed, remaining and estimated time for the end of the progress.
24 This class provides a generic implementation of the progress dialog. If
25 the platform has a native progress dialog available then it will be
26 accessible using the @a wxProgressDialog class, otherwise it will
27 essentially be the same as this class.
29 Note that you must be aware that wxProgressDialog internally calls
30 wxEventLoopBase::YieldFor with @c wxEVT_CATEGORY_UI and @c wxEVT_CATEGORY_USER_INPUT
31 and this may cause unwanted re-entrancies or the out-of-order processing
32 of pending events (to help preventing the last problem if you're using
33 wxProgressDialog in a multi-threaded application you should be sure to use
34 wxThreadEvent for your inter-threads communications).
37 @style{wxPD_APP_MODAL}
38 Make the progress dialog modal. If this flag is not given, it is
39 only "locally" modal - that is the input to the parent window is
40 disabled, but not to the other ones.
41 @style{wxPD_AUTO_HIDE}
42 Causes the progress dialog to disappear from screen as soon as the
43 maximum value of the progress meter has been reached.
44 If this style is not present, the dialog will become a modal dialog
45 (see wxDialog::ShowModal) once the maximum value has been reached
46 and wait for the user to dismiss it.
48 Causes smooth progress of the gauge control (uses a wxGauge with the
49 @c wxGA_SMOOTH style).
50 @style{wxPD_CAN_ABORT}
51 This flag tells the dialog that it should have a "Cancel" button
52 which the user may press. If this happens, the next call to
53 Update() will return @false.
55 This flag tells the dialog that it should have a "Skip" button
56 which the user may press. If this happens, the next call to
57 Update() will return @true in its skip parameter.
58 @style{wxPD_ELAPSED_TIME}
59 This flag tells the dialog that it should show elapsed time (since
61 @style{wxPD_ESTIMATED_TIME}
62 This flag tells the dialog that it should show estimated time.
63 @style{wxPD_REMAINING_TIME}
64 This flag tells the dialog that it should show remaining time.
70 class wxGenericProgressDialog
: public wxDialog
74 Constructor. Creates the dialog, displays it and disables user input
75 for other windows, or, if @c wxPD_APP_MODAL flag is not given, for its
79 Dialog title to show in titlebar.
81 Message displayed above the progress bar.
83 Maximum value for the progress bar.
84 In the generic implementation the progress bar is constructed
85 only if this value is greater than zero.
89 The dialog style. See wxProgressDialog.
91 wxGenericProgressDialog(const wxString
& title
, const wxString
& message
,
93 wxWindow
* parent
= NULL
,
94 int style
= wxPD_AUTO_HIDE
| wxPD_APP_MODAL
);
97 Destructor. Deletes the dialog and enables all top level windows.
99 virtual ~wxGenericProgressDialog();
102 Returns the last value passed to the Update() function or
103 @c wxNOT_FOUND if the dialog has no progress bar.
107 int GetValue() const;
110 Returns the maximum value of the progress meter, as passed to
111 the constructor or @c wxNOT_FOUND if the dialog has no progress bar.
115 int GetRange() const;
118 Returns the last message passed to the Update() function;
119 if you always passed wxEmptyString to Update() then the message
120 set through the constructor is returned.
124 wxString
GetMessage() const;
127 Like Update() but makes the gauge control run in indeterminate mode.
129 In indeterminate mode the remaining and the estimated time labels (if
130 present) are set to "Unknown" or to @a newmsg (if it's non-empty).
131 Each call to this function moves the progress bar a bit to indicate
132 that some progress was done.
134 @see wxGauge::Pulse(), Update()
136 virtual bool Pulse(const wxString
& newmsg
= wxEmptyString
, bool* skip
= NULL
);
139 Can be used to continue with the dialog, after the user had clicked the "Abort" button.
144 Changes the maximum value of the progress meter given in the constructor.
145 This function can only be called (with a positive value) if the value passed
146 in the constructor was positive.
150 void SetRange(int maximum
);
154 Returns true if the "Cancel" button was pressed.
156 Normally a Cancel button press is indicated by Update() returning
157 @false but sometimes it may be more convenient to check if the dialog
158 was cancelled from elsewhere in the code and this function allows to
161 It always returns @false if the Cancel button is not shown at all.
165 bool WasCancelled() const;
168 Returns true if the "Skip" button was pressed.
170 This is similar to WasCancelled() but returns @true if the "Skip"
171 button was pressed, not the "Cancel" one.
175 bool WasSkipped() const;
179 Updates the dialog, setting the progress bar to the new value and
180 updating the message if new one is specified.
182 Returns @true unless the "Cancel" button has been pressed.
184 If @false is returned, the application can either immediately destroy the
185 dialog or ask the user for the confirmation and if the abort is not confirmed
186 the dialog may be resumed with Resume() function.
188 If @a value is the maximum value for the dialog, the behaviour of the
189 function depends on whether @c wxPD_AUTO_HIDE was used when the dialog
190 was created. If it was, the dialog is hidden and the function returns
191 immediately. If it was not, the dialog becomes a modal dialog and waits
192 for the user to dismiss it, meaning that this function does not return
195 Notice that you may want to call Fit() to change the dialog size to
196 conform to the length of the new message if desired. The dialog does
197 not do this automatically.
200 The new value of the progress meter. It should be less than or equal to
201 the maximum value given to the constructor.
203 The new messages for the progress dialog text, if it is
204 empty (which is the default) the message is not changed.
206 If "Skip" button was pressed since last Update() call,
207 this is set to @true.
209 virtual bool Update(int value
, const wxString
& newmsg
= wxEmptyString
,
217 @class wxProgressDialog
219 If supported by the platform this class will provide the platform's native
220 progress dialog, else it will simply be the @a wxGenericProgressDialog.
222 class wxProgressDialog
: public wxGenericProgressDialog
225 wxProgressDialog( const wxString
& title
, const wxString
& message
,
227 wxWindow
*parent
= NULL
,
228 int style
= wxPD_APP_MODAL
| wxPD_AUTO_HIDE
);