]>
Commit | Line | Data |
---|---|---|
0e0de6b8 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: Vaclav Slavik | |
5 | // Created: 2001/09/16 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com) | |
8 | // Licence: wxWindows license | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_UNIV_DIALOG_H_ | |
12 | #define _WX_UNIV_DIALOG_H_ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface "univdialog.h" | |
16 | #endif | |
17 | ||
18 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
19 | class WXDLLEXPORT wxWindowDisabler; | |
20 | class WXDLLEXPORT wxEventLoop; | |
21 | ||
22 | // Dialog boxes | |
23 | class WXDLLEXPORT wxDialog : public wxDialogBase | |
24 | { | |
25 | public: | |
26 | wxDialog() { Init(); } | |
27 | ||
28 | // Constructor with a modal flag, but no window id - the old convention | |
29 | wxDialog(wxWindow *parent, | |
30 | const wxString& title, bool modal, | |
31 | int x = -1, int y= -1, int width = 500, int height = 500, | |
32 | long style = wxDEFAULT_DIALOG_STYLE, | |
33 | const wxString& name = wxDialogNameStr) | |
34 | { | |
35 | long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ; | |
36 | Init(); | |
37 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), | |
38 | style | modalStyle, name); | |
39 | } | |
40 | ||
41 | ~wxDialog(); | |
42 | ||
43 | // Constructor with no modal flag - the new convention. | |
44 | wxDialog(wxWindow *parent, wxWindowID id, | |
45 | const wxString& title, | |
46 | const wxPoint& pos = wxDefaultPosition, | |
47 | const wxSize& size = wxDefaultSize, | |
48 | long style = wxDEFAULT_DIALOG_STYLE, | |
49 | const wxString& name = wxDialogNameStr) | |
50 | { | |
51 | Init(); | |
52 | Create(parent, id, title, pos, size, style, name); | |
53 | } | |
54 | ||
55 | bool Create(wxWindow *parent, wxWindowID id, | |
56 | const wxString& title, | |
57 | const wxPoint& pos = wxDefaultPosition, | |
58 | const wxSize& size = wxDefaultSize, | |
59 | long style = wxDEFAULT_DIALOG_STYLE, | |
60 | const wxString& name = wxDialogNameStr); | |
61 | ||
62 | void SetModal(bool flag); | |
63 | virtual bool IsModal() const; | |
64 | ||
65 | // For now, same as Show(TRUE) but returns return code | |
66 | virtual int ShowModal(); | |
67 | ||
68 | // may be called to terminate the dialog with the given return code | |
69 | virtual void EndModal(int retCode); | |
70 | ||
71 | // returns TRUE if we're in a modal loop | |
72 | bool IsModalShowing() const; | |
73 | ||
9facc126 | 74 | bool Show(bool show = TRUE); |
0e0de6b8 VS |
75 | |
76 | // implementation only from now on | |
77 | // ------------------------------- | |
78 | ||
79 | // event handlers | |
80 | void OnCloseWindow(wxCloseEvent& event); | |
81 | void OnOK(wxCommandEvent& event); | |
82 | void OnApply(wxCommandEvent& event); | |
83 | void OnCancel(wxCommandEvent& event); | |
84 | ||
85 | protected: | |
86 | // common part of all ctors | |
87 | void Init(); | |
88 | ||
89 | private: | |
90 | // while we are showing a modal dialog we disable the other windows using | |
91 | // this object | |
92 | wxWindowDisabler *m_windowDisabler; | |
93 | // modal dialog runs its own event loop | |
94 | wxEventLoop *m_eventLoop; | |
95 | // is modal right now? | |
96 | bool m_isShowingModal; | |
97 | ||
98 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
99 | DECLARE_EVENT_TABLE() | |
100 | }; | |
101 | ||
102 | #endif | |
103 | // _WX_UNIV_DIALOG_H_ |