]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/mdi.h
Inital fill in background, removed tabs, -1->wxID_ANY, TRUE->true, FALSE->false
[wxWidgets.git] / include / wx / cocoa / mdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/mdi.h
3 // Purpose: wxMDIParentFrame, wxMDIChildFrame, wxMDIClientWindow
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/09/08
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows licence
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
19 class WXDLLEXPORT wxMDIChildFrame;
20 class WXDLLEXPORT wxMDIClientWindow;
21
22 WX_DECLARE_LIST(wxMDIChildFrame, wxCocoaMDIChildFrameList);
23
24 // ========================================================================
25 // wxMDIParentFrame
26 // ========================================================================
27 class WXDLLEXPORT wxMDIParentFrame: public wxFrame
28 {
29 friend class WXDLLEXPORT wxMDIChildFrame;
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:
79 wxMDIChildFrame *GetActiveChild() const;
80 void SetActiveChild(wxMDIChildFrame *child);
81
82 wxMDIClientWindow *GetClientWindow() const;
83 virtual wxMDIClientWindow *OnCreateClient();
84
85 virtual void Cascade() {}
86 virtual void Tile() {}
87 virtual void ArrangeIcons() {}
88 virtual void ActivateNext();
89 virtual void ActivatePrevious();
90 protected:
91 wxMDIClientWindow *m_clientWindow;
92 wxMDIChildFrame *m_currentChild;
93 wxCocoaMDIChildFrameList m_mdiChildren;
94 };
95
96 // ========================================================================
97 // wxMDIChildFrame
98 // ========================================================================
99 class WXDLLEXPORT wxMDIChildFrame: public wxFrame
100 {
101 friend class WXDLLEXPORT wxMDIParentFrame;
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 // ========================================================================
153 class wxMDIClientWindow: public wxWindow
154 {
155 DECLARE_DYNAMIC_CLASS(wxMDIClientWindow)
156 public:
157 wxMDIClientWindow();
158 wxMDIClientWindow( wxMDIParentFrame *parent, long style = 0 );
159 ~wxMDIClientWindow();
160 virtual bool CreateClient( wxMDIParentFrame *parent, long style = 0 );
161 };
162
163 #endif // __WX_COCOA_MDI_H__