]>
Commit | Line | Data |
---|---|---|
f99422e9 DE |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/cocoa/mdi.h | |
3 | // Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow | |
4 | // Author: David Elliott | |
d2824cdb | 5 | // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes |
f99422e9 DE |
6 | // Created: 2003/09/08 |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2003 David Elliott | |
d2824cdb | 9 | // (c) 2008 Vadim Zeitlin |
65571936 | 10 | // Licence: wxWindows licence |
f99422e9 DE |
11 | ///////////////////////////////////////////////////////////////////////////// |
12 | ||
13 | #ifndef __WX_COCOA_MDI_H__ | |
14 | #define __WX_COCOA_MDI_H__ | |
15 | ||
16 | #include "wx/frame.h" | |
17 | ||
18 | DECLARE_WXCOCOA_OBJC_CLASS(wxMDIParentFrameObserver); | |
19 | ||
b5dbe15d VS |
20 | class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; |
21 | class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow; | |
f99422e9 | 22 | |
8da116cf | 23 | WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList); |
f99422e9 DE |
24 | |
25 | // ======================================================================== | |
26 | // wxMDIParentFrame | |
27 | // ======================================================================== | |
d2824cdb | 28 | class WXDLLIMPEXP_CORE wxMDIParentFrame : public wxMDIParentFrameBase |
f99422e9 | 29 | { |
b5dbe15d | 30 | friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame; |
f99422e9 DE |
31 | DECLARE_EVENT_TABLE() |
32 | DECLARE_DYNAMIC_CLASS(wxMDIParentFrame) | |
33 | // ------------------------------------------------------------------------ | |
34 | // initialization | |
35 | // ------------------------------------------------------------------------ | |
36 | public: | |
37 | wxMDIParentFrame() { Init(); } | |
38 | wxMDIParentFrame(wxWindow *parent, | |
39 | wxWindowID winid, | |
40 | const wxString& title, | |
41 | const wxPoint& pos = wxDefaultPosition, | |
42 | const wxSize& size = wxDefaultSize, | |
43 | long style = wxDEFAULT_FRAME_STYLE, | |
44 | const wxString& name = wxFrameNameStr) | |
45 | { | |
46 | Init(); | |
47 | Create(parent, winid, title, pos, size, style, name); | |
48 | } | |
49 | ||
50 | virtual ~wxMDIParentFrame(); | |
51 | ||
52 | bool Create(wxWindow *parent, | |
53 | wxWindowID winid, | |
54 | const wxString& title, | |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | long style = wxDEFAULT_FRAME_STYLE, | |
58 | const wxString& name = wxFrameNameStr); | |
59 | protected: | |
60 | void Init(); | |
61 | // ------------------------------------------------------------------------ | |
62 | // Cocoa specifics | |
63 | // ------------------------------------------------------------------------ | |
64 | public: | |
65 | void WindowDidBecomeMain(NSNotification *notification); | |
66 | protected: | |
67 | virtual void CocoaDelegate_windowDidBecomeKey(void); | |
68 | virtual void CocoaDelegate_windowDidResignKey(void); | |
69 | virtual bool Cocoa_canBecomeMainWindow(bool &canBecome); | |
70 | virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win); | |
71 | ||
72 | void AddMDIChild(wxMDIChildFrame *child); | |
73 | void RemoveMDIChild(wxMDIChildFrame *child); | |
74 | ||
75 | wxMDIParentFrameObserver *m_observer; | |
76 | // ------------------------------------------------------------------------ | |
77 | // Implementation | |
78 | // ------------------------------------------------------------------------ | |
79 | public: | |
f99422e9 DE |
80 | void SetActiveChild(wxMDIChildFrame *child); |
81 | ||
d2824cdb VZ |
82 | // implement base class pure virtuals |
83 | // ---------------------------------- | |
84 | ||
85 | static bool IsTDI() { return false; } | |
86 | ||
87 | virtual void ActivateNext() { /* TODO */ } | |
88 | virtual void ActivatePrevious() { /* TODO */ } | |
f99422e9 | 89 | |
f99422e9 DE |
90 | protected: |
91 | wxMDIClientWindow *m_clientWindow; | |
92 | wxMDIChildFrame *m_currentChild; | |
93 | wxCocoaMDIChildFrameList m_mdiChildren; | |
94 | }; | |
95 | ||
96 | // ======================================================================== | |
97 | // wxMDIChildFrame | |
98 | // ======================================================================== | |
53a2db12 | 99 | class WXDLLIMPEXP_CORE wxMDIChildFrame: public wxFrame |
f99422e9 | 100 | { |
b5dbe15d | 101 | friend class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame; |
f99422e9 DE |
102 | DECLARE_EVENT_TABLE() |
103 | DECLARE_DYNAMIC_CLASS(wxMDIChildFrame) | |
104 | // ------------------------------------------------------------------------ | |
105 | // initialization | |
106 | // ------------------------------------------------------------------------ | |
107 | public: | |
108 | wxMDIChildFrame() { Init(); } | |
109 | wxMDIChildFrame(wxMDIParentFrame *parent, | |
110 | wxWindowID winid, | |
111 | const wxString& title, | |
112 | const wxPoint& pos = wxDefaultPosition, | |
113 | const wxSize& size = wxDefaultSize, | |
114 | long style = wxDEFAULT_FRAME_STYLE, | |
115 | const wxString& name = wxFrameNameStr) | |
116 | { | |
117 | Init(); | |
118 | Create(parent, winid, title, pos, size, style, name); | |
119 | } | |
120 | ||
121 | virtual ~wxMDIChildFrame(); | |
122 | ||
123 | bool Create(wxMDIParentFrame *parent, | |
124 | wxWindowID winid, | |
125 | const wxString& title, | |
126 | const wxPoint& pos = wxDefaultPosition, | |
127 | const wxSize& size = wxDefaultSize, | |
128 | long style = wxDEFAULT_FRAME_STYLE, | |
129 | const wxString& name = wxFrameNameStr); | |
130 | protected: | |
131 | void Init(); | |
132 | // ------------------------------------------------------------------------ | |
133 | // Cocoa specifics | |
134 | // ------------------------------------------------------------------------ | |
135 | public: | |
136 | protected: | |
137 | virtual void CocoaDelegate_windowDidBecomeKey(void); | |
138 | virtual void CocoaDelegate_windowDidBecomeMain(void); | |
139 | virtual void CocoaDelegate_windowDidResignKey(void); | |
140 | // ------------------------------------------------------------------------ | |
141 | // Implementation | |
142 | // ------------------------------------------------------------------------ | |
143 | public: | |
144 | virtual void Activate(); | |
145 | virtual bool Destroy(); | |
146 | protected: | |
147 | wxMDIParentFrame *m_mdiParent; | |
148 | }; | |
149 | ||
150 | // ======================================================================== | |
151 | // wxMDIClientWindow | |
152 | // ======================================================================== | |
d2824cdb | 153 | class wxMDIClientWindow : public wxMDIClientWindowBase |
f99422e9 | 154 | { |
f99422e9 | 155 | public: |
d2824cdb VZ |
156 | wxMDIClientWindow() { } |
157 | ||
158 | virtual bool CreateClient(wxMDIParentFrame *parent, | |
159 | long style = wxHSCROLL | wxVSCROLL); | |
160 | ||
161 | DECLARE_DYNAMIC_CLASS(wxMDIClientWindow) | |
f99422e9 DE |
162 | }; |
163 | ||
164 | #endif // __WX_COCOA_MDI_H__ |