]> git.saurik.com Git - wxWidgets.git/blame - src/mac/mdi.cpp
wxButton::GetDefaultSize() added for MSW and documented
[wxWidgets.git] / src / mac / mdi.cpp
CommitLineData
e9576ca5
SC
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
20extern wxList wxModelessWindows;
21
22#if !USE_SHARED_LIBRARY
23IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
24IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
25IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
26
27BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
28 EVT_SIZE(wxMDIParentFrame::OnSize)
29 EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
30 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
31END_EVENT_TABLE()
32
33BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
34 EVT_SCROLL(wxMDIClientWindow::OnScroll)
35END_EVENT_TABLE()
36
37#endif
38
39// Parent frame
40
41wxMDIParentFrame::wxMDIParentFrame()
42{
43}
44
45bool 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
73wxMDIParentFrame::~wxMDIParentFrame()
74{
75}
76
77// Get size *available for subwindows* i.e. excluding menu bar.
78void wxMDIParentFrame::GetClientSize(int *x, int *y) const
79{
80 // TODO
81}
82
83void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
84{
85 // TODO
86 if (!menu_bar)
87 {
88 m_frameMenuBar = NULL;
89 return;
90 }
91
92 if (menu_bar->m_menuBarFrame)
93 return;
94
95 m_frameMenuBar = menu_bar;
96}
97
98void wxMDIParentFrame::OnSize(wxSizeEvent& event)
99{
100#if wxUSE_CONSTRAINTS
101 if (GetAutoLayout())
102 Layout();
103#endif
104 int x = 0;
105 int y = 0;
106 int width, height;
107 GetClientSize(&width, &height);
108
109 if ( GetClientWindow() )
110 GetClientWindow()->SetSize(x, y, width, height);
111}
112
113void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
114{
115 // Do nothing
116}
117
118// Returns the active MDI child window
119wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
120{
121 // TODO
122 return NULL;
123}
124
125// Create the client window class (don't Create the window,
126// just return a new class)
127wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
128{
129 return new wxMDIClientWindow ;
130}
131
132// Responds to colour changes, and passes event on to children.
133void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
134{
135 // TODO
136
137 // Propagate the event to the non-top-level children
138 wxFrame::OnSysColourChanged(event);
139}
140
141// MDI operations
142void wxMDIParentFrame::Cascade()
143{
144 // TODO
145}
146
147void wxMDIParentFrame::Tile()
148{
149 // TODO
150}
151
152void wxMDIParentFrame::ArrangeIcons()
153{
154 // TODO
155}
156
157void wxMDIParentFrame::ActivateNext()
158{
159 // TODO
160}
161
162void wxMDIParentFrame::ActivatePrevious()
163{
164 // TODO
165}
166
167// Child frame
168
169wxMDIChildFrame::wxMDIChildFrame()
170{
171}
172
173bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
174 wxWindowID id,
175 const wxString& title,
176 const wxPoint& pos,
177 const wxSize& size,
178 long style,
179 const wxString& name)
180{
181 SetName(name);
182
183 if ( id > -1 )
184 m_windowId = id;
185 else
186 m_windowId = (int)NewControlId();
187
188 if (parent) parent->AddChild(this);
189
190 // TODO: create child frame
191
192 wxModelessWindows.Append(this);
193 return FALSE;
194}
195
196wxMDIChildFrame::~wxMDIChildFrame()
197{
198}
199
200// Set the client size (i.e. leave the calculation of borders etc.
201// to wxWindows)
202void wxMDIChildFrame::SetClientSize(int width, int height)
203{
204 // TODO
205}
206
207void wxMDIChildFrame::GetPosition(int *x, int *y) const
208{
209 // TODO
210}
211
212void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
213{
214 // TODO
215 if (!menu_bar)
216 {
217 m_frameMenuBar = NULL;
218 return;
219 }
220
221 if (menu_bar->m_menuBarFrame)
222 return;
223 m_frameMenuBar = menu_bar;
224}
225
226// MDI operations
227void wxMDIChildFrame::Maximize()
228{
229 // TODO
230}
231
232void wxMDIChildFrame::Restore()
233{
234 // TODO
235}
236
237void wxMDIChildFrame::Activate()
238{
239 // TODO
240}
241
242// Client window
243
244wxMDIClientWindow::wxMDIClientWindow()
245{
246}
247
248wxMDIClientWindow::~wxMDIClientWindow()
249{
250}
251
252bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
253{
254 // TODO create client window
255 m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE);
256
257 return FALSE;
258}
259
260// Explicitly call default scroll behaviour
261void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
262{
263 Default(); // Default processing
264}
265