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