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
7 // Copyright: (c) 2003 David Elliott
8 // (c) 2008 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_MDI_H__
13 #define __WX_COCOA_MDI_H__
17 DECLARE_WXCOCOA_OBJC_CLASS(wxMDIParentFrameObserver
);
19 class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
20 class WXDLLIMPEXP_FWD_CORE wxMDIClientWindow
;
22 WX_DECLARE_EXPORTED_LIST(wxMDIChildFrame
, wxCocoaMDIChildFrameList
);
24 // ========================================================================
26 // ========================================================================
27 class WXDLLIMPEXP_CORE wxMDIParentFrame
: public wxMDIParentFrameBase
29 friend class WXDLLIMPEXP_FWD_CORE wxMDIChildFrame
;
31 DECLARE_DYNAMIC_CLASS(wxMDIParentFrame
)
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 wxMDIParentFrame() { Init(); }
37 wxMDIParentFrame(wxWindow
*parent
,
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
)
46 Create(parent
, winid
, title
, pos
, size
, style
, name
);
49 virtual ~wxMDIParentFrame();
51 bool Create(wxWindow
*parent
,
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
);
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
64 void WindowDidBecomeMain(NSNotification
*notification
);
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
);
71 void AddMDIChild(wxMDIChildFrame
*child
);
72 void RemoveMDIChild(wxMDIChildFrame
*child
);
74 wxMDIParentFrameObserver
*m_observer
;
75 // ------------------------------------------------------------------------
77 // ------------------------------------------------------------------------
79 void SetActiveChild(wxMDIChildFrame
*child
);
81 // implement base class pure virtuals
82 // ----------------------------------
84 static bool IsTDI() { return false; }
86 virtual void ActivateNext() { /* TODO */ }
87 virtual void ActivatePrevious() { /* TODO */ }
90 wxMDIClientWindow
*m_clientWindow
;
91 wxMDIChildFrame
*m_currentChild
;
92 wxCocoaMDIChildFrameList m_mdiChildren
;
95 // ========================================================================
97 // ========================================================================
98 class WXDLLIMPEXP_CORE wxMDIChildFrame
: public wxFrame
100 friend class WXDLLIMPEXP_FWD_CORE wxMDIParentFrame
;
101 DECLARE_EVENT_TABLE()
102 DECLARE_DYNAMIC_CLASS(wxMDIChildFrame
)
103 // ------------------------------------------------------------------------
105 // ------------------------------------------------------------------------
107 wxMDIChildFrame() { Init(); }
108 wxMDIChildFrame(wxMDIParentFrame
*parent
,
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
)
117 Create(parent
, winid
, title
, pos
, size
, style
, name
);
120 virtual ~wxMDIChildFrame();
122 bool Create(wxMDIParentFrame
*parent
,
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
);
131 // ------------------------------------------------------------------------
133 // ------------------------------------------------------------------------
136 virtual void CocoaDelegate_windowDidBecomeKey(void);
137 virtual void CocoaDelegate_windowDidBecomeMain(void);
138 virtual void CocoaDelegate_windowDidResignKey(void);
139 // ------------------------------------------------------------------------
141 // ------------------------------------------------------------------------
143 virtual void Activate();
144 virtual bool Destroy();
146 wxMDIParentFrame
*m_mdiParent
;
149 // ========================================================================
151 // ========================================================================
152 class wxMDIClientWindow
: public wxMDIClientWindowBase
155 wxMDIClientWindow() { }
157 virtual bool CreateClient(wxMDIParentFrame
*parent
,
158 long style
= wxHSCROLL
| wxVSCROLL
);
160 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow
)
163 #endif // __WX_COCOA_MDI_H__