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