]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
a967ef9d VZ |
2 | // Name: src/msw/mdi.cpp |
3 | // Purpose: MDI classes for wxMSW | |
2bda0e17 KB |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
6c9a19aa | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
a23fd0e1 VZ |
12 | // =========================================================================== |
13 | // declarations | |
14 | // =========================================================================== | |
15 | ||
16 | // --------------------------------------------------------------------------- | |
17 | // headers | |
18 | // --------------------------------------------------------------------------- | |
19 | ||
14f355c2 | 20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
a23fd0e1 | 21 | #pragma implementation "mdi.h" |
2bda0e17 KB |
22 | #endif |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
a23fd0e1 | 28 | #pragma hdrstop |
2bda0e17 KB |
29 | #endif |
30 | ||
efd17a1d | 31 | #if wxUSE_MDI && !defined(__WXUNIVERSAL__) |
b442f107 | 32 | |
2bda0e17 | 33 | #ifndef WX_PRECOMP |
a23fd0e1 VZ |
34 | #include "wx/setup.h" |
35 | #include "wx/frame.h" | |
36 | #include "wx/menu.h" | |
37 | #include "wx/app.h" | |
38 | #include "wx/utils.h" | |
39 | #include "wx/dialog.h" | |
7c0ea335 VZ |
40 | #if wxUSE_STATUSBAR |
41 | #include "wx/statusbr.h" | |
42 | #endif | |
a23fd0e1 | 43 | #include "wx/settings.h" |
0c589ad0 BM |
44 | #include "wx/intl.h" |
45 | #include "wx/log.h" | |
2bda0e17 KB |
46 | #endif |
47 | ||
48 | #include "wx/mdi.h" | |
49 | #include "wx/msw/private.h" | |
50 | ||
7c0ea335 | 51 | #if wxUSE_STATUSBAR && wxUSE_NATIVE_STATUSBAR |
3096bd2f | 52 | #include "wx/msw/statbr95.h" |
2bda0e17 KB |
53 | #endif |
54 | ||
7c0ea335 VZ |
55 | #if wxUSE_TOOLBAR |
56 | #include "wx/toolbar.h" | |
57 | #endif // wxUSE_TOOLBAR | |
58 | ||
2bda0e17 KB |
59 | #include <string.h> |
60 | ||
a23fd0e1 VZ |
61 | // --------------------------------------------------------------------------- |
62 | // global variables | |
63 | // --------------------------------------------------------------------------- | |
64 | ||
e1a6fc11 | 65 | extern wxMenu *wxCurrentPopupMenu; |
2bda0e17 | 66 | |
3ca6a5f0 | 67 | extern const wxChar *wxMDIFrameClassName; // from app.cpp |
2ffa221c | 68 | extern const wxChar *wxMDIChildFrameClassName; |
3ca6a5f0 | 69 | extern const wxChar *wxMDIChildFrameClassNameNoRedraw; |
c7527e3f | 70 | extern void wxAssociateWinWithHandle(HWND hWnd, wxWindow *win); |
ac6482e0 | 71 | extern void wxRemoveHandleAssociation(wxWindow *win); |
a23fd0e1 | 72 | |
42e69d6b VZ |
73 | static HWND invalidHandle = 0; |
74 | ||
a23fd0e1 VZ |
75 | // --------------------------------------------------------------------------- |
76 | // constants | |
77 | // --------------------------------------------------------------------------- | |
78 | ||
79 | static const int IDM_WINDOWTILE = 4001; | |
42e69d6b | 80 | static const int IDM_WINDOWTILEHOR = 4001; |
a23fd0e1 VZ |
81 | static const int IDM_WINDOWCASCADE = 4002; |
82 | static const int IDM_WINDOWICONS = 4003; | |
83 | static const int IDM_WINDOWNEXT = 4004; | |
42e69d6b | 84 | static const int IDM_WINDOWTILEVERT = 4005; |
4f3b37fd | 85 | static const int IDM_WINDOWPREV = 4006; |
a23fd0e1 VZ |
86 | |
87 | // This range gives a maximum of 500 MDI children. Should be enough :-) | |
88 | static const int wxFIRST_MDI_CHILD = 4100; | |
89 | static const int wxLAST_MDI_CHILD = 4600; | |
2bda0e17 KB |
90 | |
91 | // Status border dimensions | |
a23fd0e1 VZ |
92 | static const int wxTHICK_LINE_BORDER = 3; |
93 | static const int wxTHICK_LINE_WIDTH = 1; | |
2bda0e17 | 94 | |
42e69d6b VZ |
95 | // --------------------------------------------------------------------------- |
96 | // private functions | |
97 | // --------------------------------------------------------------------------- | |
98 | ||
99 | // set the MDI menus (by sending the WM_MDISETMENU message) and update the menu | |
100 | // of the parent of win (which is supposed to be the MDI client window) | |
101 | static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow); | |
102 | ||
103 | // insert the window menu (subMenu) into menu just before "Help" submenu or at | |
104 | // the very end if not found | |
105 | static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu); | |
106 | ||
df61c009 JS |
107 | // Remove the window menu |
108 | static void RemoveWindowMenu(wxWindow *win, WXHMENU menu); | |
109 | ||
42e69d6b VZ |
110 | // is this an id of an MDI child? |
111 | inline bool IsMdiCommandId(int id) | |
112 | { | |
113 | return (id >= wxFIRST_MDI_CHILD) && (id <= wxLAST_MDI_CHILD); | |
114 | } | |
115 | ||
4e152a23 | 116 | // unpack the parameters of WM_MDIACTIVATE message |
2917e920 BM |
117 | static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, |
118 | WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact); | |
42e69d6b | 119 | |
4e152a23 VZ |
120 | // return the HMENU of the MDI menu |
121 | static inline HMENU GetMDIWindowMenu(wxMDIParentFrame *frame) | |
122 | { | |
123 | wxMenu *menu = frame->GetWindowMenu(); | |
124 | return menu ? GetHmenuOf(menu) : 0; | |
125 | } | |
126 | ||
a23fd0e1 VZ |
127 | // =========================================================================== |
128 | // implementation | |
129 | // =========================================================================== | |
130 | ||
131 | // --------------------------------------------------------------------------- | |
132 | // wxWin macros | |
133 | // --------------------------------------------------------------------------- | |
2bda0e17 | 134 | |
225fe9d6 VZ |
135 | IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame) |
136 | IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame) | |
137 | IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow) | |
2bda0e17 KB |
138 | |
139 | BEGIN_EVENT_TABLE(wxMDIParentFrame, wxFrame) | |
a23fd0e1 | 140 | EVT_SIZE(wxMDIParentFrame::OnSize) |
a23fd0e1 | 141 | EVT_SYS_COLOUR_CHANGED(wxMDIParentFrame::OnSysColourChanged) |
2bda0e17 KB |
142 | END_EVENT_TABLE() |
143 | ||
f6bcfd97 BP |
144 | BEGIN_EVENT_TABLE(wxMDIChildFrame, wxFrame) |
145 | EVT_IDLE(wxMDIChildFrame::OnIdle) | |
146 | END_EVENT_TABLE() | |
147 | ||
2bda0e17 | 148 | BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow) |
a23fd0e1 | 149 | EVT_SCROLL(wxMDIClientWindow::OnScroll) |
2bda0e17 KB |
150 | END_EVENT_TABLE() |
151 | ||
42e69d6b VZ |
152 | // =========================================================================== |
153 | // wxMDIParentFrame: the frame which contains the client window which manages | |
154 | // the children | |
155 | // =========================================================================== | |
2bda0e17 | 156 | |
c2dcfdef | 157 | wxMDIParentFrame::wxMDIParentFrame() |
2bda0e17 KB |
158 | { |
159 | m_clientWindow = NULL; | |
160 | m_currentChild = NULL; | |
df61c009 | 161 | m_windowMenu = (wxMenu*) NULL; |
4f8090e0 | 162 | m_parentFrameActive = true; |
2bda0e17 KB |
163 | } |
164 | ||
165 | bool wxMDIParentFrame::Create(wxWindow *parent, | |
a23fd0e1 VZ |
166 | wxWindowID id, |
167 | const wxString& title, | |
168 | const wxPoint& pos, | |
169 | const wxSize& size, | |
170 | long style, | |
171 | const wxString& name) | |
2bda0e17 | 172 | { |
2bda0e17 KB |
173 | m_clientWindow = NULL; |
174 | m_currentChild = NULL; | |
df61c009 | 175 | |
3d8dea7e VZ |
176 | // this style can be used to prevent a window from having the standard MDI |
177 | // "Window" menu | |
178 | if ( style & wxFRAME_NO_WINDOW_MENU ) | |
179 | { | |
180 | m_windowMenu = (wxMenu *)NULL; | |
181 | } | |
182 | else // normal case: we have the window menu, so construct it | |
df61c009 | 183 | { |
df61c009 JS |
184 | m_windowMenu = new wxMenu; |
185 | ||
b0a2157c VZ |
186 | m_windowMenu->Append(IDM_WINDOWCASCADE, _("&Cascade")); |
187 | m_windowMenu->Append(IDM_WINDOWTILEHOR, _("Tile &Horizontally")); | |
188 | m_windowMenu->Append(IDM_WINDOWTILEVERT, _("Tile &Vertically")); | |
df61c009 | 189 | m_windowMenu->AppendSeparator(); |
b0a2157c VZ |
190 | m_windowMenu->Append(IDM_WINDOWICONS, _("&Arrange Icons")); |
191 | m_windowMenu->Append(IDM_WINDOWNEXT, _("&Next")); | |
4f3b37fd | 192 | m_windowMenu->Append(IDM_WINDOWPREV, _("&Previous")); |
df61c009 JS |
193 | } |
194 | ||
4f8090e0 | 195 | m_parentFrameActive = true; |
2bda0e17 KB |
196 | |
197 | if (!parent) | |
198 | wxTopLevelWindows.Append(this); | |
199 | ||
200 | SetName(name); | |
201 | m_windowStyle = style; | |
202 | ||
b225f659 VZ |
203 | if ( parent ) |
204 | parent->AddChild(this); | |
2bda0e17 | 205 | |
598ddd96 | 206 | if ( id != wxID_ANY ) |
2bda0e17 KB |
207 | m_windowId = id; |
208 | else | |
b225f659 | 209 | m_windowId = NewControlId(); |
2bda0e17 | 210 | |
912c192f VZ |
211 | WXDWORD exflags; |
212 | WXDWORD msflags = MSWGetCreateWindowFlags(&exflags); | |
ea723360 JS |
213 | msflags &= ~WS_VSCROLL; |
214 | msflags &= ~WS_HSCROLL; | |
2bda0e17 | 215 | |
b225f659 | 216 | if ( !wxWindow::MSWCreate(wxMDIFrameClassName, |
3ca6a5f0 | 217 | title, |
b225f659 VZ |
218 | pos, size, |
219 | msflags, | |
220 | exflags) ) | |
3ca6a5f0 | 221 | { |
4f8090e0 | 222 | return false; |
3ca6a5f0 | 223 | } |
2bda0e17 | 224 | |
f6bcfd97 | 225 | // unlike (almost?) all other windows, frames are created hidden |
4f8090e0 | 226 | m_isShown = false; |
f6bcfd97 | 227 | |
4f8090e0 | 228 | return true; |
2bda0e17 KB |
229 | } |
230 | ||
c2dcfdef | 231 | wxMDIParentFrame::~wxMDIParentFrame() |
2bda0e17 | 232 | { |
d1e44484 | 233 | // see comment in ~wxMDIChildFrame |
1904aa72 | 234 | #if wxUSE_TOOLBAR |
f048e32f | 235 | m_frameToolBar = NULL; |
1904aa72 | 236 | #endif |
67a99992 | 237 | #if wxUSE_STATUSBAR |
c0bcc480 | 238 | m_frameStatusBar = NULL; |
67a99992 | 239 | #endif // wxUSE_STATUSBAR |
f048e32f | 240 | |
d1e44484 VZ |
241 | DestroyChildren(); |
242 | ||
df61c009 JS |
243 | if (m_windowMenu) |
244 | { | |
245 | delete m_windowMenu; | |
246 | m_windowMenu = (wxMenu*) NULL; | |
247 | } | |
2bda0e17 | 248 | |
4e152a23 VZ |
249 | // the MDI frame menubar is not automatically deleted by Windows unlike for |
250 | // the normal frames | |
251 | if ( m_hMenu ) | |
252 | { | |
253 | ::DestroyMenu((HMENU)m_hMenu); | |
7c46a16b | 254 | m_hMenu = (WXHMENU)NULL; |
4e152a23 VZ |
255 | } |
256 | ||
42e69d6b VZ |
257 | if ( m_clientWindow ) |
258 | { | |
259 | if ( m_clientWindow->MSWGetOldWndProc() ) | |
260 | m_clientWindow->UnsubclassWin(); | |
2bda0e17 | 261 | |
42e69d6b VZ |
262 | m_clientWindow->SetHWND(0); |
263 | delete m_clientWindow; | |
264 | } | |
2bda0e17 KB |
265 | } |
266 | ||
1e6feb95 VZ |
267 | #if wxUSE_MENUS_NATIVE |
268 | ||
42e69d6b | 269 | void wxMDIParentFrame::InternalSetMenuBar() |
2bda0e17 | 270 | { |
4f8090e0 | 271 | m_parentFrameActive = true; |
2bda0e17 | 272 | |
4e152a23 | 273 | InsertWindowMenu(GetClientWindow(), m_hMenu, GetMDIWindowMenu(this)); |
2bda0e17 KB |
274 | } |
275 | ||
1e6feb95 VZ |
276 | #endif // wxUSE_MENUS_NATIVE |
277 | ||
df61c009 JS |
278 | void wxMDIParentFrame::SetWindowMenu(wxMenu* menu) |
279 | { | |
280 | if (m_windowMenu) | |
281 | { | |
282 | if (GetMenuBar()) | |
283 | { | |
284 | // Remove old window menu | |
285 | RemoveWindowMenu(GetClientWindow(), m_hMenu); | |
286 | } | |
287 | ||
288 | delete m_windowMenu; | |
289 | m_windowMenu = (wxMenu*) NULL; | |
290 | } | |
4e152a23 | 291 | |
df61c009 JS |
292 | if (menu) |
293 | { | |
294 | m_windowMenu = menu; | |
295 | if (GetMenuBar()) | |
b0a2157c VZ |
296 | { |
297 | InsertWindowMenu(GetClientWindow(), m_hMenu, | |
88c49a0f | 298 | GetHmenuOf(m_windowMenu)); |
b0a2157c | 299 | } |
df61c009 JS |
300 | } |
301 | } | |
302 | ||
6aca4628 CE |
303 | void wxMDIParentFrame::DoMenuUpdates(wxMenu* menu) |
304 | { | |
305 | wxMDIChildFrame *child = GetActiveChild(); | |
306 | if ( child ) | |
307 | { | |
308 | wxEvtHandler* source = child->GetEventHandler(); | |
309 | wxMenuBar* bar = child->GetMenuBar(); | |
310 | ||
311 | if (menu) | |
312 | { | |
313 | menu->UpdateUI(source); | |
314 | } | |
315 | else | |
316 | { | |
317 | if ( bar != NULL ) | |
318 | { | |
319 | int nCount = bar->GetMenuCount(); | |
320 | for (int n = 0; n < nCount; n++) | |
321 | bar->GetMenu(n)->UpdateUI(source); | |
322 | } | |
323 | } | |
324 | } | |
325 | else | |
326 | { | |
327 | wxFrameBase::DoMenuUpdates(menu); | |
328 | } | |
329 | } | |
330 | ||
a967ef9d | 331 | void wxMDIParentFrame::OnSize(wxSizeEvent&) |
2bda0e17 | 332 | { |
2bda0e17 | 333 | if ( GetClientWindow() ) |
42e69d6b VZ |
334 | { |
335 | int width, height; | |
336 | GetClientSize(&width, &height); | |
2bda0e17 | 337 | |
42e69d6b VZ |
338 | GetClientWindow()->SetSize(0, 0, width, height); |
339 | } | |
2bda0e17 KB |
340 | } |
341 | ||
2bda0e17 | 342 | // Returns the active MDI child window |
c2dcfdef | 343 | wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const |
2bda0e17 | 344 | { |
a23fd0e1 VZ |
345 | HWND hWnd = (HWND)::SendMessage(GetWinHwnd(GetClientWindow()), |
346 | WM_MDIGETACTIVE, 0, 0L); | |
347 | if ( hWnd == 0 ) | |
348 | return NULL; | |
349 | else | |
350 | return (wxMDIChildFrame *)wxFindWinFromHandle((WXHWND) hWnd); | |
2bda0e17 KB |
351 | } |
352 | ||
a23fd0e1 VZ |
353 | // Create the client window class (don't Create the window, just return a new |
354 | // class) | |
c2dcfdef | 355 | wxMDIClientWindow *wxMDIParentFrame::OnCreateClient() |
2bda0e17 | 356 | { |
a23fd0e1 | 357 | return new wxMDIClientWindow; |
2bda0e17 KB |
358 | } |
359 | ||
360 | // Responds to colour changes, and passes event on to children. | |
361 | void wxMDIParentFrame::OnSysColourChanged(wxSysColourChangedEvent& event) | |
362 | { | |
363 | if ( m_clientWindow ) | |
364 | { | |
a756f210 | 365 | m_clientWindow->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); |
2bda0e17 KB |
366 | m_clientWindow->Refresh(); |
367 | } | |
2bda0e17 | 368 | |
42e69d6b | 369 | event.Skip(); |
2bda0e17 KB |
370 | } |
371 | ||
82c9f85c VZ |
372 | WXHICON wxMDIParentFrame::GetDefaultIcon() const |
373 | { | |
94826170 VZ |
374 | // we don't have any standard icons (any more) |
375 | return (WXHICON)0; | |
82c9f85c VZ |
376 | } |
377 | ||
42e69d6b | 378 | // --------------------------------------------------------------------------- |
2bda0e17 | 379 | // MDI operations |
42e69d6b VZ |
380 | // --------------------------------------------------------------------------- |
381 | ||
c2dcfdef | 382 | void wxMDIParentFrame::Cascade() |
2bda0e17 | 383 | { |
a23fd0e1 | 384 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDICASCADE, 0, 0); |
2bda0e17 KB |
385 | } |
386 | ||
42e69d6b | 387 | // TODO: add a direction argument (hor/vert) |
c2dcfdef | 388 | void wxMDIParentFrame::Tile() |
2bda0e17 | 389 | { |
a23fd0e1 | 390 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDITILE, MDITILE_HORIZONTAL, 0); |
2bda0e17 KB |
391 | } |
392 | ||
c2dcfdef | 393 | void wxMDIParentFrame::ArrangeIcons() |
2bda0e17 | 394 | { |
a23fd0e1 | 395 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDIICONARRANGE, 0, 0); |
2bda0e17 KB |
396 | } |
397 | ||
c2dcfdef | 398 | void wxMDIParentFrame::ActivateNext() |
2bda0e17 | 399 | { |
a23fd0e1 | 400 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 0); |
2bda0e17 KB |
401 | } |
402 | ||
c2dcfdef | 403 | void wxMDIParentFrame::ActivatePrevious() |
2bda0e17 | 404 | { |
a23fd0e1 | 405 | ::SendMessage(GetWinHwnd(GetClientWindow()), WM_MDINEXT, 0, 1); |
2bda0e17 KB |
406 | } |
407 | ||
42e69d6b | 408 | // --------------------------------------------------------------------------- |
a23fd0e1 | 409 | // the MDI parent frame window proc |
42e69d6b VZ |
410 | // --------------------------------------------------------------------------- |
411 | ||
c140b7e7 | 412 | WXLRESULT wxMDIParentFrame::MSWWindowProc(WXUINT message, |
a23fd0e1 VZ |
413 | WXWPARAM wParam, |
414 | WXLPARAM lParam) | |
2bda0e17 | 415 | { |
c140b7e7 | 416 | WXLRESULT rc = 0; |
4f8090e0 | 417 | bool processed = false; |
2bda0e17 | 418 | |
a23fd0e1 VZ |
419 | switch ( message ) |
420 | { | |
42e69d6b VZ |
421 | case WM_ACTIVATE: |
422 | { | |
423 | WXWORD state, minimized; | |
424 | WXHWND hwnd; | |
425 | UnpackActivate(wParam, lParam, &state, &minimized, &hwnd); | |
426 | ||
427 | processed = HandleActivate(state, minimized != 0, hwnd); | |
428 | } | |
429 | break; | |
430 | ||
431 | case WM_COMMAND: | |
432 | { | |
433 | WXWORD id, cmd; | |
434 | WXHWND hwnd; | |
435 | UnpackCommand(wParam, lParam, &id, &hwnd, &cmd); | |
436 | ||
437 | (void)HandleCommand(id, cmd, hwnd); | |
438 | ||
439 | // even if the frame didn't process it, there is no need to try it | |
01ebf752 | 440 | // once again (i.e. call wxFrame::HandleCommand()) - we just did it, |
42e69d6b | 441 | // so pretend we processed the message anyhow |
4f8090e0 | 442 | processed = true; |
42e69d6b | 443 | } |
b3818fbe VZ |
444 | |
445 | // always pass this message DefFrameProc(), otherwise MDI menu | |
01ebf752 | 446 | // commands (and sys commands - more surprisingly!) won't work |
b3818fbe | 447 | MSWDefWindowProc(message, wParam, lParam); |
42e69d6b VZ |
448 | break; |
449 | ||
a23fd0e1 VZ |
450 | case WM_CREATE: |
451 | m_clientWindow = OnCreateClient(); | |
452 | // Uses own style for client style | |
453 | if ( !m_clientWindow->CreateClient(this, GetWindowStyleFlag()) ) | |
454 | { | |
455 | wxLogMessage(_("Failed to create MDI parent frame.")); | |
2bda0e17 | 456 | |
a23fd0e1 VZ |
457 | rc = -1; |
458 | } | |
2bda0e17 | 459 | |
4f8090e0 | 460 | processed = true; |
a23fd0e1 | 461 | break; |
2bda0e17 | 462 | |
a23fd0e1 | 463 | case WM_ERASEBKGND: |
4f8090e0 | 464 | processed = true; |
2bda0e17 | 465 | |
a23fd0e1 | 466 | // we erase background ourselves |
4f8090e0 | 467 | rc = true; |
a23fd0e1 VZ |
468 | break; |
469 | ||
470 | case WM_MENUSELECT: | |
471 | { | |
42e69d6b VZ |
472 | WXWORD item, flags; |
473 | WXHMENU hmenu; | |
474 | UnpackMenuSelect(wParam, lParam, &item, &flags, &hmenu); | |
475 | ||
a23fd0e1 VZ |
476 | if ( m_parentFrameActive ) |
477 | { | |
42e69d6b | 478 | processed = HandleMenuSelect(item, flags, hmenu); |
a23fd0e1 VZ |
479 | } |
480 | else if (m_currentChild) | |
481 | { | |
482 | processed = m_currentChild-> | |
42e69d6b | 483 | HandleMenuSelect(item, flags, hmenu); |
a23fd0e1 VZ |
484 | } |
485 | } | |
486 | break; | |
b3818fbe VZ |
487 | |
488 | case WM_SIZE: | |
0655ad29 VZ |
489 | // as we don't (usually) resize the MDI client to exactly fit the |
490 | // client area (we put it below the toolbar, above statusbar &c), | |
491 | // we should not pass this one to DefFrameProc | |
b3818fbe | 492 | break; |
a23fd0e1 | 493 | } |
2bda0e17 | 494 | |
a23fd0e1 VZ |
495 | if ( !processed ) |
496 | rc = wxFrame::MSWWindowProc(message, wParam, lParam); | |
2bda0e17 | 497 | |
a23fd0e1 | 498 | return rc; |
2bda0e17 KB |
499 | } |
500 | ||
42e69d6b | 501 | bool wxMDIParentFrame::HandleActivate(int state, bool minimized, WXHWND activate) |
2bda0e17 | 502 | { |
4f8090e0 | 503 | bool processed = false; |
a23fd0e1 | 504 | |
42e69d6b | 505 | if ( wxWindow::HandleActivate(state, minimized, activate) ) |
a23fd0e1 VZ |
506 | { |
507 | // already processed | |
4f8090e0 | 508 | processed = true; |
a23fd0e1 | 509 | } |
2bda0e17 KB |
510 | |
511 | // If this window is an MDI parent, we must also send an OnActivate message | |
512 | // to the current child. | |
42e69d6b | 513 | if ( (m_currentChild != NULL) && |
a23fd0e1 | 514 | ((state == WA_ACTIVE) || (state == WA_CLICKACTIVE)) ) |
c2dcfdef | 515 | { |
4f8090e0 | 516 | wxActivateEvent event(wxEVT_ACTIVATE, true, m_currentChild->GetId()); |
debe6624 | 517 | event.SetEventObject( m_currentChild ); |
a23fd0e1 | 518 | if ( m_currentChild->GetEventHandler()->ProcessEvent(event) ) |
4f8090e0 | 519 | processed = true; |
2bda0e17 | 520 | } |
a23fd0e1 VZ |
521 | |
522 | return processed; | |
2bda0e17 KB |
523 | } |
524 | ||
42e69d6b | 525 | bool wxMDIParentFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) |
2bda0e17 | 526 | { |
2bda0e17 | 527 | // In case it's e.g. a toolbar. |
42e69d6b | 528 | if ( hwnd ) |
e1a6fc11 | 529 | { |
42e69d6b VZ |
530 | wxWindow *win = wxFindWinFromHandle(hwnd); |
531 | if ( win ) | |
532 | return win->MSWCommand(cmd, id); | |
e1a6fc11 JS |
533 | } |
534 | ||
42e69d6b VZ |
535 | // is it one of standard MDI commands? |
536 | WXWPARAM wParam = 0; | |
4f3b37fd | 537 | WXLPARAM lParam = 0; |
42e69d6b VZ |
538 | int msg; |
539 | switch ( id ) | |
2bda0e17 | 540 | { |
42e69d6b VZ |
541 | case IDM_WINDOWCASCADE: |
542 | msg = WM_MDICASCADE; | |
543 | wParam = MDITILE_SKIPDISABLED; | |
544 | break; | |
545 | ||
546 | case IDM_WINDOWTILEHOR: | |
547 | wParam |= MDITILE_HORIZONTAL; | |
548 | // fall through | |
549 | ||
550 | case IDM_WINDOWTILEVERT: | |
551 | if ( !wParam ) | |
552 | wParam = MDITILE_VERTICAL; | |
553 | msg = WM_MDITILE; | |
554 | wParam |= MDITILE_SKIPDISABLED; | |
555 | break; | |
556 | ||
557 | case IDM_WINDOWICONS: | |
558 | msg = WM_MDIICONARRANGE; | |
559 | break; | |
560 | ||
561 | case IDM_WINDOWNEXT: | |
562 | msg = WM_MDINEXT; | |
4f3b37fd JS |
563 | lParam = 0; // next child |
564 | break; | |
565 | ||
566 | case IDM_WINDOWPREV: | |
567 | msg = WM_MDINEXT; | |
568 | lParam = 1; // previous child | |
42e69d6b VZ |
569 | break; |
570 | ||
571 | default: | |
572 | msg = 0; | |
2bda0e17 | 573 | } |
c2dcfdef | 574 | |
42e69d6b | 575 | if ( msg ) |
2bda0e17 | 576 | { |
4f3b37fd | 577 | ::SendMessage(GetWinHwnd(GetClientWindow()), msg, wParam, lParam); |
42e69d6b | 578 | |
4f8090e0 | 579 | return true; |
2bda0e17 | 580 | } |
42e69d6b VZ |
581 | |
582 | // FIXME VZ: what does this test do?? | |
583 | if (id >= 0xF000) | |
2bda0e17 | 584 | { |
4f8090e0 | 585 | return false; // Get WndProc to call default proc |
2bda0e17 | 586 | } |
42e69d6b VZ |
587 | |
588 | if ( IsMdiCommandId(id) ) | |
2bda0e17 | 589 | { |
222ed1d6 | 590 | wxWindowList::compatibility_iterator node = GetChildren().GetFirst(); |
42e69d6b | 591 | while ( node ) |
2bda0e17 | 592 | { |
d162a7ee | 593 | wxWindow *child = node->GetData(); |
42e69d6b | 594 | if ( child->GetHWND() ) |
2bda0e17 | 595 | { |
42e69d6b | 596 | long childId = wxGetWindowId(child->GetHWND()); |
48c12cb1 | 597 | if (childId == (long)id) |
42e69d6b VZ |
598 | { |
599 | ::SendMessage( GetWinHwnd(GetClientWindow()), | |
600 | WM_MDIACTIVATE, | |
601 | (WPARAM)child->GetHWND(), 0); | |
4f8090e0 | 602 | return true; |
42e69d6b | 603 | } |
2bda0e17 | 604 | } |
42e69d6b | 605 | node = node->GetNext(); |
2bda0e17 | 606 | } |
2bda0e17 | 607 | } |
42e69d6b | 608 | else if ( m_parentFrameActive ) |
2bda0e17 | 609 | { |
42e69d6b VZ |
610 | return ProcessCommand(id); |
611 | } | |
612 | else if ( m_currentChild ) | |
613 | { | |
614 | return m_currentChild->HandleCommand(id, cmd, hwnd); | |
615 | } | |
616 | else | |
617 | { | |
618 | // this shouldn't happen because it means that our messages are being | |
619 | // lost (they're not sent to the parent frame nor to the children) | |
f6bcfd97 | 620 | wxFAIL_MSG(wxT("MDI parent frame is not active, yet there is no active MDI child?")); |
2bda0e17 | 621 | } |
2bda0e17 | 622 | |
4f8090e0 | 623 | return false; |
2bda0e17 KB |
624 | } |
625 | ||
c140b7e7 | 626 | WXLRESULT wxMDIParentFrame::MSWDefWindowProc(WXUINT message, |
42e69d6b VZ |
627 | WXWPARAM wParam, |
628 | WXLPARAM lParam) | |
2bda0e17 | 629 | { |
c2dcfdef VZ |
630 | WXHWND clientWnd; |
631 | if ( GetClientWindow() ) | |
632 | clientWnd = GetClientWindow()->GetHWND(); | |
633 | else | |
634 | clientWnd = 0; | |
2bda0e17 | 635 | |
a23fd0e1 | 636 | return DefFrameProc(GetHwnd(), (HWND)clientWnd, message, wParam, lParam); |
2bda0e17 KB |
637 | } |
638 | ||
57a7b7c1 JS |
639 | bool wxMDIParentFrame::MSWTranslateMessage(WXMSG* msg) |
640 | { | |
a23fd0e1 | 641 | MSG *pMsg = (MSG *)msg; |
2bda0e17 | 642 | |
f6bcfd97 | 643 | // first let the current child get it |
a23fd0e1 VZ |
644 | if ( m_currentChild && m_currentChild->GetHWND() && |
645 | m_currentChild->MSWTranslateMessage(msg) ) | |
646 | { | |
4f8090e0 | 647 | return true; |
a23fd0e1 | 648 | } |
2bda0e17 | 649 | |
f6bcfd97 BP |
650 | // then try out accel table (will also check the menu accels) |
651 | if ( wxFrame::MSWTranslateMessage(msg) ) | |
a23fd0e1 | 652 | { |
4f8090e0 | 653 | return true; |
a23fd0e1 | 654 | } |
2bda0e17 | 655 | |
f6bcfd97 | 656 | // finally, check for MDI specific built in accel keys |
a23fd0e1 VZ |
657 | if ( pMsg->message == WM_KEYDOWN || pMsg->message == WM_SYSKEYDOWN ) |
658 | { | |
659 | if ( ::TranslateMDISysAccel(GetWinHwnd(GetClientWindow()), pMsg)) | |
4f8090e0 | 660 | return true; |
a23fd0e1 | 661 | } |
57a7b7c1 | 662 | |
4f8090e0 | 663 | return false; |
2bda0e17 KB |
664 | } |
665 | ||
42e69d6b | 666 | // =========================================================================== |
a23fd0e1 | 667 | // wxMDIChildFrame |
42e69d6b | 668 | // =========================================================================== |
2bda0e17 | 669 | |
f6bcfd97 | 670 | void wxMDIChildFrame::Init() |
2bda0e17 | 671 | { |
4f8090e0 | 672 | m_needsResize = true; |
2596e9fb | 673 | m_needsInitialShow = true; |
2bda0e17 KB |
674 | } |
675 | ||
676 | bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, | |
a23fd0e1 VZ |
677 | wxWindowID id, |
678 | const wxString& title, | |
679 | const wxPoint& pos, | |
680 | const wxSize& size, | |
681 | long style, | |
682 | const wxString& name) | |
2bda0e17 | 683 | { |
2bda0e17 KB |
684 | SetName(name); |
685 | ||
598ddd96 | 686 | if ( id != wxID_ANY ) |
2bda0e17 KB |
687 | m_windowId = id; |
688 | else | |
689 | m_windowId = (int)NewControlId(); | |
690 | ||
42e69d6b VZ |
691 | if ( parent ) |
692 | { | |
693 | parent->AddChild(this); | |
694 | } | |
2bda0e17 | 695 | |
2bda0e17 KB |
696 | int x = pos.x; |
697 | int y = pos.y; | |
698 | int width = size.x; | |
699 | int height = size.y; | |
700 | ||
701 | MDICREATESTRUCT mcs; | |
c2dcfdef | 702 | |
e441e1f4 VZ |
703 | mcs.szClass = style & wxFULL_REPAINT_ON_RESIZE |
704 | ? wxMDIChildFrameClassName | |
705 | : wxMDIChildFrameClassNameNoRedraw; | |
2bda0e17 KB |
706 | mcs.szTitle = title; |
707 | mcs.hOwner = wxGetInstance(); | |
598ddd96 | 708 | if (x != wxDefaultCoord) |
42e69d6b VZ |
709 | mcs.x = x; |
710 | else | |
711 | mcs.x = CW_USEDEFAULT; | |
2bda0e17 | 712 | |
598ddd96 | 713 | if (y != wxDefaultCoord) |
42e69d6b VZ |
714 | mcs.y = y; |
715 | else | |
716 | mcs.y = CW_USEDEFAULT; | |
2bda0e17 | 717 | |
598ddd96 | 718 | if (width != wxDefaultCoord) |
42e69d6b VZ |
719 | mcs.cx = width; |
720 | else | |
721 | mcs.cx = CW_USEDEFAULT; | |
2bda0e17 | 722 | |
598ddd96 | 723 | if (height != wxDefaultCoord) |
42e69d6b VZ |
724 | mcs.cy = height; |
725 | else | |
726 | mcs.cy = CW_USEDEFAULT; | |
2bda0e17 | 727 | |
2596e9fb | 728 | DWORD msflags = WS_OVERLAPPED | WS_CLIPCHILDREN; |
2bda0e17 KB |
729 | if (style & wxMINIMIZE_BOX) |
730 | msflags |= WS_MINIMIZEBOX; | |
731 | if (style & wxMAXIMIZE_BOX) | |
732 | msflags |= WS_MAXIMIZEBOX; | |
733 | if (style & wxTHICK_FRAME) | |
734 | msflags |= WS_THICKFRAME; | |
735 | if (style & wxSYSTEM_MENU) | |
736 | msflags |= WS_SYSMENU; | |
737 | if ((style & wxMINIMIZE) || (style & wxICONIZE)) | |
738 | msflags |= WS_MINIMIZE; | |
739 | if (style & wxMAXIMIZE) | |
740 | msflags |= WS_MAXIMIZE; | |
741 | if (style & wxCAPTION) | |
742 | msflags |= WS_CAPTION; | |
743 | ||
744 | mcs.style = msflags; | |
745 | ||
746 | mcs.lParam = 0; | |
747 | ||
b225f659 VZ |
748 | wxWindowCreationHook hook(this); |
749 | ||
3ca6a5f0 BP |
750 | m_hWnd = (WXHWND)::SendMessage(GetWinHwnd(parent->GetClientWindow()), |
751 | WM_MDICREATE, 0, (LONG)(LPSTR)&mcs); | |
2bda0e17 | 752 | |
c7527e3f | 753 | wxAssociateWinWithHandle((HWND) GetHWND(), this); |
2bda0e17 | 754 | |
4f8090e0 | 755 | return true; |
2bda0e17 KB |
756 | } |
757 | ||
c2dcfdef | 758 | wxMDIChildFrame::~wxMDIChildFrame() |
2bda0e17 | 759 | { |
d1e44484 VZ |
760 | // will be destroyed by DestroyChildren() but reset them before calling it |
761 | // to avoid using dangling pointers if a callback comes in the meanwhile | |
1904aa72 | 762 | #if wxUSE_TOOLBAR |
627a3091 | 763 | m_frameToolBar = NULL; |
1904aa72 | 764 | #endif |
67a99992 | 765 | #if wxUSE_STATUSBAR |
627a3091 | 766 | m_frameStatusBar = NULL; |
67a99992 | 767 | #endif // wxUSE_STATUSBAR |
627a3091 | 768 | |
d1e44484 VZ |
769 | DestroyChildren(); |
770 | ||
4e152a23 VZ |
771 | RemoveWindowMenu(NULL, m_hMenu); |
772 | ||
c2dcfdef | 773 | MSWDestroyWindow(); |
2bda0e17 KB |
774 | } |
775 | ||
2596e9fb VS |
776 | bool wxMDIChildFrame::Show(bool show) |
777 | { | |
778 | m_needsInitialShow = false; | |
779 | return wxFrame::Show(show); | |
780 | } | |
781 | ||
2bda0e17 | 782 | // Set the client size (i.e. leave the calculation of borders etc. |
77ffb593 | 783 | // to wxWidgets) |
cc2b7472 | 784 | void wxMDIChildFrame::DoSetClientSize(int width, int height) |
2bda0e17 | 785 | { |
b3818fbe | 786 | HWND hWnd = GetHwnd(); |
2bda0e17 KB |
787 | |
788 | RECT rect; | |
2de8030d | 789 | ::GetClientRect(hWnd, &rect); |
2bda0e17 KB |
790 | |
791 | RECT rect2; | |
792 | GetWindowRect(hWnd, &rect2); | |
793 | ||
794 | // Find the difference between the entire window (title bar and all) | |
795 | // and the client area; add this to the new client size to move the | |
796 | // window | |
797 | int actual_width = rect2.right - rect2.left - rect.right + width; | |
798 | int actual_height = rect2.bottom - rect2.top - rect.bottom + height; | |
799 | ||
67a99992 | 800 | #if wxUSE_STATUSBAR |
a2327a9f | 801 | if (GetStatusBar() && GetStatusBar()->IsShown()) |
2bda0e17 | 802 | { |
c2dcfdef VZ |
803 | int sx, sy; |
804 | GetStatusBar()->GetSize(&sx, &sy); | |
2bda0e17 KB |
805 | actual_height += sy; |
806 | } | |
67a99992 | 807 | #endif // wxUSE_STATUSBAR |
2bda0e17 KB |
808 | |
809 | POINT point; | |
810 | point.x = rect2.left; | |
811 | point.y = rect2.top; | |
812 | ||
813 | // If there's an MDI parent, must subtract the parent's top left corner | |
814 | // since MoveWindow moves relative to the parent | |
815 | wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); | |
816 | ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); | |
817 | ||
4f8090e0 | 818 | MoveWindow(hWnd, point.x, point.y, actual_width, actual_height, (BOOL)true); |
debe6624 | 819 | |
2bda0e17 | 820 | wxSizeEvent event(wxSize(width, height), m_windowId); |
debe6624 | 821 | event.SetEventObject( this ); |
2bda0e17 | 822 | GetEventHandler()->ProcessEvent(event); |
2bda0e17 KB |
823 | } |
824 | ||
cc2b7472 | 825 | void wxMDIChildFrame::DoGetPosition(int *x, int *y) const |
2bda0e17 KB |
826 | { |
827 | RECT rect; | |
b3818fbe | 828 | GetWindowRect(GetHwnd(), &rect); |
2bda0e17 KB |
829 | POINT point; |
830 | point.x = rect.left; | |
831 | point.y = rect.top; | |
832 | ||
833 | // Since we now have the absolute screen coords, | |
834 | // if there's a parent we must subtract its top left corner | |
835 | wxMDIParentFrame *mdiParent = (wxMDIParentFrame *)GetParent(); | |
836 | ::ScreenToClient((HWND) mdiParent->GetClientWindow()->GetHWND(), &point); | |
837 | ||
838 | *x = point.x; | |
839 | *y = point.y; | |
840 | } | |
841 | ||
42e69d6b | 842 | void wxMDIChildFrame::InternalSetMenuBar() |
2bda0e17 | 843 | { |
42e69d6b | 844 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 845 | |
4e152a23 VZ |
846 | InsertWindowMenu(parent->GetClientWindow(), |
847 | m_hMenu, GetMDIWindowMenu(parent)); | |
2bda0e17 | 848 | |
4f8090e0 | 849 | parent->m_parentFrameActive = false; |
2bda0e17 KB |
850 | } |
851 | ||
82c9f85c VZ |
852 | WXHICON wxMDIChildFrame::GetDefaultIcon() const |
853 | { | |
94826170 VZ |
854 | // we don't have any standard icons (any more) |
855 | return (WXHICON)0; | |
82c9f85c VZ |
856 | } |
857 | ||
42e69d6b | 858 | // --------------------------------------------------------------------------- |
2bda0e17 | 859 | // MDI operations |
42e69d6b VZ |
860 | // --------------------------------------------------------------------------- |
861 | ||
9b73db3c | 862 | void wxMDIChildFrame::Maximize(bool maximize) |
2bda0e17 KB |
863 | { |
864 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
865 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
866 | { |
867 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), | |
868 | maximize ? WM_MDIMAXIMIZE : WM_MDIRESTORE, | |
869 | (WPARAM)GetHwnd(), 0); | |
870 | } | |
2bda0e17 KB |
871 | } |
872 | ||
c2dcfdef | 873 | void wxMDIChildFrame::Restore() |
2bda0e17 KB |
874 | { |
875 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
876 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
877 | { |
878 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIRESTORE, | |
879 | (WPARAM) GetHwnd(), 0); | |
880 | } | |
2bda0e17 KB |
881 | } |
882 | ||
c2dcfdef | 883 | void wxMDIChildFrame::Activate() |
2bda0e17 KB |
884 | { |
885 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); | |
886 | if ( parent && parent->GetClientWindow() ) | |
9b73db3c VZ |
887 | { |
888 | ::SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIACTIVATE, | |
889 | (WPARAM) GetHwnd(), 0); | |
890 | } | |
2bda0e17 KB |
891 | } |
892 | ||
42e69d6b VZ |
893 | // --------------------------------------------------------------------------- |
894 | // MDI window proc and message handlers | |
895 | // --------------------------------------------------------------------------- | |
896 | ||
c140b7e7 | 897 | WXLRESULT wxMDIChildFrame::MSWWindowProc(WXUINT message, |
42e69d6b VZ |
898 | WXWPARAM wParam, |
899 | WXLPARAM lParam) | |
900 | { | |
c140b7e7 | 901 | WXLRESULT rc = 0; |
4f8090e0 | 902 | bool processed = false; |
42e69d6b VZ |
903 | |
904 | switch ( message ) | |
905 | { | |
906 | case WM_COMMAND: | |
907 | { | |
908 | WORD id, cmd; | |
909 | WXHWND hwnd; | |
910 | UnpackCommand((WXWPARAM)wParam, (WXLPARAM)lParam, | |
911 | &id, &hwnd, &cmd); | |
912 | ||
913 | processed = HandleCommand(id, cmd, (WXHWND)hwnd); | |
914 | } | |
915 | break; | |
916 | ||
42e69d6b | 917 | case WM_GETMINMAXINFO: |
3ebcfb76 VZ |
918 | processed = HandleGetMinMaxInfo((MINMAXINFO *)lParam); |
919 | break; | |
42e69d6b VZ |
920 | |
921 | case WM_MDIACTIVATE: | |
922 | { | |
923 | WXWORD act; | |
924 | WXHWND hwndAct, hwndDeact; | |
925 | UnpackMDIActivate(wParam, lParam, &act, &hwndAct, &hwndDeact); | |
926 | ||
927 | processed = HandleMDIActivate(act, hwndAct, hwndDeact); | |
928 | } | |
b3818fbe VZ |
929 | // fall through |
930 | ||
931 | case WM_MOVE: | |
932 | // must pass WM_MOVE to DefMDIChildProc() to recalculate MDI client | |
933 | // scrollbars if necessary | |
934 | ||
935 | // fall through | |
936 | ||
937 | case WM_SIZE: | |
938 | // must pass WM_SIZE to DefMDIChildProc(), otherwise many weird | |
939 | // things happen | |
940 | MSWDefWindowProc(message, wParam, lParam); | |
42e69d6b VZ |
941 | break; |
942 | ||
b3818fbe VZ |
943 | case WM_SYSCOMMAND: |
944 | // DefMDIChildProc handles SC_{NEXT/PREV}WINDOW here, so pass it | |
945 | // the message (the base class version does not) | |
946 | return MSWDefWindowProc(message, wParam, lParam); | |
947 | ||
42e69d6b VZ |
948 | case WM_WINDOWPOSCHANGING: |
949 | processed = HandleWindowPosChanging((LPWINDOWPOS)lParam); | |
950 | break; | |
951 | } | |
952 | ||
953 | if ( !processed ) | |
954 | rc = wxFrame::MSWWindowProc(message, wParam, lParam); | |
955 | ||
956 | return rc; | |
957 | } | |
958 | ||
42e69d6b | 959 | bool wxMDIChildFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND hwnd) |
2bda0e17 | 960 | { |
2bda0e17 | 961 | // In case it's e.g. a toolbar. |
42e69d6b VZ |
962 | if ( hwnd ) |
963 | { | |
964 | wxWindow *win = wxFindWinFromHandle(hwnd); | |
965 | if (win) | |
966 | return win->MSWCommand(cmd, id); | |
967 | } | |
2bda0e17 | 968 | |
e1a6fc11 JS |
969 | if (wxCurrentPopupMenu) |
970 | { | |
971 | wxMenu *popupMenu = wxCurrentPopupMenu; | |
972 | wxCurrentPopupMenu = NULL; | |
973 | if (popupMenu->MSWCommand(cmd, id)) | |
4f8090e0 | 974 | return true; |
e1a6fc11 JS |
975 | } |
976 | ||
3ca6a5f0 | 977 | bool processed; |
dd60b9ec | 978 | if (GetMenuBar() && GetMenuBar()->FindItem(id)) |
2bda0e17 | 979 | { |
3ca6a5f0 | 980 | processed = ProcessCommand(id); |
2bda0e17 KB |
981 | } |
982 | else | |
3ca6a5f0 | 983 | { |
4f8090e0 | 984 | processed = false; |
3ca6a5f0 | 985 | } |
42e69d6b | 986 | |
3ca6a5f0 | 987 | return processed; |
2bda0e17 KB |
988 | } |
989 | ||
42e69d6b VZ |
990 | bool wxMDIChildFrame::HandleMDIActivate(long WXUNUSED(activate), |
991 | WXHWND hwndAct, | |
992 | WXHWND hwndDeact) | |
2bda0e17 | 993 | { |
42e69d6b | 994 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 995 | |
42e69d6b | 996 | HMENU menuToSet = 0; |
57a7b7c1 | 997 | |
42e69d6b | 998 | bool activated; |
57a7b7c1 | 999 | |
42e69d6b VZ |
1000 | if ( m_hWnd == hwndAct ) |
1001 | { | |
4f8090e0 | 1002 | activated = true; |
42e69d6b | 1003 | parent->m_currentChild = this; |
2bda0e17 | 1004 | |
42e69d6b VZ |
1005 | HMENU child_menu = (HMENU)GetWinMenu(); |
1006 | if ( child_menu ) | |
1007 | { | |
4f8090e0 | 1008 | parent->m_parentFrameActive = false; |
2bda0e17 | 1009 | |
42e69d6b VZ |
1010 | menuToSet = child_menu; |
1011 | } | |
1012 | } | |
1013 | else if ( m_hWnd == hwndDeact ) | |
2bda0e17 | 1014 | { |
42e69d6b | 1015 | wxASSERT_MSG( parent->m_currentChild == this, |
223d09f6 | 1016 | wxT("can't deactivate MDI child which wasn't active!") ); |
42e69d6b | 1017 | |
4f8090e0 | 1018 | activated = false; |
42e69d6b | 1019 | parent->m_currentChild = NULL; |
2bda0e17 | 1020 | |
42e69d6b | 1021 | HMENU parent_menu = (HMENU)parent->GetWinMenu(); |
f4075804 VZ |
1022 | |
1023 | // activate the the parent menu only when there is no other child | |
1024 | // that has been activated | |
1025 | if ( parent_menu && !hwndAct ) | |
42e69d6b | 1026 | { |
4f8090e0 | 1027 | parent->m_parentFrameActive = true; |
42e69d6b VZ |
1028 | |
1029 | menuToSet = parent_menu; | |
1030 | } | |
1031 | } | |
1032 | else | |
1033 | { | |
18d2e170 | 1034 | // we have nothing to do with it |
4f8090e0 | 1035 | return false; |
2bda0e17 | 1036 | } |
debe6624 | 1037 | |
42e69d6b VZ |
1038 | if ( menuToSet ) |
1039 | { | |
4e152a23 VZ |
1040 | MDISetMenu(parent->GetClientWindow(), |
1041 | menuToSet, GetMDIWindowMenu(parent)); | |
42e69d6b VZ |
1042 | } |
1043 | ||
1044 | wxActivateEvent event(wxEVT_ACTIVATE, activated, m_windowId); | |
debe6624 | 1045 | event.SetEventObject( this ); |
2bda0e17 | 1046 | |
c03b48d7 GT |
1047 | ResetWindowStyle((void *)NULL); |
1048 | ||
42e69d6b VZ |
1049 | return GetEventHandler()->ProcessEvent(event); |
1050 | } | |
1051 | ||
1052 | bool wxMDIChildFrame::HandleWindowPosChanging(void *pos) | |
1053 | { | |
1054 | WINDOWPOS *lpPos = (WINDOWPOS *)pos; | |
1055 | #if defined(__WIN95__) | |
1056 | if (!(lpPos->flags & SWP_NOSIZE)) | |
2bda0e17 | 1057 | { |
42e69d6b | 1058 | RECT rectClient; |
b3818fbe VZ |
1059 | DWORD dwExStyle = ::GetWindowLong(GetHwnd(), GWL_EXSTYLE); |
1060 | DWORD dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); | |
42e69d6b VZ |
1061 | if (ResetWindowStyle((void *) & rectClient) && (dwStyle & WS_MAXIMIZE)) |
1062 | { | |
4f8090e0 | 1063 | ::AdjustWindowRectEx(&rectClient, dwStyle, false, dwExStyle); |
42e69d6b VZ |
1064 | lpPos->x = rectClient.left; |
1065 | lpPos->y = rectClient.top; | |
1066 | lpPos->cx = rectClient.right - rectClient.left; | |
1067 | lpPos->cy = rectClient.bottom - rectClient.top; | |
1068 | } | |
1904aa72 | 1069 | #if wxUSE_TOOLBAR |
42e69d6b | 1070 | wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent(); |
a2327a9f | 1071 | if (pFrameWnd && pFrameWnd->GetToolBar() && pFrameWnd->GetToolBar()->IsShown()) |
42e69d6b VZ |
1072 | { |
1073 | pFrameWnd->GetToolBar()->Refresh(); | |
1074 | } | |
1904aa72 | 1075 | #endif |
42e69d6b VZ |
1076 | } |
1077 | #endif // Win95 | |
1078 | ||
4f8090e0 | 1079 | return false; |
42e69d6b VZ |
1080 | } |
1081 | ||
3ebcfb76 VZ |
1082 | bool wxMDIChildFrame::HandleGetMinMaxInfo(void *mmInfo) |
1083 | { | |
1084 | MINMAXINFO *info = (MINMAXINFO *)mmInfo; | |
1085 | ||
1086 | // let the default window proc calculate the size of MDI children | |
1087 | // frames because it is based on the size of the MDI client window, | |
1088 | // not on the values specified in wxWindow m_max variables | |
d9f9aa2d | 1089 | bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo) != 0; |
3ebcfb76 | 1090 | |
e7dda1ff VS |
1091 | int minWidth = GetMinWidth(), |
1092 | minHeight = GetMinHeight(); | |
1093 | ||
3ebcfb76 | 1094 | // but allow GetSizeHints() to set the min size |
e7dda1ff | 1095 | if ( minWidth != -1 ) |
3ebcfb76 | 1096 | { |
e7dda1ff | 1097 | info->ptMinTrackSize.x = minWidth; |
3ebcfb76 | 1098 | |
4f8090e0 | 1099 | processed = true; |
3ebcfb76 VZ |
1100 | } |
1101 | ||
e7dda1ff | 1102 | if ( minHeight != -1 ) |
3ebcfb76 | 1103 | { |
e7dda1ff | 1104 | info->ptMinTrackSize.y = minHeight; |
3ebcfb76 | 1105 | |
4f8090e0 | 1106 | processed = true; |
3ebcfb76 VZ |
1107 | } |
1108 | ||
4c9d78a4 | 1109 | return processed; |
3ebcfb76 VZ |
1110 | } |
1111 | ||
42e69d6b VZ |
1112 | // --------------------------------------------------------------------------- |
1113 | // MDI specific message translation/preprocessing | |
1114 | // --------------------------------------------------------------------------- | |
2bda0e17 | 1115 | |
c140b7e7 | 1116 | WXLRESULT wxMDIChildFrame::MSWDefWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) |
42e69d6b VZ |
1117 | { |
1118 | return DefMDIChildProc(GetHwnd(), | |
1119 | (UINT)message, (WPARAM)wParam, (LPARAM)lParam); | |
1120 | } | |
1121 | ||
1122 | bool wxMDIChildFrame::MSWTranslateMessage(WXMSG* msg) | |
1123 | { | |
5a2762f0 | 1124 | return wxFrame::MSWTranslateMessage(msg); |
2bda0e17 KB |
1125 | } |
1126 | ||
42e69d6b VZ |
1127 | // --------------------------------------------------------------------------- |
1128 | // misc | |
1129 | // --------------------------------------------------------------------------- | |
1130 | ||
c2dcfdef | 1131 | void wxMDIChildFrame::MSWDestroyWindow() |
2bda0e17 | 1132 | { |
b3818fbe | 1133 | invalidHandle = GetHwnd(); |
2bda0e17 | 1134 | |
42e69d6b | 1135 | wxMDIParentFrame *parent = (wxMDIParentFrame *)GetParent(); |
2bda0e17 | 1136 | |
42e69d6b VZ |
1137 | // Must make sure this handle is invalidated (set to NULL) since all sorts |
1138 | // of things could happen after the child client is destroyed, but before | |
1139 | // the wxFrame is destroyed. | |
2bda0e17 | 1140 | |
42e69d6b | 1141 | HWND oldHandle = (HWND)GetHWND(); |
b3818fbe VZ |
1142 | SendMessage(GetWinHwnd(parent->GetClientWindow()), WM_MDIDESTROY, |
1143 | (WPARAM)oldHandle, 0); | |
18d2e170 JS |
1144 | |
1145 | if (parent->GetActiveChild() == (wxMDIChildFrame*) NULL) | |
1146 | ResetWindowStyle((void*) NULL); | |
1147 | ||
42e69d6b | 1148 | invalidHandle = 0; |
2bda0e17 | 1149 | |
42e69d6b VZ |
1150 | if (m_hMenu) |
1151 | { | |
1152 | ::DestroyMenu((HMENU) m_hMenu); | |
1153 | m_hMenu = 0; | |
1154 | } | |
ac6482e0 | 1155 | wxRemoveHandleAssociation(this); |
42e69d6b | 1156 | m_hWnd = 0; |
2bda0e17 KB |
1157 | } |
1158 | ||
42e69d6b VZ |
1159 | // Change the client window's extended style so we don't get a client edge |
1160 | // style when a child is maximised (a double border looks silly.) | |
2bda0e17 KB |
1161 | bool wxMDIChildFrame::ResetWindowStyle(void *vrect) |
1162 | { | |
1163 | #if defined(__WIN95__) | |
1164 | RECT *rect = (RECT *)vrect; | |
c2dcfdef VZ |
1165 | wxMDIParentFrame* pFrameWnd = (wxMDIParentFrame *)GetParent(); |
1166 | wxMDIChildFrame* pChild = pFrameWnd->GetActiveChild(); | |
1167 | if (!pChild || (pChild == this)) | |
1168 | { | |
47ca6bfb | 1169 | HWND hwndClient = GetWinHwnd(pFrameWnd->GetClientWindow()); |
8082a771 VZ |
1170 | DWORD dwStyle = ::GetWindowLong(hwndClient, GWL_EXSTYLE); |
1171 | ||
1172 | // we want to test whether there is a maximized child, so just set | |
1173 | // dwThisStyle to 0 if there is no child at all | |
1174 | DWORD dwThisStyle = pChild | |
1f3943e0 | 1175 | ? ::GetWindowLong(GetWinHwnd(pChild), GWL_STYLE) : 0; |
c2dcfdef | 1176 | DWORD dwNewStyle = dwStyle; |
8082a771 | 1177 | if ( dwThisStyle & WS_MAXIMIZE ) |
c2dcfdef VZ |
1178 | dwNewStyle &= ~(WS_EX_CLIENTEDGE); |
1179 | else | |
1180 | dwNewStyle |= WS_EX_CLIENTEDGE; | |
1181 | ||
1182 | if (dwStyle != dwNewStyle) | |
1183 | { | |
47ca6bfb VZ |
1184 | // force update of everything |
1185 | ::RedrawWindow(hwndClient, NULL, NULL, | |
1186 | RDW_INVALIDATE | RDW_ALLCHILDREN); | |
1187 | ::SetWindowLong(hwndClient, GWL_EXSTYLE, dwNewStyle); | |
1188 | ::SetWindowPos(hwndClient, NULL, 0, 0, 0, 0, | |
42e69d6b VZ |
1189 | SWP_FRAMECHANGED | SWP_NOACTIVATE | |
1190 | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | | |
1191 | SWP_NOCOPYBITS); | |
c2dcfdef | 1192 | if (rect) |
47ca6bfb | 1193 | ::GetClientRect(hwndClient, rect); |
2bda0e17 | 1194 | |
4f8090e0 | 1195 | return true; |
2bda0e17 | 1196 | } |
c2dcfdef | 1197 | } |
42e69d6b | 1198 | #endif // Win95 |
a23fd0e1 | 1199 | |
4f8090e0 | 1200 | return false; |
2bda0e17 KB |
1201 | } |
1202 | ||
42e69d6b VZ |
1203 | // =========================================================================== |
1204 | // wxMDIClientWindow: the window of predefined (by Windows) class which | |
1205 | // contains the child frames | |
1206 | // =========================================================================== | |
2bda0e17 | 1207 | |
debe6624 | 1208 | bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style) |
2bda0e17 | 1209 | { |
a756f210 | 1210 | m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE); |
2bda0e17 | 1211 | |
42e69d6b VZ |
1212 | CLIENTCREATESTRUCT ccs; |
1213 | m_windowStyle = style; | |
1214 | m_parent = parent; | |
c2dcfdef | 1215 | |
4e152a23 | 1216 | ccs.hWindowMenu = GetMDIWindowMenu(parent); |
42e69d6b | 1217 | ccs.idFirstChild = wxFIRST_MDI_CHILD; |
2bda0e17 | 1218 | |
5c44cd05 | 1219 | DWORD msStyle = MDIS_ALLCHILDSTYLES | WS_VISIBLE | WS_CHILD | |
b0766406 JS |
1220 | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; |
1221 | ||
42e69d6b VZ |
1222 | if ( style & wxHSCROLL ) |
1223 | msStyle |= WS_HSCROLL; | |
1224 | if ( style & wxVSCROLL ) | |
1225 | msStyle |= WS_VSCROLL; | |
2bda0e17 KB |
1226 | |
1227 | #if defined(__WIN95__) | |
42e69d6b | 1228 | DWORD exStyle = WS_EX_CLIENTEDGE; |
2bda0e17 | 1229 | #else |
42e69d6b | 1230 | DWORD exStyle = 0; |
2bda0e17 KB |
1231 | #endif |
1232 | ||
b225f659 | 1233 | wxWindowCreationHook hook(this); |
42e69d6b VZ |
1234 | m_hWnd = (WXHWND)::CreateWindowEx |
1235 | ( | |
1236 | exStyle, | |
223d09f6 | 1237 | wxT("MDICLIENT"), |
42e69d6b VZ |
1238 | NULL, |
1239 | msStyle, | |
1240 | 0, 0, 0, 0, | |
1241 | GetWinHwnd(parent), | |
1242 | NULL, | |
1243 | wxGetInstance(), | |
1244 | (LPSTR)(LPCLIENTCREATESTRUCT)&ccs); | |
1245 | if ( !m_hWnd ) | |
1246 | { | |
f6bcfd97 | 1247 | wxLogLastError(wxT("CreateWindowEx(MDI client)")); |
2bda0e17 | 1248 | |
4f8090e0 | 1249 | return false; |
42e69d6b | 1250 | } |
2bda0e17 | 1251 | |
42e69d6b | 1252 | SubclassWin(m_hWnd); |
2bda0e17 | 1253 | |
4f8090e0 | 1254 | return true; |
2bda0e17 KB |
1255 | } |
1256 | ||
1257 | // Explicitly call default scroll behaviour | |
1258 | void wxMDIClientWindow::OnScroll(wxScrollEvent& event) | |
1259 | { | |
1260 | // Note: for client windows, the scroll position is not set in | |
1261 | // WM_HSCROLL, WM_VSCROLL, so we can't easily determine what | |
1262 | // scroll position we're at. | |
1263 | // This makes it hard to paint patterns or bitmaps in the background, | |
1264 | // and have the client area scrollable as well. | |
1265 | ||
1266 | if ( event.GetOrientation() == wxHORIZONTAL ) | |
1267 | m_scrollX = event.GetPosition(); // Always returns zero! | |
1268 | else | |
1269 | m_scrollY = event.GetPosition(); // Always returns zero! | |
1270 | ||
42e69d6b VZ |
1271 | event.Skip(); |
1272 | } | |
1273 | ||
ec06b234 JS |
1274 | void wxMDIClientWindow::DoSetSize(int x, int y, int width, int height, int sizeFlags) |
1275 | { | |
1276 | // Try to fix a problem whereby if you show an MDI child frame, then reposition the | |
1277 | // client area, you can end up with a non-refreshed portion in the client window | |
1278 | // (see OGL studio sample). So check if the position is changed and if so, | |
1279 | // redraw the MDI child frames. | |
1280 | ||
1281 | wxPoint oldPos = GetPosition(); | |
1282 | ||
1283 | wxWindow::DoSetSize(x, y, width, height, sizeFlags); | |
1284 | ||
1285 | wxPoint newPos = GetPosition(); | |
1286 | ||
1287 | if ((newPos.x != oldPos.x) || (newPos.y != oldPos.y)) | |
1288 | { | |
1289 | if (GetParent()) | |
1290 | { | |
222ed1d6 | 1291 | wxWindowList::compatibility_iterator node = GetParent()->GetChildren().GetFirst(); |
ec06b234 JS |
1292 | while (node) |
1293 | { | |
d162a7ee | 1294 | wxWindow *child = node->GetData(); |
ec06b234 JS |
1295 | if (child->IsKindOf(CLASSINFO(wxMDIChildFrame))) |
1296 | { | |
d162a7ee VZ |
1297 | ::RedrawWindow(GetHwndOf(child), |
1298 | NULL, | |
1299 | NULL, | |
1300 | RDW_FRAME | | |
1301 | RDW_ALLCHILDREN | | |
1302 | RDW_INVALIDATE); | |
ec06b234 | 1303 | } |
4f8090e0 | 1304 | node = node->GetNext(); |
ec06b234 JS |
1305 | } |
1306 | } | |
1307 | } | |
1308 | } | |
1309 | ||
f6bcfd97 BP |
1310 | void wxMDIChildFrame::OnIdle(wxIdleEvent& event) |
1311 | { | |
2596e9fb VS |
1312 | // wxMSW prior to 2.5.3 created MDI child frames as visible, which resulted |
1313 | // in flicker e.g. when the frame contained controls with non-trivial | |
1314 | // layout. Since 2.5.3, the frame is created hidden as all other top level | |
1315 | // windows. In order to maintain backward compatibility, the frame is shown | |
1316 | // in OnIdle, unless Show(false) was called by the programmer before. | |
1317 | if ( m_needsInitialShow ) | |
1318 | { | |
1319 | Show(true); | |
1320 | } | |
1321 | ||
f6bcfd97 BP |
1322 | // MDI child frames get their WM_SIZE when they're constructed but at this |
1323 | // moment they don't have any children yet so all child windows will be | |
1324 | // positioned incorrectly when they are added later - to fix this, we | |
1325 | // generate an artificial size event here | |
1326 | if ( m_needsResize ) | |
1327 | { | |
4f8090e0 | 1328 | m_needsResize = false; // avoid any possibility of recursion |
f6bcfd97 BP |
1329 | |
1330 | SendSizeEvent(); | |
1331 | } | |
1332 | ||
1333 | event.Skip(); | |
1334 | } | |
1335 | ||
42e69d6b VZ |
1336 | // --------------------------------------------------------------------------- |
1337 | // non member functions | |
1338 | // --------------------------------------------------------------------------- | |
1339 | ||
1340 | static void MDISetMenu(wxWindow *win, HMENU hmenuFrame, HMENU hmenuWindow) | |
1341 | { | |
1342 | ::SendMessage(GetWinHwnd(win), WM_MDISETMENU, | |
1343 | #ifdef __WIN32__ | |
f6bcfd97 | 1344 | (WPARAM)hmenuFrame, (LPARAM)hmenuWindow |
42e69d6b | 1345 | #else |
f6bcfd97 | 1346 | 0, MAKELPARAM(hmenuFrame, hmenuWindow) |
42e69d6b | 1347 | #endif |
f6bcfd97 | 1348 | ); |
42e69d6b VZ |
1349 | |
1350 | // update menu bar of the parent window | |
1351 | wxWindow *parent = win->GetParent(); | |
223d09f6 | 1352 | wxCHECK_RET( parent, wxT("MDI client without parent frame? weird...") ); |
42e69d6b | 1353 | |
a967ef9d | 1354 | ::SendMessage(GetWinHwnd(win), WM_MDIREFRESHMENU, 0, 0L); |
788722ac | 1355 | |
42e69d6b VZ |
1356 | ::DrawMenuBar(GetWinHwnd(parent)); |
1357 | } | |
1358 | ||
1359 | static void InsertWindowMenu(wxWindow *win, WXHMENU menu, HMENU subMenu) | |
1360 | { | |
1361 | // Try to insert Window menu in front of Help, otherwise append it. | |
1362 | HMENU hmenu = (HMENU)menu; | |
df61c009 JS |
1363 | |
1364 | if (subMenu) | |
1365 | { | |
4e152a23 | 1366 | int N = GetMenuItemCount(hmenu); |
4f8090e0 | 1367 | bool success = false; |
4e152a23 | 1368 | for ( int i = 0; i < N; i++ ) |
42e69d6b | 1369 | { |
4e152a23 VZ |
1370 | wxChar buf[256]; |
1371 | int chars = GetMenuString(hmenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION); | |
1372 | if ( chars == 0 ) | |
1373 | { | |
1374 | wxLogLastError(wxT("GetMenuString")); | |
42e69d6b | 1375 | |
4e152a23 VZ |
1376 | continue; |
1377 | } | |
1378 | ||
1379 | if ( wxStripMenuCodes(wxString(buf)).IsSameAs(_("Help")) ) | |
1380 | { | |
4f8090e0 | 1381 | success = true; |
4e152a23 VZ |
1382 | ::InsertMenu(hmenu, i, MF_BYPOSITION | MF_POPUP | MF_STRING, |
1383 | (UINT)subMenu, _("&Window")); | |
1384 | break; | |
1385 | } | |
42e69d6b VZ |
1386 | } |
1387 | ||
4e152a23 | 1388 | if ( !success ) |
42e69d6b | 1389 | { |
4e152a23 | 1390 | ::AppendMenu(hmenu, MF_POPUP, (UINT)subMenu, _("&Window")); |
42e69d6b VZ |
1391 | } |
1392 | } | |
1393 | ||
42e69d6b VZ |
1394 | MDISetMenu(win, hmenu, subMenu); |
1395 | } | |
1396 | ||
df61c009 JS |
1397 | static void RemoveWindowMenu(wxWindow *win, WXHMENU menu) |
1398 | { | |
4e152a23 VZ |
1399 | HMENU hMenu = (HMENU)menu; |
1400 | ||
1401 | if ( hMenu ) | |
df61c009 | 1402 | { |
4e152a23 VZ |
1403 | wxChar buf[1024]; |
1404 | ||
1405 | int N = ::GetMenuItemCount(hMenu); | |
1406 | for ( int i = 0; i < N; i++ ) | |
df61c009 | 1407 | { |
4e152a23 VZ |
1408 | if ( !::GetMenuString(hMenu, i, buf, WXSIZEOF(buf), MF_BYPOSITION) ) |
1409 | { | |
2c62b3c3 VZ |
1410 | // Ignore successful read of menu string with length 0 which |
1411 | // occurs, for example, for a maximized MDI childs system menu | |
1412 | if ( ::GetLastError() != 0 ) | |
1413 | { | |
1414 | wxLogLastError(wxT("GetMenuString")); | |
1415 | } | |
df61c009 | 1416 | |
4e152a23 VZ |
1417 | continue; |
1418 | } | |
df61c009 | 1419 | |
4e152a23 VZ |
1420 | if ( wxStrcmp(buf, _("&Window")) == 0 ) |
1421 | { | |
1422 | if ( !::RemoveMenu(hMenu, i, MF_BYPOSITION) ) | |
1423 | { | |
1424 | wxLogLastError(wxT("RemoveMenu")); | |
1425 | } | |
1426 | ||
1427 | break; | |
1428 | } | |
df61c009 JS |
1429 | } |
1430 | } | |
1431 | ||
4e152a23 VZ |
1432 | if ( win ) |
1433 | { | |
1434 | // we don't change the windows menu, but we update the main one | |
1435 | MDISetMenu(win, hMenu, NULL); | |
1436 | } | |
df61c009 JS |
1437 | } |
1438 | ||
2917e920 BM |
1439 | static void UnpackMDIActivate(WXWPARAM wParam, WXLPARAM lParam, |
1440 | WXWORD *activate, WXHWND *hwndAct, WXHWND *hwndDeact) | |
42e69d6b | 1441 | { |
4f8090e0 | 1442 | *activate = true; |
42e69d6b VZ |
1443 | *hwndAct = (WXHWND)lParam; |
1444 | *hwndDeact = (WXHWND)wParam; | |
2bda0e17 | 1445 | } |
b9f933ab | 1446 | |
efd17a1d | 1447 | #endif // wxUSE_MDI && !defined(__WXUNIVERSAL__) |
b9f933ab | 1448 |