]> git.saurik.com Git - wxWidgets.git/blob - src/mac/mdi.cpp
mac adaptions
[wxWidgets.git] / src / mac / mdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: mdi.cpp
3 // Purpose: MDI classes
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "mdi.h"
14 #endif
15
16 #include "wx/mdi.h"
17 #include "wx/menu.h"
18 #include "wx/settings.h"
19
20 extern wxList wxModelessWindows;
21
22 #if !USE_SHARED_LIBRARY
23 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
24 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
25 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
26
27 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
28 EVT_SIZE(wxMDIParentFrame::OnSize)
29 EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
30 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
31 END_EVENT_TABLE()
32
33 BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
34 EVT_SCROLL(wxMDIClientWindow::OnScroll)
35 END_EVENT_TABLE()
36
37 #endif
38
39 // Parent frame
40
41 wxMDIParentFrame::wxMDIParentFrame()
42 {
43 }
44
45 bool wxMDIParentFrame::Create(wxWindow *parent,
46 wxWindowID id,
47 const wxString& title,
48 const wxPoint& pos,
49 const wxSize& size,
50 long style,
51 const wxString& name)
52 {
53 if (!parent)
54 wxTopLevelWindows.Append(this);
55
56 SetName(name);
57 m_windowStyle = style;
58
59 if (parent) parent->AddChild(this);
60
61 if ( id > -1 )
62 m_windowId = id;
63 else
64 m_windowId = (int)NewControlId();
65
66 // TODO: create MDI parent frame
67
68 wxModelessWindows.Append(this);
69
70 return TRUE;
71 }
72
73 wxMDIParentFrame::~wxMDIParentFrame()
74 {
75 }
76
77 // Get size *available for subwindows* i.e. excluding menu bar.
78 void wxMDIParentFrame::GetClientSize(int *x, int *y) const
79 {
80 // TODO
81 }
82
83 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
84 {
85 wxFrame::SetMenuBar( menu_bar ) ;
86 }
87
88 void wxMDIParentFrame::OnSize(wxSizeEvent& event)
89 {
90 #if wxUSE_CONSTRAINTS
91 if (GetAutoLayout())
92 Layout();
93 #endif
94 int x = 0;
95 int y = 0;
96 int width, height;
97 GetClientSize(&width, &height);
98
99 if ( GetClientWindow() )
100 GetClientWindow()->SetSize(x, y, width, height);
101 }
102
103 void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
104 {
105 // Do nothing
106 }
107
108 // Returns the active MDI child window
109 wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
110 {
111 // TODO
112 return NULL;
113 }
114
115 // Create the client window class (don't Create the window,
116 // just return a new class)
117 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
118 {
119 return new wxMDIClientWindow ;
120 }
121
122 // Responds to colour changes, and passes event on to children.
123 void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
124 {
125 // TODO
126
127 // Propagate the event to the non-top-level children
128 wxFrame::OnSysColourChanged(event);
129 }
130
131 // MDI operations
132 void wxMDIParentFrame::Cascade()
133 {
134 // TODO
135 }
136
137 void wxMDIParentFrame::Tile()
138 {
139 // TODO
140 }
141
142 void wxMDIParentFrame::ArrangeIcons()
143 {
144 // TODO
145 }
146
147 void wxMDIParentFrame::ActivateNext()
148 {
149 // TODO
150 }
151
152 void wxMDIParentFrame::ActivatePrevious()
153 {
154 // TODO
155 }
156
157 // Child frame
158
159 wxMDIChildFrame::wxMDIChildFrame()
160 {
161 }
162
163 bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
164 wxWindowID id,
165 const wxString& title,
166 const wxPoint& pos,
167 const wxSize& size,
168 long style,
169 const wxString& name)
170 {
171 SetName(name);
172
173 if ( id > -1 )
174 m_windowId = id;
175 else
176 m_windowId = (int)NewControlId();
177
178 if (parent) parent->AddChild(this);
179
180 // TODO: create child frame
181
182 wxModelessWindows.Append(this);
183 return FALSE;
184 }
185
186 wxMDIChildFrame::~wxMDIChildFrame()
187 {
188 }
189
190 // Set the client size (i.e. leave the calculation of borders etc.
191 // to wxWindows)
192 void wxMDIChildFrame::SetClientSize(int width, int height)
193 {
194 // TODO
195 }
196
197 void wxMDIChildFrame::GetPosition(int *x, int *y) const
198 {
199 // TODO
200 }
201
202 void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
203 {
204 return wxFrame::SetMenuBar( menu_bar ) ;
205 }
206
207 // MDI operations
208 void wxMDIChildFrame::Maximize()
209 {
210 // TODO
211 }
212
213 void wxMDIChildFrame::Restore()
214 {
215 // TODO
216 }
217
218 void wxMDIChildFrame::Activate()
219 {
220 // TODO
221 }
222
223 // Client window
224
225 wxMDIClientWindow::wxMDIClientWindow()
226 {
227 }
228
229 wxMDIClientWindow::~wxMDIClientWindow()
230 {
231 }
232
233 bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
234 {
235 // TODO create client window
236 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
237
238 return FALSE;
239 }
240
241 // Explicitly call default scroll behaviour
242 void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
243 {
244 Default(); // Default processing
245 }
246