]> git.saurik.com Git - wxWidgets.git/blob - src/mac/mdi.cpp
fixes for compilation with the old mingw32, wxUSE_NORLANDER_HEADERS is always
[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 IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
23 IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
24 IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
25
26 BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame)
27 EVT_SIZE(wxMDIParentFrame::OnSize)
28 EVT_ACTIVATE(wxMDIParentFrame::OnActivate)
29 EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged)
30 END_EVENT_TABLE()
31
32 BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
33 EVT_SCROLL(wxMDIClientWindow::OnScroll)
34 END_EVENT_TABLE()
35
36
37 // Parent frame
38
39 wxMDIParentFrame::wxMDIParentFrame()
40 {
41 }
42
43 bool 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
71 wxMDIParentFrame::~wxMDIParentFrame()
72 {
73 }
74
75 // Get size *available for subwindows* i.e. excluding menu bar.
76 void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
77 {
78 wxFrame::DoGetClientSize( x , y ) ;
79 }
80
81 void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
82 {
83 wxFrame::SetMenuBar( menu_bar ) ;
84 }
85
86 void 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
101 void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
102 {
103 // Do nothing
104 }
105
106 // Returns the active MDI child window
107 wxMDIChildFrame *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)
115 wxMDIClientWindow *wxMDIParentFrame::OnCreateClient()
116 {
117 return new wxMDIClientWindow ;
118 }
119
120 // Responds to colour changes, and passes event on to children.
121 void 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
130 void wxMDIParentFrame::Cascade()
131 {
132 // TODO
133 }
134
135 void wxMDIParentFrame::Tile()
136 {
137 // TODO
138 }
139
140 void wxMDIParentFrame::ArrangeIcons()
141 {
142 // TODO
143 }
144
145 void wxMDIParentFrame::ActivateNext()
146 {
147 // TODO
148 }
149
150 void wxMDIParentFrame::ActivatePrevious()
151 {
152 // TODO
153 }
154
155 // Child frame
156
157 wxMDIChildFrame::wxMDIChildFrame()
158 {
159 }
160
161 bool 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
184 wxMDIChildFrame::~wxMDIChildFrame()
185 {
186 }
187
188 // Set the client size (i.e. leave the calculation of borders etc.
189 // to wxWindows)
190 void wxMDIChildFrame::SetClientSize(int width, int height)
191 {
192 // TODO
193 }
194
195 void wxMDIChildFrame::GetPosition(int *x, int *y) const
196 {
197 // TODO
198 }
199
200 void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
201 {
202 return wxFrame::SetMenuBar( menu_bar ) ;
203 }
204
205 // MDI operations
206 void wxMDIChildFrame::Maximize()
207 {
208 // TODO
209 }
210
211 void wxMDIChildFrame::Restore()
212 {
213 // TODO
214 }
215
216 void wxMDIChildFrame::Activate()
217 {
218 // TODO
219 }
220
221 // Client window
222
223 wxMDIClientWindow::wxMDIClientWindow()
224 {
225 }
226
227 wxMDIClientWindow::~wxMDIClientWindow()
228 {
229 }
230
231 bool 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
240 void wxMDIClientWindow::OnScroll(wxScrollEvent& event)
241 {
242 }
243