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