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