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