]>
Commit | Line | Data |
---|---|---|
fb896a32 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/dialog.h | |
3 | // Purpose: wxDialog class | |
4 | // Author: David Elliott | |
5 | // Modified by: | |
6 | // Created: 2002/12/15 | |
1c067fe3 | 7 | // RCS-ID: $Id$ |
fb896a32 | 8 | // Copyright: David Elliott |
555f645a | 9 | // Licence: wxWindows licence |
fb896a32 DE |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COCOA_DIALOG_H_ | |
13 | #define _WX_COCOA_DIALOG_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | // NOTE: we don't need panel.h, but other things expect it to be included | |
17 | #include "wx/panel.h" | |
18 | #include "wx/cocoa/NSPanel.h" | |
19 | ||
63ec432b | 20 | WXDLLEXPORT_DATA(extern const wxChar) wxDialogNameStr[]; |
fb896a32 DE |
21 | |
22 | // ======================================================================== | |
23 | // wxDialog | |
24 | // ======================================================================== | |
25 | class WXDLLEXPORT wxDialog : public wxDialogBase, protected wxCocoaNSPanel | |
26 | { | |
27 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
fb896a32 DE |
28 | WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow) |
29 | // ------------------------------------------------------------------------ | |
30 | // initialization | |
31 | // ------------------------------------------------------------------------ | |
32 | public: | |
33 | wxDialog() { Init(); } | |
34 | ||
1c067fe3 | 35 | #if WXWIN_COMPATIBILITY_2_6 |
fb896a32 DE |
36 | // Constructor with a modal flag, but no window id - the old convention |
37 | wxDialog(wxWindow *parent, | |
1c067fe3 WS |
38 | const wxString& title, bool WXUNUSED(modal), |
39 | int x = wxDefaultCoord, int y= wxDefaultCoord, int width = 500, int height = 500, | |
fb896a32 DE |
40 | long style = wxDEFAULT_DIALOG_STYLE, |
41 | const wxString& name = wxDialogNameStr) | |
42 | { | |
43 | Init(); | |
1c067fe3 WS |
44 | Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height), |
45 | style, name); | |
fb896a32 | 46 | } |
1c067fe3 | 47 | #endif // WXWIN_COMPATIBILITY_2_6 |
fb896a32 DE |
48 | |
49 | // Constructor with no modal flag - the new convention. | |
50 | wxDialog(wxWindow *parent, wxWindowID winid, | |
51 | const wxString& title, | |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
54 | long style = wxDEFAULT_DIALOG_STYLE, | |
55 | const wxString& name = wxDialogNameStr) | |
56 | { | |
57 | Init(); | |
58 | Create(parent, winid, title, pos, size, style, name); | |
59 | } | |
60 | ||
61 | bool Create(wxWindow *parent, wxWindowID winid, | |
62 | const wxString& title, | |
63 | const wxPoint& pos = wxDefaultPosition, | |
64 | const wxSize& size = wxDefaultSize, | |
65 | long style = wxDEFAULT_DIALOG_STYLE, | |
66 | const wxString& name = wxDialogNameStr); | |
67 | ||
68 | ~wxDialog(); | |
69 | protected: | |
70 | void Init(); | |
71 | ||
72 | // ------------------------------------------------------------------------ | |
73 | // Cocoa specifics | |
74 | // ------------------------------------------------------------------------ | |
75 | protected: | |
9692f42b | 76 | virtual void CocoaDelegate_windowWillClose(void); |
456fef85 DE |
77 | virtual bool Cocoa_canBecomeMainWindow(bool &canBecome) |
78 | { canBecome = true; return true; } | |
fb896a32 DE |
79 | |
80 | // ------------------------------------------------------------------------ | |
81 | // Implementation | |
82 | // ------------------------------------------------------------------------ | |
83 | public: | |
555f645a | 84 | virtual bool Show(bool show = true); |
fb896a32 DE |
85 | |
86 | void SetModal(bool flag); | |
90c10896 DE |
87 | virtual bool IsModal() const { return m_isModal; } |
88 | bool m_isModal; | |
fb896a32 | 89 | |
1c067fe3 | 90 | // For now, same as Show(true) but returns return code |
fb896a32 DE |
91 | virtual int ShowModal(); |
92 | ||
93 | // may be called to terminate the dialog with the given return code | |
94 | virtual void EndModal(int retCode); | |
fb896a32 DE |
95 | }; |
96 | ||
97 | #endif // _WX_COCOA_DIALOG_H_ |