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