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