]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/mac/mdi.cpp
Minor tweek for WXPM
[wxWidgets.git] / src / mac / mdi.cpp
... / ...
CommitLineData
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::DoGetClientSize(int *x, int *y) const
79{
80 wxFrame::DoGetClientSize( x , y ) ;
81}
82
83void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
84{
85 wxFrame::SetMenuBar( menu_bar ) ;
86}
87
88void 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
103void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
104{
105 // Do nothing
106}
107
108// Returns the active MDI child window
109wxMDIChildFrame *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)
117wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
118{
119 return new wxMDIClientWindow ;
120}
121
122// Responds to colour changes, and passes event on to children.
123void 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
132void wxMDIParentFrame::Cascade()
133{
134 // TODO
135}
136
137void wxMDIParentFrame::Tile()
138{
139 // TODO
140}
141
142void wxMDIParentFrame::ArrangeIcons()
143{
144 // TODO
145}
146
147void wxMDIParentFrame::ActivateNext()
148{
149 // TODO
150}
151
152void wxMDIParentFrame::ActivatePrevious()
153{
154 // TODO
155}
156
157// Child frame
158
159wxMDIChildFrame::wxMDIChildFrame()
160{
161}
162
163bool 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
186wxMDIChildFrame::~wxMDIChildFrame()
187{
188}
189
190// Set the client size (i.e. leave the calculation of borders etc.
191// to wxWindows)
192void wxMDIChildFrame::SetClientSize(int width, int height)
193{
194 // TODO
195}
196
197void wxMDIChildFrame::GetPosition(int *x, int *y) const
198{
199 // TODO
200}
201
202void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
203{
204 return wxFrame::SetMenuBar( menu_bar ) ;
205}
206
207// MDI operations
208void wxMDIChildFrame::Maximize()
209{
210 // TODO
211}
212
213void wxMDIChildFrame::Restore()
214{
215 // TODO
216}
217
218void wxMDIChildFrame::Activate()
219{
220 // TODO
221}
222
223// Client window
224
225wxMDIClientWindow::wxMDIClientWindow()
226{
227}
228
229wxMDIClientWindow::~wxMDIClientWindow()
230{
231}
232
233bool 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
242void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
243{
244 Default(); // Default processing
245}
246