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 wxGauge
;
27 class WXDLLEXPORT wxStaticText
;
29 /* Progress dialog which shows a moving progress bar.
30 Taken from the Mahogany project.*/
32 class WXDLLEXPORT wxProgressDialog
: public wxDialog
34 DECLARE_DYNAMIC_CLASS(wxProgressDialog
)
36 /* Creates and displays dialog, disables event handling for other
37 frames or parent frame to avoid recursion problems.
38 @param title title for window
39 @param message message to display in window
40 @param maximum value for status bar, if <= 0, no bar is shown
41 @param parent window or NULL
42 @param style is the bit mask of wxPD_XXX constants from wx/defs.h
44 wxProgressDialog(const wxString
&title
, wxString
const &message
,
46 wxWindow
*parent
= NULL
,
47 int style
= wxPD_APP_MODAL
| wxPD_AUTO_HIDE
);
49 Re-enables event handling for other windows.
53 /* Update the status bar to the new value.
54 @param value new value
55 @param newmsg if used, new message to display
56 @returns true if ABORT button has not been pressed
58 bool Update(int value
= -1, const wxString
& newmsg
= wxT(""));
60 /* Can be called to continue after the cancel button has been pressed, but
61 the program decided to continue the operation (e.g., user didn't
64 void Resume() { m_state
= Continue
; }
67 // callback for optional abort button
68 void OnCancel(wxCommandEvent
& event
);
70 // callback to disable "hard" window closing
71 void OnClose(wxCloseEvent
& event
);
73 // callback to detect when the dialog is closed
74 void OnShow(wxShowEvent
& event
);
76 // must be called to reenable the other windows temporarily disabled while
77 // the dialog was shown
78 void ReenableOtherWindows();
81 // create the label with given text and another one to show the time nearby
82 // under the lastWindow and modify it to be the same as the control created
83 // (which is returned)
84 wxStaticText
*CreateLabel(const wxString
& text
, wxWindow
**lastWindow
);
88 // the message displayed
90 // displayed elapsed, estimated, remaining time
91 class wxStaticText
*m_elapsed
,
94 // time when the dialog was created
95 unsigned long m_timeStart
;
97 // parent top level window (may be NULL)
98 wxWindow
*m_parentTop
;
100 // continue processing or not (return value for Update())
103 Uncancelable
= -1, // dialog can't be canceled
104 Canceled
, // can be cancelled and, in fact, was
105 Continue
, // can be cancelled but wasn't
106 Finished
// finished, waiting to be removed from screen
109 // the abort button (or NULL if none)
110 wxButton
*m_btnAbort
;
115 // for wxPD_APP_MODAL case
116 class WXDLLEXPORT wxWindowDisabler
*m_winDisabler
;
118 DECLARE_EVENT_TABLE()