1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/mdi.h
3 // Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
4 // Author: David Elliott
5 // Modified by: 2008-10-31 Vadim Zeitlin: derive from the base classes
8 // Copyright: (c) 2003 David Elliott
9 // (c) 2008 Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __WX_COCOA_MDI_H__
14 #define __WX_COCOA_MDI_H__
18 DECLARE_WXCOCOA_OBJC_CLASS(wxMDIParentFrameObserver
);
20 class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
21 class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow
;
23 WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame
, wxCocoaMDIChildFrameList
);
25 // ========================================================================
27 // ========================================================================
28 class WXDLLIMPEXP_CORE wxMDIParentFrame
: public wxMDIParentFrameBase
30 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
32 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
33 // ------------------------------------------------------------------------
35 // ------------------------------------------------------------------------
37 wxMDIParentFrame() { Init(); }
38 wxMDIParentFrame(wxWindow
*parent
,
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
)
47 Create(parent
, winid
, title
, pos
, size
, style
, name
);
50 virtual ~wxMDIParentFrame();
52 bool Create(wxWindow
*parent
,
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
);
61 // ------------------------------------------------------------------------
63 // ------------------------------------------------------------------------
65 void WindowDidBecomeMain(NSNotification
*notification
);
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
);
72 void AddMDIChild(wxMDIChildFrame
*child
);
73 void RemoveMDIChild(wxMDIChildFrame
*child
);
75 wxMDIParentFrameObserver
*m_observer
;
76 // ------------------------------------------------------------------------
78 // ------------------------------------------------------------------------
80 void SetActiveChild(wxMDIChildFrame
*child
);
82 // implement base class pure virtuals
83 // ----------------------------------
85 static bool IsTDI() { return false; }
87 virtual void ActivateNext() { /* TODO */ }
88 virtual void ActivatePrevious() { /* TODO */ }
91 wxMDIClientWindow
*m_clientWindow
;
92 wxMDIChildFrame
*m_currentChild
;
93 wxCocoaMDIChildFrameList m_mdiChildren
;
96 // ========================================================================
98 // ========================================================================
99 class WXDLLIMPEXP_CORE wxMDIChildFrame
: public wxFrame
101 friend class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame
;
102 DECLARE_EVENT_TABLE()
103 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
104 // ------------------------------------------------------------------------
106 // ------------------------------------------------------------------------
108 wxMDIChildFrame() { Init(); }
109 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
118 Create(parent
, winid
, title
, pos
, size
, style
, name
);
121 virtual ~wxMDIChildFrame();
123 bool Create(wxMDIParentFrame
*parent
,
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
);
132 // ------------------------------------------------------------------------
134 // ------------------------------------------------------------------------
137 virtual void CocoaDelegate_windowDidBecomeKey(void);
138 virtual void CocoaDelegate_windowDidBecomeMain(void);
139 virtual void CocoaDelegate_windowDidResignKey(void);
140 // ------------------------------------------------------------------------
142 // ------------------------------------------------------------------------
144 virtual void Activate();
145 virtual bool Destroy();
147 wxMDIParentFrame
*m_mdiParent
;
150 // ========================================================================
152 // ========================================================================
153 class wxMDIClientWindow
: public wxMDIClientWindowBase
156 wxMDIClientWindow() { }
158 virtual bool CreateClient(wxMDIParentFrame
*parent
,
159 long style
= wxHSCROLL
| wxVSCROLL
);
161 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
164 #endif // __WX_COCOA_MDI_H__