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
8 // Copyright: (c) Hans Van Leemputten
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
30 #include "wx/aui/tabmdi.h"
37 #include "wx/settings.h"
40 #include "wx/stockitem.h"
41 #include "wx/aui/dockart.h"
51 //-----------------------------------------------------------------------------
52 // wxAuiMDIParentFrame
53 //-----------------------------------------------------------------------------
55 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIParentFrame
, wxFrame
)
57 BEGIN_EVENT_TABLE(wxAuiMDIParentFrame
, wxFrame
)
59 EVT_MENU (wxID_ANY
, wxAuiMDIParentFrame::DoHandleMenu
)
60 EVT_UPDATE_UI (wxID_ANY
, wxAuiMDIParentFrame::DoHandleUpdateUI
)
64 wxAuiMDIParentFrame::wxAuiMDIParentFrame()
69 wxAuiMDIParentFrame::wxAuiMDIParentFrame(wxWindow
*parent
,
71 const wxString
& title
,
78 (void)Create(parent
, id
, title
, pos
, size
, style
, name
);
81 wxAuiMDIParentFrame::~wxAuiMDIParentFrame()
83 // Avoid having GetActiveChild() called after m_pClientWindow is destroyed
85 // Make sure the client window is destructed before the menu bars are!
86 wxDELETE(m_pClientWindow
);
89 wxDELETE(m_pMyMenuBar
);
90 RemoveWindowMenu(GetMenuBar());
91 wxDELETE(m_pWindowMenu
);
95 bool wxAuiMDIParentFrame::Create(wxWindow
*parent
,
97 const wxString
& title
,
101 const wxString
& name
)
104 // this style can be used to prevent a window from having the standard MDI
106 if (!(style
& wxFRAME_NO_WINDOW_MENU
))
108 m_pWindowMenu
= new wxMenu
;
109 m_pWindowMenu
->Append(wxWINDOWCLOSE
, _("Cl&ose"));
110 m_pWindowMenu
->Append(wxWINDOWCLOSEALL
, _("Close All"));
111 m_pWindowMenu
->AppendSeparator();
112 m_pWindowMenu
->Append(wxWINDOWNEXT
, _("&Next"));
113 m_pWindowMenu
->Append(wxWINDOWPREV
, _("&Previous"));
115 #endif // wxUSE_MENUS
117 if ( !wxFrame::Create(parent
, id
, title
, pos
, size
, style
, name
) )
120 m_pClientWindow
= OnCreateClient();
121 return m_pClientWindow
!= NULL
;
125 void wxAuiMDIParentFrame::SetArtProvider(wxAuiTabArt
* provider
)
129 m_pClientWindow
->SetArtProvider(provider
);
133 wxAuiTabArt
* wxAuiMDIParentFrame::GetArtProvider()
135 if (!m_pClientWindow
)
138 return m_pClientWindow
->GetArtProvider();
141 wxAuiNotebook
* wxAuiMDIParentFrame::GetNotebook() const
143 return static_cast<wxAuiNotebook
*>(m_pClientWindow
);
149 void wxAuiMDIParentFrame::SetWindowMenu(wxMenu
* pMenu
)
151 // Replace the window menu from the currently loaded menu bar.
152 wxMenuBar
*pMenuBar
= GetMenuBar();
156 RemoveWindowMenu(pMenuBar
);
157 wxDELETE(m_pWindowMenu
);
162 m_pWindowMenu
= pMenu
;
163 AddWindowMenu(pMenuBar
);
167 void wxAuiMDIParentFrame::SetMenuBar(wxMenuBar
* pMenuBar
)
169 // Remove the Window menu from the old menu bar
170 RemoveWindowMenu(GetMenuBar());
172 // Add the Window menu to the new menu bar.
173 AddWindowMenu(pMenuBar
);
175 wxFrame::SetMenuBar(pMenuBar
);
176 //m_pMyMenuBar = GetMenuBar();
178 #endif // wxUSE_MENUS
180 void wxAuiMDIParentFrame::SetChildMenuBar(wxAuiMDIChildFrame
* pChild
)
185 // No Child, set Our menu bar back.
187 SetMenuBar(m_pMyMenuBar
);
189 SetMenuBar(GetMenuBar());
191 // Make sure we know our menu bar is in use
196 if (pChild
->GetMenuBar() == NULL
)
199 // Do we need to save the current bar?
200 if (m_pMyMenuBar
== NULL
)
201 m_pMyMenuBar
= GetMenuBar();
203 SetMenuBar(pChild
->GetMenuBar());
205 #endif // wxUSE_MENUS
208 bool wxAuiMDIParentFrame::ProcessEvent(wxEvent
& event
)
210 // stops the same event being processed repeatedly
211 if (m_pLastEvt
== &event
)
215 // let the active child (if any) process the event first.
217 wxAuiMDIChildFrame
* pActiveChild
= GetActiveChild();
219 event
.IsCommandEvent() &&
220 event
.GetEventObject() != m_pClientWindow
&&
221 !(event
.GetEventType() == wxEVT_ACTIVATE
||
222 event
.GetEventType() == wxEVT_SET_FOCUS
||
223 event
.GetEventType() == wxEVT_KILL_FOCUS
||
224 event
.GetEventType() == wxEVT_CHILD_FOCUS
||
225 event
.GetEventType() == wxEVT_COMMAND_SET_FOCUS
||
226 event
.GetEventType() == wxEVT_COMMAND_KILL_FOCUS
)
229 res
= pActiveChild
->GetEventHandler()->ProcessEvent(event
);
234 // if the event was not handled this frame will handle it,
235 // which is why we need the protection code at the beginning
237 res
= wxEvtHandler::ProcessEvent(event
);
245 wxAuiMDIChildFrame
*wxAuiMDIParentFrame::GetActiveChild() const
247 return GetClientWindow()->GetActiveChild();
250 void wxAuiMDIParentFrame::SetActiveChild(wxAuiMDIChildFrame
* pChildFrame
)
252 if (GetClientWindow()->GetActiveChild() != pChildFrame
)
254 GetClientWindow()->SetActiveChild(pChildFrame
);
258 wxAuiMDIClientWindow
*wxAuiMDIParentFrame::GetClientWindow() const
260 return m_pClientWindow
;
263 wxAuiMDIClientWindow
*wxAuiMDIParentFrame::OnCreateClient()
265 return new wxAuiMDIClientWindow( this );
268 void wxAuiMDIParentFrame::ActivateNext()
270 if (m_pClientWindow
&& m_pClientWindow
->GetSelection() != wxNOT_FOUND
)
272 size_t active
= m_pClientWindow
->GetSelection() + 1;
273 if (active
>= m_pClientWindow
->GetPageCount())
276 m_pClientWindow
->SetSelection(active
);
280 void wxAuiMDIParentFrame::ActivatePrevious()
282 if (m_pClientWindow
&& m_pClientWindow
->GetSelection() != wxNOT_FOUND
)
284 int active
= m_pClientWindow
->GetSelection() - 1;
286 active
= m_pClientWindow
->GetPageCount() - 1;
288 m_pClientWindow
->SetSelection(active
);
292 void wxAuiMDIParentFrame::Init()
295 m_pClientWindow
= NULL
;
297 m_pWindowMenu
= NULL
;
299 #endif // wxUSE_MENUS
303 void wxAuiMDIParentFrame::RemoveWindowMenu(wxMenuBar
* pMenuBar
)
305 if (pMenuBar
&& m_pWindowMenu
)
307 // Remove old window menu
308 int pos
= pMenuBar
->FindMenu(_("&Window"));
309 if (pos
!= wxNOT_FOUND
)
311 // DBG:: We're going to delete the wrong menu!!!
312 wxASSERT(m_pWindowMenu
== pMenuBar
->GetMenu(pos
));
313 pMenuBar
->Remove(pos
);
318 void wxAuiMDIParentFrame::AddWindowMenu(wxMenuBar
*pMenuBar
)
320 if (pMenuBar
&& m_pWindowMenu
)
322 int pos
= pMenuBar
->FindMenu(wxGetStockLabel(wxID_HELP
,wxSTOCK_NOFLAGS
));
323 if (pos
== wxNOT_FOUND
)
324 pMenuBar
->Append(m_pWindowMenu
, _("&Window"));
326 pMenuBar
->Insert(pos
, m_pWindowMenu
, _("&Window"));
330 void wxAuiMDIParentFrame::DoHandleMenu(wxCommandEvent
& event
)
332 switch (event
.GetId())
336 wxAuiMDIChildFrame
* pActiveChild
= GetActiveChild();
338 pActiveChild
->Close();
341 case wxWINDOWCLOSEALL
:
343 wxAuiMDIChildFrame
* pActiveChild
;
344 while ((pActiveChild
= GetActiveChild()) != NULL
)
346 if (!pActiveChild
->Close())
364 void wxAuiMDIParentFrame::DoHandleUpdateUI(wxUpdateUIEvent
& event
)
366 switch (event
.GetId())
369 case wxWINDOWCLOSEALL
:
371 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
372 wxCHECK_RET(client_window
, wxS("Missing MDI Client Window"));
373 size_t pages
= client_window
->GetPageCount();
374 event
.Enable(pages
>= 1);
381 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
382 wxCHECK_RET(client_window
, wxS("Missing MDI Client Window"));
383 size_t pages
= client_window
->GetPageCount();
384 event
.Enable(pages
>= 2);
392 #endif // wxUSE_MENUS
394 void wxAuiMDIParentFrame::DoGetClientSize(int* width
, int* height
) const
396 wxFrame::DoGetClientSize(width
, height
);
399 void wxAuiMDIParentFrame::Tile(wxOrientation orient
)
401 wxAuiMDIClientWindow
* client_window
= GetClientWindow();
402 wxASSERT_MSG(client_window
, wxT("Missing MDI Client Window"));
404 int cur_idx
= client_window
->GetSelection();
408 if (orient
== wxVERTICAL
)
410 client_window
->Split(cur_idx
, wxLEFT
);
412 else if (orient
== wxHORIZONTAL
)
414 client_window
->Split(cur_idx
, wxTOP
);
419 //-----------------------------------------------------------------------------
420 // wxAuiMDIChildFrame
421 //-----------------------------------------------------------------------------
423 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIChildFrame
, wxPanel
)
425 BEGIN_EVENT_TABLE(wxAuiMDIChildFrame
, wxPanel
)
426 EVT_MENU_HIGHLIGHT_ALL(wxAuiMDIChildFrame::OnMenuHighlight
)
427 EVT_ACTIVATE(wxAuiMDIChildFrame::OnActivate
)
428 EVT_CLOSE(wxAuiMDIChildFrame::OnCloseWindow
)
431 wxAuiMDIChildFrame::wxAuiMDIChildFrame()
436 wxAuiMDIChildFrame::wxAuiMDIChildFrame(wxAuiMDIParentFrame
*parent
,
438 const wxString
& title
,
439 const wxPoint
& WXUNUSED(pos
),
442 const wxString
& name
)
446 // There are two ways to create an tabbed mdi child fram without
447 // making it the active document. Either Show(false) can be called
448 // before Create() (as is customary on some ports with wxFrame-type
449 // windows), or wxMINIMIZE can be passed in the style flags. Note that
450 // wxAuiMDIChildFrame is not really derived from wxFrame, as wxMDIChildFrame
451 // is, but those are the expected symantics. No style flag is passed
452 // onto the panel underneath.
453 if (style
& wxMINIMIZE
)
454 m_activateOnCreate
= false;
456 Create(parent
, id
, title
, wxDefaultPosition
, size
, 0, name
);
459 wxAuiMDIChildFrame::~wxAuiMDIChildFrame()
461 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
464 if (pParentFrame
->GetActiveChild() == this)
466 pParentFrame
->SetActiveChild(NULL
);
467 pParentFrame
->SetChildMenuBar(NULL
);
469 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
470 wxASSERT(pClientWindow
);
471 int idx
= pClientWindow
->GetPageIndex(this);
472 if (idx
!= wxNOT_FOUND
)
474 pClientWindow
->RemovePage(idx
);
479 wxDELETE(m_pMenuBar
);
480 #endif // wxUSE_MENUS
483 bool wxAuiMDIChildFrame::Create(wxAuiMDIParentFrame
* parent
,
485 const wxString
& title
,
486 const wxPoint
& WXUNUSED(pos
),
489 const wxString
& name
)
491 wxAuiMDIClientWindow
* pClientWindow
= parent
->GetClientWindow();
492 wxASSERT_MSG((pClientWindow
!= NULL
), wxT("Missing MDI client window."));
494 // see comment in constructor
495 if (style
& wxMINIMIZE
)
496 m_activateOnCreate
= false;
498 wxSize cli_size
= pClientWindow
->GetClientSize();
500 // create the window off-screen to prevent flicker
501 wxPanel::Create(pClientWindow
,
503 wxPoint(cli_size
.x
+1, cli_size
.y
+1),
509 SetMDIParentFrame(parent
);
513 pClientWindow
->AddPage(this, title
, m_activateOnCreate
);
515 // Check that the parent notion of the active child coincides with our one.
516 // This is less obvious that it seems because we must honour
517 // m_activateOnCreate flag but only if it's not the first child because
518 // this one becomes active unconditionally.
521 (m_activateOnCreate
|| pClientWindow
->GetPageCount() == 1)
522 == (parent
->GetActiveChild() == this),
523 wxS("Logic error: child [not] activated when it should [not] have been.")
526 pClientWindow
->Refresh();
531 bool wxAuiMDIChildFrame::Destroy()
533 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
534 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
536 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
537 wxASSERT_MSG(pClientWindow
, wxT("Missing MDI Client Window"));
539 if (pParentFrame
->GetActiveChild() == this)
541 // deactivate ourself
542 wxActivateEvent
event(wxEVT_ACTIVATE
, false, GetId());
543 event
.SetEventObject(this);
544 GetEventHandler()->ProcessEvent(event
);
546 pParentFrame
->SetChildMenuBar(NULL
);
549 size_t page_count
= pClientWindow
->GetPageCount();
550 for (size_t pos
= 0; pos
< page_count
; pos
++)
552 if (pClientWindow
->GetPage(pos
) == this)
553 return pClientWindow
->DeletePage(pos
);
560 void wxAuiMDIChildFrame::SetMenuBar(wxMenuBar
*menu_bar
)
562 wxMenuBar
*pOldMenuBar
= m_pMenuBar
;
563 m_pMenuBar
= menu_bar
;
567 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
568 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
570 m_pMenuBar
->SetParent(pParentFrame
);
571 if (pParentFrame
->GetActiveChild() == this)
573 // replace current menu bars
575 pParentFrame
->SetChildMenuBar(NULL
);
576 pParentFrame
->SetChildMenuBar(this);
581 wxMenuBar
*wxAuiMDIChildFrame::GetMenuBar() const
585 #endif // wxUSE_MENUS
587 void wxAuiMDIChildFrame::SetTitle(const wxString
& title
)
591 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
592 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
594 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
595 if (pClientWindow
!= NULL
)
598 for (pos
= 0; pos
< pClientWindow
->GetPageCount(); pos
++)
600 if (pClientWindow
->GetPage(pos
) == this)
602 pClientWindow
->SetPageText(pos
, m_title
);
609 wxString
wxAuiMDIChildFrame::GetTitle() const
614 void wxAuiMDIChildFrame::SetIcons(const wxIconBundle
& icons
)
616 // get icon with the system icon size
617 SetIcon(icons
.GetIcon(-1));
618 m_iconBundle
= icons
;
621 const wxIconBundle
& wxAuiMDIChildFrame::GetIcons() const
626 void wxAuiMDIChildFrame::SetIcon(const wxIcon
& icon
)
628 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
629 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
634 bmp
.CopyFromIcon(m_icon
);
636 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
637 if (pClientWindow
!= NULL
)
639 int idx
= pClientWindow
->GetPageIndex(this);
643 pClientWindow
->SetPageBitmap((size_t)idx
, bmp
);
648 const wxIcon
& wxAuiMDIChildFrame::GetIcon() const
654 void wxAuiMDIChildFrame::Activate()
656 wxAuiMDIParentFrame
* pParentFrame
= GetMDIParentFrame();
657 wxASSERT_MSG(pParentFrame
, wxT("Missing MDI Parent Frame"));
659 wxAuiMDIClientWindow
* pClientWindow
= pParentFrame
->GetClientWindow();
661 if (pClientWindow
!= NULL
)
664 for (pos
= 0; pos
< pClientWindow
->GetPageCount(); pos
++)
666 if (pClientWindow
->GetPage(pos
) == this)
668 pClientWindow
->SetSelection(pos
);
675 void wxAuiMDIChildFrame::OnMenuHighlight(wxMenuEvent
& event
)
678 if (m_pMDIParentFrame
)
680 // we don't have any help text for this item,
681 // but may be the MDI frame does?
682 m_pMDIParentFrame
->OnMenuHighlight(event
);
686 #endif // wxUSE_STATUSBAR
689 void wxAuiMDIChildFrame::OnActivate(wxActivateEvent
& WXUNUSED(event
))
694 void wxAuiMDIChildFrame::OnCloseWindow(wxCloseEvent
& WXUNUSED(event
))
699 void wxAuiMDIChildFrame::SetMDIParentFrame(wxAuiMDIParentFrame
* parentFrame
)
701 m_pMDIParentFrame
= parentFrame
;
704 wxAuiMDIParentFrame
* wxAuiMDIChildFrame::GetMDIParentFrame() const
706 return m_pMDIParentFrame
;
709 void wxAuiMDIChildFrame::Init()
711 m_activateOnCreate
= true;
712 m_pMDIParentFrame
= NULL
;
715 #endif // wxUSE_MENUS
718 bool wxAuiMDIChildFrame::Show(bool show
)
720 // wxAuiMDIChildFrame uses m_activateOnCreate only to decide whether to
721 // activate the frame when it is created. After Create() is called,
722 // m_activateOnCreate will never be read again. Therefore, calling this
723 // function after Create() is pointless and you probably want to call
724 // Activate() instead.
725 wxCHECK_MSG( !GetHandle(), false,
726 wxS("Show() has no effect after Create(). Do you mean Activate()?") );
728 m_activateOnCreate
= show
;
734 void wxAuiMDIChildFrame::DoShow(bool show
)
736 wxWindow::Show(show
);
739 void wxAuiMDIChildFrame::DoSetSize(int x
, int y
, int width
, int height
, int sizeFlags
)
741 m_mdiNewRect
= wxRect(x
, y
, width
, height
);
743 wxPanel::DoSetSize(x
,y
,width
, height
, sizeFlags
);
745 wxUnusedVar(sizeFlags
);
749 void wxAuiMDIChildFrame::DoMoveWindow(int x
, int y
, int width
, int height
)
751 m_mdiNewRect
= wxRect(x
, y
, width
, height
);
754 void wxAuiMDIChildFrame::ApplyMDIChildFrameRect()
756 if (m_mdiCurRect
!= m_mdiNewRect
)
758 wxPanel::DoMoveWindow(m_mdiNewRect
.x
, m_mdiNewRect
.y
,
759 m_mdiNewRect
.width
, m_mdiNewRect
.height
);
760 m_mdiCurRect
= m_mdiNewRect
;
765 //-----------------------------------------------------------------------------
766 // wxAuiMDIClientWindow
767 //-----------------------------------------------------------------------------
769 IMPLEMENT_DYNAMIC_CLASS(wxAuiMDIClientWindow
, wxAuiNotebook
)
771 BEGIN_EVENT_TABLE(wxAuiMDIClientWindow
, wxAuiNotebook
)
772 EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY
, wxAuiMDIClientWindow::OnPageChanged
)
773 EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY
, wxAuiMDIClientWindow::OnPageClose
)
774 EVT_SIZE(wxAuiMDIClientWindow::OnSize
)
777 wxAuiMDIClientWindow::wxAuiMDIClientWindow()
781 wxAuiMDIClientWindow::wxAuiMDIClientWindow(wxAuiMDIParentFrame
* parent
, long style
)
783 CreateClient(parent
, style
);
786 bool wxAuiMDIClientWindow::CreateClient(wxAuiMDIParentFrame
* parent
, long style
)
788 SetWindowStyleFlag(style
);
790 wxSize caption_icon_size
=
791 wxSize(wxSystemSettings::GetMetric(wxSYS_SMALLICON_X
),
792 wxSystemSettings::GetMetric(wxSYS_SMALLICON_Y
));
793 SetUniformBitmapSize(caption_icon_size
);
795 if (!wxAuiNotebook::Create(parent
,
799 wxAUI_NB_DEFAULT_STYLE
| wxNO_BORDER
))
804 wxColour bkcolour
= wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE
);
805 SetOwnBackgroundColour(bkcolour
);
807 m_mgr
.GetArtProvider()->SetColour(wxAUI_DOCKART_BACKGROUND_COLOUR
, bkcolour
);
812 int wxAuiMDIClientWindow::SetSelection(size_t nPage
)
814 return wxAuiNotebook::SetSelection(nPage
);
817 wxAuiMDIChildFrame
* wxAuiMDIClientWindow::GetActiveChild()
819 const int sel
= GetSelection();
820 if ( sel
== wxNOT_FOUND
)
823 return wxStaticCast(GetPage(sel
), wxAuiMDIChildFrame
);
826 void wxAuiMDIClientWindow::PageChanged(int old_selection
, int new_selection
)
828 // don't do anything if the page doesn't actually change
829 if (old_selection
== new_selection
)
833 // don't do anything if the new page is already active
834 if (new_selection != -1)
836 wxAuiMDIChildFrame* child = (wxAuiMDIChildFrame*)GetPage(new_selection);
837 if (child->GetMDIParentFrame()->GetActiveChild() == child)
842 // notify old active child that it has been deactivated
843 if ((old_selection
!= -1) && (old_selection
< (int)GetPageCount()))
845 wxAuiMDIChildFrame
* old_child
= (wxAuiMDIChildFrame
*)GetPage(old_selection
);
846 wxASSERT_MSG(old_child
, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
848 wxActivateEvent
event(wxEVT_ACTIVATE
, false, old_child
->GetId());
849 event
.SetEventObject(old_child
);
850 old_child
->GetEventHandler()->ProcessEvent(event
);
853 // notify new active child that it has been activated
854 if (new_selection
!= -1)
856 wxAuiMDIChildFrame
* active_child
= (wxAuiMDIChildFrame
*)GetPage(new_selection
);
857 wxASSERT_MSG(active_child
, wxT("wxAuiMDIClientWindow::PageChanged - null page pointer"));
859 wxActivateEvent
event(wxEVT_ACTIVATE
, true, active_child
->GetId());
860 event
.SetEventObject(active_child
);
861 active_child
->GetEventHandler()->ProcessEvent(event
);
863 if (active_child
->GetMDIParentFrame())
865 active_child
->GetMDIParentFrame()->SetActiveChild(active_child
);
866 active_child
->GetMDIParentFrame()->SetChildMenuBar(active_child
);
873 void wxAuiMDIClientWindow::OnPageClose(wxAuiNotebookEvent
& evt
)
875 wxAuiMDIChildFrame
* wnd
;
876 wnd
= static_cast<wxAuiMDIChildFrame
*>(GetPage(evt
.GetSelection()));
880 // regardless of the result of wnd->Close(), we've
881 // already taken care of the close operations, so
882 // suppress further processing
886 void wxAuiMDIClientWindow::OnPageChanged(wxAuiNotebookEvent
& evt
)
888 PageChanged(evt
.GetOldSelection(), evt
.GetSelection());
891 void wxAuiMDIClientWindow::OnSize(wxSizeEvent
& evt
)
893 wxAuiNotebook::OnSize(evt
);
895 for (size_t pos
= 0; pos
< GetPageCount(); pos
++)
896 ((wxAuiMDIChildFrame
*)GetPage(pos
))->ApplyMDIChildFrameRect();