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