1 ////////////////////////////////////////////////////
3 // Purpose: wxProgressDialog class
4 // Author: Karsten Ballüder
8 // Copyright: (c) Karsten Ballüder
9 // Licence: wxWindows license
10 ////////////////////////////////////////////////////
12 #ifndef __PROGDLGH_G__
13 #define __PROGDLGH_G__
16 #pragma interface "progdlgg.h"
23 #include "wx/dialog.h"
25 class WXDLLEXPORT wxButton
;
26 class WXDLLEXPORT wxStaticText
;
28 /* Progress dialog which shows a moving progress bar.
29 Taken from the Mahogany project.*/
31 class WXDLLEXPORT wxProgressDialog
: public wxDialog
33 DECLARE_DYNAMIC_CLASS(wxProgressDialog
)
35 /* Creates and displays dialog, disables event handling for other
36 frames or parent frame to avoid recursion problems.
37 @param title title for window
38 @param message message to display in window
39 @param maximum value for status bar, if <= 0, no bar is shown
40 @param parent window or NULL
41 @param style is the bit mask of wxPD_XXX constants from wx/defs.h
43 wxProgressDialog(const wxString
&title
, wxString
const &message
,
45 wxWindow
*parent
= NULL
,
46 int style
= wxPD_APP_MODAL
| wxPD_AUTO_HIDE
);
48 Re-enables event handling for other windows.
52 /* Update the status bar to the new value.
53 @param value new value
54 @param newmsg if used, new message to display
55 @returns true if ABORT button has not been pressed
57 bool Update(int value
= -1, const wxString
& newmsg
= T(""));
59 /* Can be called to continue after the cancel button has been pressed, but
60 the program decided to continue the operation (e.g., user didn't
63 void Resume() { m_state
= Continue
; }
65 // implementation from now on
66 // callback for optional abort button
67 void OnCancel(wxCommandEvent
& event
);
68 // callback to disable "hard" window closing
69 void OnClose(wxCloseEvent
& event
);
72 // create the label with given text and another one to show the time nearby
73 // under the lastWindow and modify it to be the same as the control created
74 // (which is returned)
75 wxStaticText
*CreateLabel(const wxString
& text
, wxWindow
**lastWindow
);
78 class wxGauge
*m_gauge
;
79 // the message displayed
80 class wxStaticText
*m_msg
;
81 // disable all or parent window only
82 bool m_disableParentOnly
;
85 // displayed elapsed, estimated, remaining time
86 class wxStaticText
*m_elapsed
,
89 // time when the dialog was created
90 unsigned long m_timeStart
;
93 // continue processing or not (return value for Update())
96 Uncancelable
= -1, // dialog can't be canceled
97 Canceled
, // can be cancelled and, in fact, was
98 Continue
, // can be cancelled but wasn't
99 Finished
// finished, waiting to be removed from screen
101 // the abort button (or NULL if none)
102 wxButton
*m_btnAbort
;
106 DECLARE_EVENT_TABLE()