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