#include <wx/progdlg.h>
This class represents a dialog that shows a short message and a progress bar.
Optionally, it can display ABORT and SKIP buttons, and the elapsed, remaining and estimated time for the end of the progress.
Note that you must be aware that wxProgressDialog internally calls wxEventLoopBase::YieldFor with wxEVT_CATEGORY_UI
and wxEVT_CATEGORY_USER_INPUT
and this may cause unwanted re-entrancies or the out-of-order processing of pending events (to help preventing the last problem if you're using wxProgressDialog in a multi-threaded application you should be sure to use wxThreadEvent for your inter-threads communications).
This class supports the following styles:
wxGA_SMOOTH
style). Public Member Functions | |
wxProgressDialog (const wxString &title, const wxString &message, int maximum=100, wxWindow *parent=NULL, int style=wxPD_AUTO_HIDE|wxPD_APP_MODAL) | |
Constructor. | |
virtual | ~wxProgressDialog () |
Destructor. | |
int | GetValue () const |
Returns the last value passed to the Update() function or wxNOT_FOUND if the dialog has no progress bar. | |
int | GetRange () const |
Returns the maximum value of the progress meter, as passed to the constructor or wxNOT_FOUND if the dialog has no progress bar. | |
wxString | GetMessage () const |
Returns the last message passed to the Update() function; if you always passed wxEmptyString to Update() then the message set through the constructor is returned. | |
virtual bool | Pulse (const wxString &newmsg=wxEmptyString, bool *skip=NULL) |
Like Update() but makes the gauge control run in indeterminate mode. | |
void | Resume () |
Can be used to continue with the dialog, after the user had clicked the "Abort" button. | |
void | SetRange (int maximum) |
Changes the maximum value of the progress meter given in the constructor. | |
virtual bool | Update (int value, const wxString &newmsg=wxEmptyString, bool *skip=NULL) |
Updates the dialog, setting the progress bar to the new value and updating the message if new one is specified. |
wxProgressDialog::wxProgressDialog | ( | const wxString & | title, | |
const wxString & | message, | |||
int | maximum = 100 , |
|||
wxWindow * | parent = NULL , |
|||
int | style = wxPD_AUTO_HIDE|wxPD_APP_MODAL | |||
) |
Constructor.
Creates the dialog, displays it and disables user input for other windows, or, if wxPD_APP_MODAL
flag is not given, for its parent window only.
title | Dialog title to show in titlebar. | |
message | Message displayed above the progress bar. | |
maximum | Maximum value for the progress bar. In the generic implementation the progress bar is constructed only if this value is greater than zero. | |
parent | Parent window. | |
style | The dialog style. See wxProgressDialog. |
virtual wxProgressDialog::~wxProgressDialog | ( | ) | [virtual] |
Destructor.
Deletes the dialog and enables all top level windows.
wxString wxProgressDialog::GetMessage | ( | ) | const |
int wxProgressDialog::GetRange | ( | ) | const |
Returns the maximum value of the progress meter, as passed to the constructor or wxNOT_FOUND
if the dialog has no progress bar.
int wxProgressDialog::GetValue | ( | ) | const |
Returns the last value passed to the Update() function or wxNOT_FOUND
if the dialog has no progress bar.
virtual bool wxProgressDialog::Pulse | ( | const wxString & | newmsg = wxEmptyString , |
|
bool * | skip = NULL | |||
) | [virtual] |
Like Update() but makes the gauge control run in indeterminate mode.
In indeterminate mode the remaining and the estimated time labels (if present) are set to to "Unknown" or to newmsg (if it's non-empty). Each call to this function moves the progress bar a bit to indicate that some progress was done.
void wxProgressDialog::Resume | ( | ) |
Can be used to continue with the dialog, after the user had clicked the "Abort" button.
void wxProgressDialog::SetRange | ( | int | maximum | ) |
Changes the maximum value of the progress meter given in the constructor.
This function can only be called (with a positive value) if the value passed in the constructor was positive.
virtual bool wxProgressDialog::Update | ( | int | value, | |
const wxString & | newmsg = wxEmptyString , |
|||
bool * | skip = NULL | |||
) | [virtual] |
Updates the dialog, setting the progress bar to the new value and updating the message if new one is specified.
Returns true unless the "Cancel" button has been pressed.
If false is returned, the application can either immediately destroy the dialog or ask the user for the confirmation and if the abort is not confirmed the dialog may be resumed with Resume() function.
Notice that you may want to call Fit() to change the dialog size to conform to the length of the new message if desired. The dialog does not do this automatically.
value | The new value of the progress meter. It should be less than or equal to the maximum value given to the constructor. See wxPD_AUTO_HIDE style for more info about the behaviour of wxProgressDialog when value is the maximum value given in the ctor. | |
newmsg | The new messages for the progress dialog text, if it is empty (which is the default) the message is not changed. | |
skip | If "Skip" button was pressed since last Update() call, this is set to true. |
![]() |
[ top ] |