1 ////////////////////////////////////////////////////
3 // Purpose: wxProgressDialog class
4 // Author: Karsten Ballüder
8 // Copyright: (c) Karsten Ballüder
9 // Licence: wxWindows licence
10 ////////////////////////////////////////////////////
12 #ifndef __PROGDLGH_G__
13 #define __PROGDLGH_G__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 virtual bool Update(int value
, const wxString
& newmsg
= wxEmptyString
, bool *skip
= NULL
);
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
66 bool Show( bool show
= true );
69 // callback for optional abort button
70 void OnCancel(wxCommandEvent
& event
);
72 // callback for optional skip button
73 void OnSkip(wxCommandEvent
& event
);
75 // callback to disable "hard" window closing
76 void OnClose(wxCloseEvent
& event
);
78 // must be called to reenable the other windows temporarily disabled while
79 // the dialog was shown
80 void ReenableOtherWindows();
83 // create the label with given text and another one to show the time nearby
84 // as the next windows in the sizer, returns the created control
85 wxStaticText
*CreateLabel(const wxString
& text
, wxSizer
*sizer
);
89 // the message displayed
91 // displayed elapsed, estimated, remaining time
92 class wxStaticText
*m_elapsed
,
95 // time when the dialog was created
96 unsigned long m_timeStart
;
97 // time when the dialog was closed or cancelled
98 unsigned long m_timeStop
;
99 // time between the moment the dialog was closed/cancelled and resume
100 unsigned long m_break
;
102 // parent top level window (may be NULL)
103 wxWindow
*m_parentTop
;
105 // continue processing or not (return value for Update())
108 Uncancelable
= -1, // dialog can't be canceled
109 Canceled
, // can be cancelled and, in fact, was
110 Continue
, // can be cancelled but wasn't
111 Finished
// finished, waiting to be removed from screen
117 #if !defined(__SMARTPHONE__)
118 // the abort and skip buttons (or NULL if none)
119 wxButton
*m_btnAbort
;
126 // saves the time when elapsed time was updated so there is only one
128 unsigned long m_last_timeupdate
;
129 // tells how often a change of the estimated time has to be confirmed
130 // before it is actually displayed - this reduces the frequence of updates
131 // of estimated and remaining time
133 // counts the confirmations
135 unsigned long m_display_estimated
;
137 #if defined(__WXMSW__ ) || defined(__WXPM__)
138 // the factor we use to always keep the value in 16 bit range as the native
139 // control only supports ranges from 0 to 65,535
143 // for wxPD_APP_MODAL case
144 class WXDLLEXPORT wxWindowDisabler
*m_winDisabler
;
146 DECLARE_EVENT_TABLE()
148 // Virtual function hiding supression
149 virtual void Update() { wxDialog::Update(); }
151 DECLARE_NO_COPY_CLASS(wxProgressDialog
)