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