]>
Commit | Line | Data |
---|---|---|
8cf73271 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
16 | #pragma interface "dialog.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/panel.h" | |
20 | ||
21 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
22 | ||
23 | WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr; | |
24 | ||
25 | class WXDLLEXPORT wxMacToolTip ; | |
26 | ||
27 | // Dialog boxes | |
28 | class WXDLLEXPORT wxDialog : public wxDialogBase | |
29 | { | |
30 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
31 | ||
32 | public: | |
2c326ada | 33 | wxDialog() { Init(); } |
8cf73271 SC |
34 | |
35 | // Constructor with a modal flag, but no window id - the old convention | |
36 | wxDialog(wxWindow *parent, | |
37 | const wxString& title, bool modal, | |
38 | int x = -1, int y= -1, int width = 500, int height = 500, | |
39 | long style = wxDEFAULT_DIALOG_STYLE, | |
40 | const wxString& name = wxDialogNameStr) | |
41 | { | |
2c326ada DE |
42 | Init(); |
43 | m_isModalStyle = modal; | |
8cf73271 | 44 | Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), |
2c326ada | 45 | style, name); |
8cf73271 SC |
46 | } |
47 | ||
48 | // Constructor with no modal flag - the new convention. | |
49 | wxDialog(wxWindow *parent, wxWindowID id, | |
50 | const wxString& title, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = wxDEFAULT_DIALOG_STYLE, | |
54 | const wxString& name = wxDialogNameStr) | |
55 | { | |
2c326ada | 56 | Init(); |
8cf73271 SC |
57 | Create(parent, id, title, pos, size, style, name); |
58 | } | |
59 | ||
60 | bool Create(wxWindow *parent, wxWindowID id, | |
61 | const wxString& title, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | long style = wxDEFAULT_DIALOG_STYLE, | |
65 | const wxString& name = wxDialogNameStr); | |
66 | ||
67 | ~wxDialog(); | |
68 | ||
69 | // virtual bool Destroy(); | |
70 | bool Show(bool show = true); | |
71 | ||
72 | void SetModal(bool flag); | |
73 | virtual bool IsModal() const; | |
74 | ||
75 | // For now, same as Show(TRUE) but returns return code | |
76 | virtual int ShowModal(); | |
77 | ||
78 | // may be called to terminate the dialog with the given return code | |
79 | virtual void EndModal(int retCode); | |
80 | ||
81 | // returns TRUE if we're in a modal loop | |
82 | bool IsModalShowing() const; | |
83 | ||
84 | // implementation | |
85 | // -------------- | |
86 | ||
87 | // event handlers | |
88 | void OnCharHook(wxKeyEvent& event); | |
89 | void OnCloseWindow(wxCloseEvent& event); | |
90 | ||
91 | // Standard buttons | |
92 | void OnOK(wxCommandEvent& event); | |
93 | void OnApply(wxCommandEvent& event); | |
94 | void OnCancel(wxCommandEvent& event); | |
95 | ||
96 | // Responds to colour changes | |
97 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
98 | ||
99 | // show modal dialog and enter modal loop | |
100 | void DoShowModal(); | |
101 | ||
102 | private: | |
2c326ada DE |
103 | void Init(); |
104 | bool m_isModalStyle; | |
8cf73271 SC |
105 | DECLARE_EVENT_TABLE() |
106 | }; | |
107 | ||
108 | #endif | |
109 | // _WX_DIALOG_H_ |