1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/aui/tabmdi.cpp
3 // Purpose: Generic MDI (Multiple Document Interface) classes
4 // Author: Hans Van Leemputten
5 // Modified by: Benjamin I. Williams / Kirix Corporation
7 // Copyright: (c) Hans Van Leemputten
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ===========================================================================
13 // ===========================================================================
15 // ---------------------------------------------------------------------------
17 // ---------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
29 #include "wx/aui/tabmdi.h"
36 #include "wx/settings.h"
39 #include "wx/stockitem.h"
40 #include "wx/aui/dockart.h"
50 //-----------------------------------------------------------------------------
51 // wxAuiMDIParentFrame
52 //-----------------------------------------------------------------------------
54 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame
, wxFrame
)
56 BEGIN_EVENT_TABLE(wxAuiMDIParentFrame
, wxFrame
)
58 EVT_MENU (wxID_ANY
, wxAuiMDIParentFrame::DoHandleMenu
)
59 EVT_UPDATE_UI (wxID_ANY
, wxAuiMDIParentFrame::DoHandleUpdateUI
)
63 wxAuiMDIParentFrame::wxAuiMDIParentFrame()
68 wxAuiMDIParentFrame::wxAuiMDIParentFrame(wxWindow
*parent
,
70 const wxString
& title
,
77 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
80 wxAuiMDIParentFrame::~wxAuiMDIParentFrame()
82 // Avoid having GetActiveChild() called after m_pClientWindow is destroyed
84 // Make sure the client window is destructed before the menu bars are!
85 wxDELETE(m_pClientWindow
);
88 wxDELETE(m_pMyMenuBar
);
89 RemoveWindowMenu(GetMenuBar());
90 wxDELETE(m_pWindowMenu
);
94 bool wxAuiMDIParentFrame::Create(wxWindow
*parent
,
96 const wxString
& title
,
100 const wxString
& name
)
103 // this style can be used to prevent a window from having the standard MDI
105 if (!(style
& wxFRAME_NO_WINDOW_MENU
))
107 m_pWindowMenu
= new wxMenu
;
108 m_pWindowMenu
->Append(wxWINDOWCLOSE
, _("Cl&ose"));
109 m_pWindowMenu
->Append(wxWINDOWCLOSEALL
, _("Close All"));
110 m_pWindowMenu
->AppendSeparator();
111 m_pWindowMenu
->Append(wxWINDOWNEXT
, _("&Next"));
112 m_pWindowMenu
->Append(wxWINDOWPREV
, _("&Previous"));
114 #endif // wxUSE_MENUS
116 if ( !wxFrame::Create(parent
, id
, title
, pos
, size
, style
, name
) )
119 m_pClientWindow
= OnCreateClient();
120 return m_pClientWindow
!= NULL
;
124 void wxAuiMDIParentFrame::SetArtProvider(wxAuiTabArt
* provider
)
128 m_pClientWindow
->SetArtProvider(provider
);
132 wxAuiTabArt
* wxAuiMDIParentFrame::GetArtProvider()
134 if (!m_pClientWindow
)
137 return m_pClientWindow
->GetArtProvider();
140 wxAuiNotebook
* wxAuiMDIParentFrame::GetNotebook() const
142 return static_cast<wxAuiNotebook
*>(m_pClientWindow
);
148 void wxAuiMDIParentFrame::SetWindowMenu(wxMenu
* pMenu
)
150 // Replace the window menu from the currently loaded menu bar.
151 wxMenuBar
*pMenuBar
= GetMenuBar();
155 RemoveWindowMenu(pMenuBar
);
156 wxDELETE(m_pWindowMenu
);
161 m_pWindowMenu
= pMenu
;
162 AddWindowMenu(pMenuBar
);
166 void wxAuiMDIParentFrame::SetMenuBar(wxMenuBar
* pMenuBar
)
168 // Remove the Window menu from the old menu bar
169 RemoveWindowMenu(GetMenuBar());
171 // Add the Window menu to the new menu bar.
172 AddWindowMenu(pMenuBar
);
174 wxFrame::SetMenuBar(pMenuBar
);
175 //m_pMyMenuBar = GetMenuBar();
177 #endif // wxUSE_MENUS
179 void wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame
* pChild
)
184 // No Child, set Our menu bar back.
186 SetMenuBar(m_pMyMenuBar
);
188 SetMenuBar(GetMenuBar());
190 // Make sure we know our menu bar is in use
195 if (pChild
->GetMenuBar() == NULL
)
198 // Do we need to save the current bar?
199 if (m_pMyMenuBar
== NULL
)
200 m_pMyMenuBar
= GetMenuBar();
202 SetMenuBar(pChild
->GetMenuBar());
204 #endif // wxUSE_MENUS
207 bool wxAuiMDIParentFrame::ProcessEvent(wxEvent
& event
)
209 // stops the same event being processed repeatedly
210 if (m_pLastEvt
== &event
)
214 // let the active child (if any) process the event first.
216 wxAuiMDIChildFrame
* pActiveChild
= GetActiveChild();
218 event
.IsCommandEvent() &&
219 event
.GetEventObject() != m_pClientWindow
&&
220 !(event
.GetEventType() == wxEVT_ACTIVATE
||
221 event
.GetEventType() == wxEVT_SET_FOCUS
||
222 event
.GetEventType() == wxEVT_KILL_FOCUS
||
223 event
.GetEventType() == wxEVT_CHILD_FOCUS
||
224 event
.GetEventType() == wxEVT_COMMAND_SET_FOCUS
||
225 event
.GetEventType() == wxEVT_COMMAND_KILL_FOCUS
)
228 res
= pActiveChild
->GetEventHandler()->ProcessEvent(event
);
233 // if the event was not handled this frame will handle it,
234 // which is why we need the protection code at the beginning
236 res
= wxEvtHandler::ProcessEvent(event
);
244 wxAuiMDIChildFrame
*wxAuiMDIParentFrame::GetActiveChild() const
246 // We can be called before the client window is created, so check for its
248 wxAuiMDIClientWindow
* const client
= GetClientWindow();
249 return client
? client
->GetActiveChild() : NULL
;
252 void wxAuiMDIParentFrame::SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
)
254 wxAuiMDIClientWindow
* const client
= GetClientWindow();
255 if (client
&& client
->GetActiveChild() != pChildFrame
)
257 client
->SetActiveChild(pChildFrame
);
261 wxAuiMDIClientWindow
*wxAuiMDIParentFrame::GetClientWindow() const
263 return m_pClientWindow
;
266 wxAuiMDIClientWindow
*wxAuiMDIParentFrame::OnCreateClient()
268 return new wxAuiMDIClientWindow( this );
271 void wxAuiMDIParentFrame::ActivateNext()
273 if (m_pClientWindow
&& m_pClientWindow
->GetSelection() != wxNOT_FOUND
)
275 size_t active
= m_pClientWindow
->GetSelection() + 1;
276 if (active
>= m_pClientWindow
->GetPageCount())
279 m_pClientWindow
->SetSelection(active
);
283 void wxAuiMDIParentFrame::ActivatePrevious()
285 if (m_pClientWindow
&& m_pClientWindow
->GetSelection() != wxNOT_FOUND
)
287 int active
= m_pClientWindow
->GetSelection() - 1;
289 active
= m_pClientWindow
->GetPageCount() - 1;
291 m_pClientWindow
->SetSelection(active
);
295 void wxAuiMDIParentFrame::Init()
298 m_pClientWindow
= NULL
;
300 m_pWindowMenu
= NULL
;
302 #endif // wxUSE_MENUS
306 void wxAuiMDIParentFrame::RemoveWindowMenu(wxMenuBar
* pMenuBar
)
308 if (pMenuBar
&& m_pWindowMenu
)
310 // Remove old window menu
311 int pos
= pMenuBar
->FindMenu(_("&Window"));
312 if (pos
!= wxNOT_FOUND
)
314 // DBG:: We're going to delete the wrong menu!!!
315 wxASSERT(m_pWindowMenu
== pMenuBar
->GetMenu(pos
));
316 pMenuBar
->Remove(pos
);
321 void wxAuiMDIParentFrame::AddWindowMenu(wxMenuBar
*pMenuBar
)
323 if (pMenuBar
&& m_pWindowMenu
)
325 int pos
= pMenuBar
->FindMenu(wxGetStockLabel(wxID_HELP
,wxSTOCK_NOFLAGS
));
326 if (pos
== wxNOT_FOUND
)
327 pMenuBar
->Append(m_pWindowMenu
, _("&Window"));
329 pMenuBar
->Insert(pos
, m_pWindowMenu
, _("&Window"));
333 void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent
& event
)
335 switch (event
.GetId())
339 wxAuiMDIChildFrame
* pActiveChild
= GetActiveChild();
341 pActiveChild
->Close();
344 case wxWINDOWCLOSEALL
:
346 wxAuiMDIChildFrame
* pActiveChild
;
347 while ((pActiveChild
= GetActiveChild()) != NULL
)
349 if (!pActiveChild
->Close())
367 void wxAuiMDIParentFrame::DoHandleUpdateUI(wxUpdateUIEvent
& event
)
369 switch (event
.GetId())
372 case wxWINDOWCLOSEALL
:
374 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
375 wxCHECK_RET(client_window
, wxS("Missing MDI Client Window"));
376 size_t pages
= client_window
->GetPageCount();
377 event
.Enable(pages
>= 1);
384 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
385 wxCHECK_RET(client_window
, wxS("Missing MDI Client Window"));
386 size_t pages
= client_window
->GetPageCount();
387 event
.Enable(pages
>= 2);
395 #endif // wxUSE_MENUS
397 void wxAuiMDIParentFrame::DoGetClientSize(int* width
, int* height
) const
399 wxFrame::DoGetClientSize(width
, height
);
402 void wxAuiMDIParentFrame::Tile(wxOrientation orient
)
404 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
405 wxASSERT_MSG(client_window
, wxT("Missing MDI Client Window"));
407 int cur_idx
= client_window
->GetSelection();
411 if (orient
== wxVERTICAL
)
413 client_window
->Split(cur_idx
, wxLEFT
);
415 else if (orient
== wxHORIZONTAL
)
417 client_window
->Split(cur_idx
, wxTOP
);
422 //-----------------------------------------------------------------------------
423 // wxAuiMDIChildFrame
424 //-----------------------------------------------------------------------------
426 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame
, wxPanel
)
428 BEGIN_EVENT_TABLE(wxAuiMDIChildFrame
, wxPanel
)
429 EVT_MENU_HIGHLIGHT_ALL(wxAuiMDIChildFrame::OnMenuHighlight
)
430 EVT_ACTIVATE(wxAuiMDIChildFrame::OnActivate
)
431 EVT_CLOSE(wxAuiMDIChildFrame::OnCloseWindow
)
434 wxAuiMDIChildFrame::wxAuiMDIChildFrame()
439 wxAuiMDIChildFrame::wxAuiMDIChildFrame(wxAuiMDIParentFrame
*parent
,
441 const wxString
& title
,
442 const wxPoint
& WXUNUSED(pos
),
445 const wxString
& name
)
449 // There are two ways to create an tabbed mdi child fram without
450 // making it the active document. Either Show(false) can be called
451 // before Create() (as is customary on some ports with wxFrame-type
452 // windows), or wxMINIMIZE can be passed in the style flags. Note that
453 // wxAuiMDIChildFrame is not really derived from wxFrame, as wxMDIChildFrame
454 // is, but those are the expected symantics. No style flag is passed
455 // onto the panel underneath.
456 if (style
& wxMINIMIZE
)
457 m_activateOnCreate
= false;
459 Create(parent
, id
, title
, wxDefaultPosition
, size
, 0, name
);
462 wxAuiMDIChildFrame::~wxAuiMDIChildFrame()
464 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
467 if (pParentFrame
->GetActiveChild() == this)
469 pParentFrame
->SetActiveChild(NULL
);
470 pParentFrame
->SetChildMenuBar(NULL
);
472 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
473 wxASSERT(pClientWindow
);
474 int idx
= pClientWindow
->GetPageIndex(this);
475 if (idx
!= wxNOT_FOUND
)
477 pClientWindow
->RemovePage(idx
);
482 wxDELETE(m_pMenuBar
);
483 #endif // wxUSE_MENUS
486 bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame
* parent
,
488 const wxString
& title
,
489 const wxPoint
& WXUNUSED(pos
),
492 const wxString
& name
)
494 wxAuiMDIClientWindow
* pClientWindow
= parent
->GetClientWindow();
495 wxASSERT_MSG((pClientWindow
!= NULL
), wxT("Missing MDI client window."));
497 // see comment in constructor
498 if (style
& wxMINIMIZE
)
499 m_activateOnCreate
= false;
501 wxSize cli_size
= pClientWindow
->GetClientSize();
503 // create the window off-screen to prevent flicker
504 wxPanel::Create(pClientWindow
,
506 wxPoint(cli_size
.x
+1, cli_size
.y
+1),
512 SetMDIParentFrame(parent
);
516 pClientWindow
->AddPage(this, title
, m_activateOnCreate
);
518 // Check that the parent notion of the active child coincides with our one.
519 // This is less obvious that it seems because we must honour
520 // m_activateOnCreate flag but only if it's not the first child because
521 // this one becomes active unconditionally.
524 (m_activateOnCreate
|| pClientWindow
->GetPageCount() == 1)
525 == (parent
->GetActiveChild() == this),
526 wxS("Logic error: child [not] activated when it should [not] have been.")
529 pClientWindow
->Refresh();
534 bool wxAuiMDIChildFrame::Destroy()
536 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
537 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
539 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
540 wxASSERT_MSG(pClientWindow
, wxT("Missing MDI Client Window"));
542 if (pParentFrame
->GetActiveChild() == this)
544 // deactivate ourself
545 wxActivateEvent
event(wxEVT_ACTIVATE
, false, GetId());
546 event
.SetEventObject(this);
547 GetEventHandler()->ProcessEvent(event
);
549 pParentFrame
->SetChildMenuBar(NULL
);
552 size_t page_count
= pClientWindow
->GetPageCount();
553 for (size_t pos
= 0; pos
< page_count
; pos
++)
555 if (pClientWindow
->GetPage(pos
) == this)
556 return pClientWindow
->DeletePage(pos
);
563 void wxAuiMDIChildFrame::SetMenuBar(wxMenuBar
*menu_bar
)
565 wxMenuBar
*pOldMenuBar
= m_pMenuBar
;
566 m_pMenuBar
= menu_bar
;
570 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
571 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
573 m_pMenuBar
->SetParent(pParentFrame
);
574 if (pParentFrame
->GetActiveChild() == this)
576 // replace current menu bars
578 pParentFrame
->SetChildMenuBar(NULL
);
579 pParentFrame
->SetChildMenuBar(this);
584 wxMenuBar
*wxAuiMDIChildFrame::GetMenuBar() const
588 #endif // wxUSE_MENUS
590 void wxAuiMDIChildFrame::SetTitle(const wxString
& title
)
594 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
595 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
597 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
598 if (pClientWindow
!= NULL
)
601 for (pos
= 0; pos
< pClientWindow
->GetPageCount(); pos
++)
603 if (pClientWindow
->GetPage(pos
) == this)
605 pClientWindow
->SetPageText(pos
, m_title
);
612 wxString
wxAuiMDIChildFrame::GetTitle() const
617 void wxAuiMDIChildFrame::SetIcons(const wxIconBundle
& icons
)
619 // get icon with the system icon size
620 SetIcon(icons
.GetIcon(-1));
621 m_iconBundle
= icons
;
624 const wxIconBundle
& wxAuiMDIChildFrame::GetIcons() const
629 void wxAuiMDIChildFrame::SetIcon(const wxIcon
& icon
)
631 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
632 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
637 bmp
.CopyFromIcon(m_icon
);
639 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
640 if (pClientWindow
!= NULL
)
642 int idx
= pClientWindow
->GetPageIndex(this);
646 pClientWindow
->SetPageBitmap((size_t)idx
, bmp
);
651 const wxIcon
& wxAuiMDIChildFrame::GetIcon() const
657 void wxAuiMDIChildFrame::Activate()
659 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
660 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
662 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
664 if (pClientWindow
!= NULL
)
667 for (pos
= 0; pos
< pClientWindow
->GetPageCount(); pos
++)
669 if (pClientWindow
->GetPage(pos
) == this)
671 pClientWindow
->SetSelection(pos
);
678 void wxAuiMDIChildFrame::OnMenuHighlight(wxMenuEvent
& event
)
681 if (m_pMDIParentFrame
)
683 // we don't have any help text for this item,
684 // but may be the MDI frame does?
685 m_pMDIParentFrame
->OnMenuHighlight(event
);
689 #endif // wxUSE_STATUSBAR
692 void wxAuiMDIChildFrame::OnActivate(wxActivateEvent
& WXUNUSED(event
))
697 void wxAuiMDIChildFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
702 void wxAuiMDIChildFrame::SetMDIParentFrame(wxAuiMDIParentFrame
* parentFrame
)
704 m_pMDIParentFrame
= parentFrame
;
707 wxAuiMDIParentFrame
* wxAuiMDIChildFrame::GetMDIParentFrame() const
709 return m_pMDIParentFrame
;
712 void wxAuiMDIChildFrame::Init()
714 m_activateOnCreate
= true;
715 m_pMDIParentFrame
= NULL
;
718 #endif // wxUSE_MENUS
721 bool wxAuiMDIChildFrame::Show(bool show
)
723 // wxAuiMDIChildFrame uses m_activateOnCreate only to decide whether to
724 // activate the frame when it is created. After Create() is called,
725 // m_activateOnCreate will never be read again. Therefore, calling this
726 // function after Create() is pointless and you probably want to call
727 // Activate() instead.
728 wxCHECK_MSG( !GetHandle(), false,
729 wxS("Show() has no effect after Create(). Do you mean Activate()?") );
731 m_activateOnCreate
= show
;
737 void wxAuiMDIChildFrame::DoShow(bool show
)
739 wxWindow::Show(show
);
742 void wxAuiMDIChildFrame::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
744 m_mdiNewRect
= wxRect(x
, y
, width
, height
);
746 wxPanel::DoSetSize(x
,y
,width
, height
, sizeFlags
);
748 wxUnusedVar(sizeFlags
);
752 void wxAuiMDIChildFrame::DoMoveWindow(int x
, int y
, int width
, int height
)
754 m_mdiNewRect
= wxRect(x
, y
, width
, height
);
757 void wxAuiMDIChildFrame::ApplyMDIChildFrameRect()
759 if (m_mdiCurRect
!= m_mdiNewRect
)
761 wxPanel::DoMoveWindow(m_mdiNewRect
.x
, m_mdiNewRect
.y
,
762 m_mdiNewRect
.width
, m_mdiNewRect
.height
);
763 m_mdiCurRect
= m_mdiNewRect
;
768 //-----------------------------------------------------------------------------
769 // wxAuiMDIClientWindow
770 //-----------------------------------------------------------------------------
772 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow
, wxAuiNotebook
)
774 BEGIN_EVENT_TABLE(wxAuiMDIClientWindow
, wxAuiNotebook
)
775 EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY
, wxAuiMDIClientWindow::OnPageChanged
)
776 EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY
, wxAuiMDIClientWindow::OnPageClose
)
777 EVT_SIZE(wxAuiMDIClientWindow::OnSize
)
780 wxAuiMDIClientWindow::wxAuiMDIClientWindow()
784 wxAuiMDIClientWindow::wxAuiMDIClientWindow(wxAuiMDIParentFrame
* parent
, long style
)
786 CreateClient(parent
, style
);
789 bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame
* parent
, long style
)
791 SetWindowStyleFlag(style
);
793 wxSize caption_icon_size
=
794 wxSize(wxSystemSettings::GetMetric(wxSYS_SMALLICON_X
),
795 wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y
));
796 SetUniformBitmapSize(caption_icon_size
);
798 if (!wxAuiNotebook::Create(parent
,
802 wxAUI_NB_DEFAULT_STYLE
| wxNO_BORDER
))
807 wxColour bkcolour
= wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
);
808 SetOwnBackgroundColour(bkcolour
);
810 m_mgr
.GetArtProvider()->SetColour(wxAUI_DOCKART_BACKGROUND_COLOUR
, bkcolour
);
815 int wxAuiMDIClientWindow::SetSelection(size_t nPage
)
817 return wxAuiNotebook::SetSelection(nPage
);
820 wxAuiMDIChildFrame
* wxAuiMDIClientWindow::GetActiveChild()
822 const int sel
= GetSelection();
823 if ( sel
== wxNOT_FOUND
)
826 return wxStaticCast(GetPage(sel
), wxAuiMDIChildFrame
);
829 void wxAuiMDIClientWindow::PageChanged(int old_selection
, int new_selection
)
831 // don't do anything if the page doesn't actually change
832 if (old_selection
== new_selection
)
836 // don't do anything if the new page is already active
837 if (new_selection != -1)
839 wxAuiMDIChildFrame* child = (wxAuiMDIChildFrame*)GetPage(new_selection);
840 if (child->GetMDIParentFrame()->GetActiveChild() == child)
845 // notify old active child that it has been deactivated
846 if ((old_selection
!= -1) && (old_selection
< (int)GetPageCount()))
848 wxAuiMDIChildFrame
* old_child
= (wxAuiMDIChildFrame
*)GetPage(old_selection
);
849 wxASSERT_MSG(old_child
, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
851 wxActivateEvent
event(wxEVT_ACTIVATE
, false, old_child
->GetId());
852 event
.SetEventObject(old_child
);
853 old_child
->GetEventHandler()->ProcessEvent(event
);
856 // notify new active child that it has been activated
857 if (new_selection
!= -1)
859 wxAuiMDIChildFrame
* active_child
= (wxAuiMDIChildFrame
*)GetPage(new_selection
);
860 wxASSERT_MSG(active_child
, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
862 wxActivateEvent
event(wxEVT_ACTIVATE
, true, active_child
->GetId());
863 event
.SetEventObject(active_child
);
864 active_child
->GetEventHandler()->ProcessEvent(event
);
866 if (active_child
->GetMDIParentFrame())
868 active_child
->GetMDIParentFrame()->SetActiveChild(active_child
);
869 active_child
->GetMDIParentFrame()->SetChildMenuBar(active_child
);
876 void wxAuiMDIClientWindow::OnPageClose(wxAuiNotebookEvent
& evt
)
878 wxAuiMDIChildFrame
* wnd
;
879 wnd
= static_cast<wxAuiMDIChildFrame
*>(GetPage(evt
.GetSelection()));
883 // regardless of the result of wnd->Close(), we've
884 // already taken care of the close operations, so
885 // suppress further processing
889 void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent
& evt
)
891 PageChanged(evt
.GetOldSelection(), evt
.GetSelection());
894 void wxAuiMDIClientWindow::OnSize(wxSizeEvent
& evt
)
896 wxAuiNotebook::OnSize(evt
);
898 for (size_t pos
= 0; pos
< GetPageCount(); pos
++)
899 ((wxAuiMDIChildFrame
*)GetPage(pos
))->ApplyMDIChildFrameRect();