]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/progdlgg.h
Removed old wxGLCanvas stuff; moved wxTreeLayout to wxWindows; corrected some doc...
[wxWidgets.git] / include / wx / generic / progdlgg.h
1 ////////////////////////////////////////////////////
2 // Name: progdlgg.h
3 // Purpose: wxProgressDialog class
4 // Author: Karsten Ballüder
5 // Modified by:
6 // Created: 09.05.1999
7 // RCS-ID: $Id$
8 // Copyright: (c) Karsten Ballüder
9 // Licence: wxWindows license
10 ////////////////////////////////////////////////////
11
12 #ifndef __PROGDLGH_G__
13 #define __PROGDLGH_G__
14
15 #ifdef __GNUG__
16 #pragma interface "progdlgg.h"
17 #endif
18
19 #include "wx/setup.h"
20
21 #if wxUSE_PROGRESSDLG
22
23 #include "wx/dialog.h"
24
25 class WXDLLEXPORT wxButton;
26 class WXDLLEXPORT wxGauge;
27 class WXDLLEXPORT wxStaticText;
28
29 /* Progress dialog which shows a moving progress bar.
30 Taken from the Mahogany project.*/
31
32 class WXDLLEXPORT wxProgressDialog : public wxDialog
33 {
34 DECLARE_DYNAMIC_CLASS(wxProgressDialog)
35 public:
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
43 */
44 wxProgressDialog(const wxString &title, wxString const &message,
45 int maximum = 100,
46 wxWindow *parent = NULL,
47 int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
48 /* Destructor.
49 Re-enables event handling for other windows.
50 */
51 ~wxProgressDialog();
52
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
57 */
58 bool Update(int value = -1, const wxString& newmsg = wxT(""));
59
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
62 confirm it)
63 */
64 void Resume() { m_state = Continue; }
65
66 // implementation from now on
67 // callback for optional abort button
68 void OnCancel(wxCommandEvent& event);
69 // callback to disable "hard" window closing
70 void OnClose(wxCloseEvent& event);
71
72 private:
73 // create the label with given text and another one to show the time nearby
74 // under the lastWindow and modify it to be the same as the control created
75 // (which is returned)
76 wxStaticText *CreateLabel(const wxString& text, wxWindow **lastWindow);
77
78 // the status bar
79 wxGauge *m_gauge;
80 // the message displayed
81 wxStaticText *m_msg;
82 // displayed elapsed, estimated, remaining time
83 class wxStaticText *m_elapsed,
84 *m_estimated,
85 *m_remaining;
86 // time when the dialog was created
87 unsigned long m_timeStart;
88
89 // parent top level window (may be NULL)
90 wxWindow *m_parentTop;
91
92 // continue processing or not (return value for Update())
93 enum
94 {
95 Uncancelable = -1, // dialog can't be canceled
96 Canceled, // can be cancelled and, in fact, was
97 Continue, // can be cancelled but wasn't
98 Finished // finished, waiting to be removed from screen
99 } m_state;
100 // the abort button (or NULL if none)
101 wxButton *m_btnAbort;
102 // the maximum value
103 int m_maximum;
104
105 DECLARE_EVENT_TABLE()
106 };
107 #endif
108
109 #endif
110 // __PROGDLGH_G__