]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/progdlgg.h
1. wxTextCtrl compilation fixes for wxGTK and more ugfixes (untested yet)
[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/frame.h"
24 #include "wx/time.h"
25
26 /** Progress dialog which shows a moving progress bar.
27 Taken from the Mahogany project.*/
28
29 class WXDLLEXPORT wxProgressDialog : public wxFrame
30 {
31 DECLARE_DYNAMIC_CLASS(wxProgressDialog)
32 public:
33 /** Creates and displays dialog, disables event handling for other
34 frames or parent frame to avoid recursion problems.
35 @param title title for window
36 @param message message to display in window
37 @param maximum value for status bar, if <= 0, no bar is shown
38 @param parent window or NULL
39 @param style is the bit mask of wxPD_XXX constants from wx/defs.h
40 */
41 wxProgressDialog(const wxString &title, wxString const &message,
42 int maximum = 100,
43 wxWindow *parent = NULL,
44 int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE);
45 /** Destructor.
46 Re-enables event handling for other windows.
47 */
48 ~wxProgressDialog();
49
50 /** Update the status bar to the new value.
51 @param value new value
52 @param newmsg if used, new message to display
53 @returns true if ABORT button has not been pressed
54 */
55 bool Update(int value = -1, const wxString& newmsg = _T(""));
56
57 /** Can be called to continue after the cancel button has been pressed, but
58 the program decided to continue the operation (e.g., user didn't
59 confirm it)
60 */
61 void Resume() { m_state = Continue; }
62
63 /// Callback for optional abort button
64 void OnCancel(wxCommandEvent& WXUNUSED(event)) { m_state = Canceled; }
65
66 /// callback to disable "hard" window closing
67 void OnClose(wxCloseEvent& event);
68
69 private:
70 /// the status bar
71 class wxGauge *m_gauge;
72 /// the message displayed
73 class wxStaticText *m_msg;
74 /// disable all or parent window only
75 bool m_disableParentOnly;
76 /// displayed elapsed, estimated, remaining time
77 class wxStaticText *m_elapsed, *m_estimated, *m_remaining;
78 /// time when the dialog was created or NULL
79 class wxTime *m_time;
80 /// parent window
81 class wxWindow *m_parent;
82 /// continue processing or not (return value for Update())
83 enum
84 {
85 Uncancelable = -1, // dialog can't be canceled
86 Canceled, // can be cancelled and, in fact, was
87 Continue, // can be cancelled but wasn't
88 Finished // finished, waiting to be removed from screen
89 } m_state;
90 /// the abort button (or NULL if none)
91 class wxButton *m_btnAbort;
92 /// the maximum value
93 int m_maximum;
94
95 DECLARE_EVENT_TABLE()
96 };
97 #endif
98
99 #endif
100 // __PROGDLGH_G__