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