]>
git.saurik.com Git - wxWidgets.git/blob - src/common/docmdi.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Frame classes for MDI document/view applications
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
19 #if wxUSE_MDI_ARCHITECTURE
21 #include "wx/docmdi.h"
24 * Docview MDI parent frame
27 IMPLEMENT_CLASS(wxDocMDIParentFrame
, wxMDIParentFrame
)
29 BEGIN_EVENT_TABLE(wxDocMDIParentFrame
, wxMDIParentFrame
)
30 EVT_MENU(wxID_EXIT
, wxDocMDIParentFrame::OnExit
)
31 EVT_MENU_RANGE(wxID_FILE1
, wxID_FILE9
, wxDocMDIParentFrame::OnMRUFile
)
32 EVT_CLOSE(wxDocMDIParentFrame::OnCloseWindow
)
35 wxDocMDIParentFrame::wxDocMDIParentFrame()
40 wxDocMDIParentFrame::wxDocMDIParentFrame(wxDocManager
*manager
, wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
41 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
)
44 Create(manager
, frame
, id
, title
, pos
, size
, style
, name
);
47 bool wxDocMDIParentFrame::Create(wxDocManager
*manager
, wxFrame
*frame
, wxWindowID id
, const wxString
& title
,
48 const wxPoint
& pos
, const wxSize
& size
, long style
, const wxString
& name
)
50 m_docManager
= manager
;
51 return wxMDIParentFrame::Create(frame
, id
, title
, pos
, size
, style
, name
);
54 void wxDocMDIParentFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
59 void wxDocMDIParentFrame::Init()
64 void wxDocMDIParentFrame::OnMRUFile(wxCommandEvent
& event
)
66 wxString
f(m_docManager
->GetHistoryFile(event
.GetId() - wxID_FILE1
));
68 (void)m_docManager
->CreateDocument(f
, wxDOC_SILENT
);
71 bool wxDocMDIParentFrame::TryBefore(wxEvent
& event
)
73 if ( m_docManager
&& m_docManager
->ProcessEventHere(event
) )
76 return wxMDIParentFrame::TryBefore(event
);
79 void wxDocMDIParentFrame::OnCloseWindow(wxCloseEvent
& event
)
81 if (m_docManager
->Clear(!event
.CanVeto()))
90 IMPLEMENT_CLASS(wxDocMDIChildFrame
, wxMDIChildFrame
)
92 #endif // wxUSE_DOC_VIEW_ARCHITECTURE