]>
Commit | Line | Data |
---|---|---|
6762286d 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 | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DIALOG_H_ | |
13 | #define _WX_DIALOG_H_ | |
14 | ||
15 | #include "wx/panel.h" | |
16 | ||
17 | WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[]; | |
18 | ||
19 | class WXDLLIMPEXP_FWD_CORE wxMacToolTip ; | |
62068535 | 20 | class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ; |
6762286d SC |
21 | |
22 | // Dialog boxes | |
23 | class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase | |
24 | { | |
25 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
26 | ||
27 | public: | |
28 | wxDialog() { Init(); } | |
29 | ||
30 | // Constructor with no modal flag - the new convention. | |
31 | wxDialog(wxWindow *parent, wxWindowID id, | |
32 | const wxString& title, | |
33 | const wxPoint& pos = wxDefaultPosition, | |
34 | const wxSize& size = wxDefaultSize, | |
35 | long style = wxDEFAULT_DIALOG_STYLE, | |
36 | const wxString& name = wxDialogNameStr) | |
37 | { | |
38 | Init(); | |
39 | Create(parent, id, title, pos, size, style, name); | |
40 | } | |
41 | ||
42 | bool Create(wxWindow *parent, wxWindowID id, | |
43 | const wxString& title, | |
44 | const wxPoint& pos = wxDefaultPosition, | |
45 | const wxSize& size = wxDefaultSize, | |
46 | long style = wxDEFAULT_DIALOG_STYLE, | |
47 | const wxString& name = wxDialogNameStr); | |
48 | ||
49 | virtual ~wxDialog(); | |
50 | ||
51 | // virtual bool Destroy(); | |
52 | virtual bool Show(bool show = true); | |
53 | ||
4d572a2c | 54 | // return true if we're showing the dialog modally |
6762286d SC |
55 | virtual bool IsModal() const; |
56 | ||
4d572a2c | 57 | // show the dialog modally and return the value passed to EndModal() |
6762286d | 58 | virtual int ShowModal(); |
ce00f59b | 59 | |
9482c644 | 60 | virtual void ShowWindowModal(); |
6762286d SC |
61 | |
62 | // may be called to terminate the dialog with the given return code | |
63 | virtual void EndModal(int retCode); | |
ce00f59b | 64 | |
445e564f SC |
65 | static bool OSXHasModalDialogsOpen(); |
66 | static void OSXBeginModalDialog(); | |
67 | static void OSXEndModalDialog(); | |
6762286d SC |
68 | |
69 | // implementation | |
70 | // -------------- | |
71 | ||
4d572a2c | 72 | wxDialogModality GetModality() const; |
ce00f59b | 73 | |
bfa92264 KO |
74 | #if wxOSX_USE_COCOA |
75 | virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {} | |
76 | #endif | |
77 | ||
4d572a2c | 78 | protected: |
ce00f59b | 79 | // show window modal dialog |
4d572a2c | 80 | void DoShowWindowModal(); |
6762286d | 81 | |
62068535 SC |
82 | // end window modal dialog. |
83 | void EndWindowModal(); | |
84 | ||
6762286d SC |
85 | // mac also takes command-period as cancel |
86 | virtual bool IsEscapeKey(const wxKeyEvent& event); | |
87 | ||
9482c644 | 88 | |
bfa92264 | 89 | wxDialogModality m_modality; |
ce00f59b | 90 | |
62068535 | 91 | wxModalEventLoop* m_eventLoop; |
bfa92264 | 92 | |
6762286d SC |
93 | private: |
94 | void Init(); | |
6762286d SC |
95 | }; |
96 | ||
5c6eb3a8 | 97 | #endif |
6762286d | 98 | // _WX_DIALOG_H_ |