]>
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 | ||
fb896a32 DE |
20 | // ======================================================================== |
21 | // wxDialog | |
22 | // ======================================================================== | |
53a2db12 | 23 | class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase, protected wxCocoaNSPanel |
fb896a32 DE |
24 | { |
25 | DECLARE_DYNAMIC_CLASS(wxDialog) | |
fb896a32 DE |
26 | WX_DECLARE_COCOA_OWNER(NSPanel,NSWindow,NSWindow) |
27 | // ------------------------------------------------------------------------ | |
28 | // initialization | |
29 | // ------------------------------------------------------------------------ | |
30 | public: | |
31 | wxDialog() { Init(); } | |
32 | ||
1c067fe3 | 33 | #if WXWIN_COMPATIBILITY_2_6 |
fb896a32 DE |
34 | // Constructor with a modal flag, but no window id - the old convention |
35 | wxDialog(wxWindow *parent, | |
1c067fe3 WS |
36 | const wxString& title, bool WXUNUSED(modal), |
37 | int x = wxDefaultCoord, int y= wxDefaultCoord, int width = 500, int height = 500, | |
fb896a32 DE |
38 | long style = wxDEFAULT_DIALOG_STYLE, |
39 | const wxString& name = wxDialogNameStr) | |
40 | { | |
41 | Init(); | |
1c067fe3 WS |
42 | Create(parent, wxID_ANY, title, wxPoint(x, y), wxSize(width, height), |
43 | style, name); | |
fb896a32 | 44 | } |
1c067fe3 | 45 | #endif // WXWIN_COMPATIBILITY_2_6 |
fb896a32 DE |
46 | |
47 | // Constructor with no modal flag - the new convention. | |
48 | wxDialog(wxWindow *parent, wxWindowID winid, | |
49 | const wxString& title, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | long style = wxDEFAULT_DIALOG_STYLE, | |
53 | const wxString& name = wxDialogNameStr) | |
54 | { | |
55 | Init(); | |
56 | Create(parent, winid, title, pos, size, style, name); | |
57 | } | |
58 | ||
59 | bool Create(wxWindow *parent, wxWindowID winid, | |
60 | const wxString& title, | |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
63 | long style = wxDEFAULT_DIALOG_STYLE, | |
64 | const wxString& name = wxDialogNameStr); | |
65 | ||
d3c7fc99 | 66 | virtual ~wxDialog(); |
fb896a32 DE |
67 | protected: |
68 | void Init(); | |
69 | ||
70 | // ------------------------------------------------------------------------ | |
71 | // Cocoa specifics | |
72 | // ------------------------------------------------------------------------ | |
73 | protected: | |
9692f42b | 74 | virtual void CocoaDelegate_windowWillClose(void); |
456fef85 DE |
75 | virtual bool Cocoa_canBecomeMainWindow(bool &canBecome) |
76 | { canBecome = true; return true; } | |
fb896a32 DE |
77 | |
78 | // ------------------------------------------------------------------------ | |
79 | // Implementation | |
80 | // ------------------------------------------------------------------------ | |
81 | public: | |
555f645a | 82 | virtual bool Show(bool show = true); |
fb896a32 DE |
83 | |
84 | void SetModal(bool flag); | |
90c10896 DE |
85 | virtual bool IsModal() const { return m_isModal; } |
86 | bool m_isModal; | |
fb896a32 | 87 | |
1c067fe3 | 88 | // For now, same as Show(true) but returns return code |
fb896a32 DE |
89 | virtual int ShowModal(); |
90 | ||
91 | // may be called to terminate the dialog with the given return code | |
92 | virtual void EndModal(int retCode); | |
fb896a32 DE |
93 | }; |
94 | ||
95 | #endif // _WX_COCOA_DIALOG_H_ |