+ return new wxMDIClientWindow ;
+}
+
+// Set the child's menu into the parent frame
+void wxMDIParentFrame::SetChildMenuBar(wxMDIChildFrame* child)
+{
+ wxMenuBar* oldMenuBar = m_activeMenuBar;
+
+ if (child == (wxMDIChildFrame*) NULL) // No child: use parent frame
+ {
+ if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
+ {
+ // if (m_activeMenuBar)
+ // m_activeMenuBar->DestroyMenuBar();
+
+ m_activeMenuBar = GetMenuBar();
+ m_activeMenuBar->CreateMenuBar(this);
+ /*
+ if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
+ XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
+ */
+ if (oldMenuBar && oldMenuBar->GetMainWidget())
+ XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
+
+ }
+ }
+ else if (child->GetMenuBar() == (wxMenuBar*) NULL) // No child menu bar: use parent frame
+ {
+ if (GetMenuBar() && (GetMenuBar() != m_activeMenuBar))
+ {
+ // if (m_activeMenuBar)
+ // m_activeMenuBar->DestroyMenuBar();
+ m_activeMenuBar = GetMenuBar();
+ m_activeMenuBar->CreateMenuBar(this);
+ /*
+ if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
+ XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
+ */
+ if (oldMenuBar && oldMenuBar->GetMainWidget())
+ XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
+ }
+ }
+ else // The child has a menubar
+ {
+ if (child->GetMenuBar() != m_activeMenuBar)
+ {
+ // if (m_activeMenuBar)
+ // m_activeMenuBar->DestroyMenuBar();
+
+ m_activeMenuBar = child->GetMenuBar();
+ m_activeMenuBar->CreateMenuBar(this);
+ /*
+ if (oldMenuBar && XtIsManaged((Widget) oldMenuBar->GetMainWidget()))
+ XtUnmanageChild((Widget) oldMenuBar->GetMainWidget());
+ */
+ if (oldMenuBar && oldMenuBar->GetMainWidget())
+ XtUnmapWidget((Widget) oldMenuBar->GetMainWidget());
+ }
+ }
+}
+
+// Redirect events to active child first
+bool wxMDIParentFrame::ProcessEvent(wxEvent& event)
+{
+ // Stops the same event being processed repeatedly
+ static wxEventType inEvent = wxEVT_NULL;
+ if (inEvent == event.GetEventType())
+ return FALSE;
+
+ inEvent = event.GetEventType();
+
+ bool res = FALSE;
+ if (m_activeChild && event.IsKindOf(CLASSINFO(wxCommandEvent)))
+ {
+ res = m_activeChild->GetEventHandler()->ProcessEvent(event);
+ }
+
+ if (!res)
+ res = GetEventHandler()->wxEvtHandler::ProcessEvent(event);
+
+ inEvent = wxEVT_NULL;
+
+ return res;
+}
+
+void wxMDIParentFrame::DoSetSize(int x, int y,
+ int width, int height,
+ int sizeFlags)
+{
+ wxWindow::DoSetSize(x, y, width, height, sizeFlags);
+}
+
+void wxMDIParentFrame::DoSetClientSize(int width, int height)
+{
+ wxWindow::DoSetClientSize(width, height);