]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/progdlgg.h
Added a generic wxProgressDialog and made wxPostscriptPrinter use it.
[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 maximum value for status bar, if <= 0, no bar is shown
36 @param parent window or NULL
37 @param disableParentOnly if true, only disable parent window's
38 event handling
39 @param abortButton if true, dialog will show an abort button
40 */
41 wxProgressDialog(const wxString &title, wxString const &message,
42 int maximum = 100,
43 wxWindow *parent = NULL,
44 bool disableParentOnly = FALSE,
45 bool abortButton = FALSE);
46 /** Destructor.
47 Re-enables event handling for other windows.
48 */
49 ~wxProgressDialog();
50
51 /** Update the status bar to the new value.
52 @param value new value
53 @param newmsg if used, new message to display
54 @returns true if ABORT button has not been pressed
55 */
56 bool Update(int value = -1, const char *newmsg = NULL);
57
58 /** Can be called to continue after the cancel button has been pressed, but
59 the program decided to continue the operation (e.g., user didn't
60 configrm it)
61 */
62 void Resume() { m_state = Continue; }
63
64 /// Callback for optional abort button
65 void OnCancel(wxEvent& WXUNUSED(event)) { m_state = Canceled; }
66
67 /// callback to disable "hard" window closing
68 void OnClose(wxCloseEvent& event);
69
70 private:
71 /// the status bar
72 class wxGauge *m_gauge;
73 /// the message displayed
74 class wxStaticText *m_msg;
75 /// disable all or parent window only
76 bool m_disableParentOnly;
77 /// parent window
78 class wxWindow *m_parent;
79 /// continue processing or not (return value for Update())
80 enum
81 {
82 Uncancelable = -1, // dialog can't be canceled
83 Canceled, // can be cancelled and, in fact, was
84 Continue // can be cancelled but wasn't
85 } m_state;
86
87 DECLARE_EVENT_TABLE()
88 };
89 #endif
90 // __PROGDLGH_G__