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