-BEGIN_EVENT_TABLE(wxDocMDIChildFrame, wxMDIChildFrame)
- EVT_ACTIVATE(wxDocMDIChildFrame::OnActivate)
-END_EVENT_TABLE()
-
-wxDocMDIChildFrame::wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id,
- const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name):
- wxMDIChildFrame(frame, id, title, pos, size, style, name)
-{
- m_childDocument = doc;
- m_childView = view;
- if (view)
- view->SetFrame(this);
-}
-
-wxDocMDIChildFrame::~wxDocMDIChildFrame(void)
-{
-}
-
-// Extend event processing to search the view's event table
-bool wxDocMDIChildFrame::ProcessEvent(wxEvent& event)
-{
- if (m_childView)
- m_childView->Activate(TRUE);
-
- if ( !m_childView || ! m_childView->ProcessEvent(event) )
- {
- // Only hand up to the parent if it's a menu command
- if (!event.IsKindOf(CLASSINFO(wxCommandEvent)) || !GetParent() || !GetParent()->ProcessEvent(event))
- return wxEvtHandler::ProcessEvent(event);
- else
- return TRUE;
- }
- else
- return TRUE;
-}
-
-void wxDocMDIChildFrame::OnActivate(wxActivateEvent& event)
-{
- wxMDIChildFrame::OnActivate(event);
-
- if (m_childView)
- m_childView->Activate(event.GetActive());
-}
-
-bool wxDocMDIChildFrame::OnClose(void)
-{
- // Close view but don't delete the frame while doing so!
- // ...since it will be deleted by wxWindows if we return TRUE.
- if (m_childView)
- {
- bool ans = m_childView->Close(FALSE); // FALSE means don't delete associated window
- if (ans)
- {
- m_childView->Activate(FALSE);
- delete m_childView;
- m_childView = NULL;
- m_childDocument = NULL;
- }
-
- return ans;
- }
- else return TRUE;
-}
-
-#endif
- // USE_DOC_VIEW_ARCHITECTURE