Added MDI support for Document/view, plus an example.
[wxWidgets.git] / include / wx / docmdi.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: docmdi.h
3 // Purpose: Frame classes for MDI document/view applications
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DOCMDI_H_
13 #define _WX_DOCMDI_H_
14
15 #ifdef __GNUG__
16 #pragma interface "docmdi.h"
17 #endif
18
19 #include "wx/docview.h"
20 #include "wx/mdi.h"
21
22 /*
23 * Use this instead of wxMDIParentFrame
24 */
25
26 class wxDocMDIParentFrame: public wxMDIParentFrame
27 {
28 DECLARE_CLASS(wxDocMDIParentFrame)
29 public:
30 wxDocMDIParentFrame(wxDocManager *manager, wxFrame *frame, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size,
31 long style, const wxString& name);
32
33 bool OnClose(void);
34 // Extend event processing to search the document manager's event table
35 virtual bool ProcessEvent(wxEvent& event);
36
37 wxDocManager *GetDocumentManager(void) const { return m_docManager; }
38
39 void OnExit(wxCommandEvent& event);
40 void OnMRUFile(wxCommandEvent& event);
41
42 protected:
43 wxDocManager *m_docManager;
44
45
46 DECLARE_EVENT_TABLE()
47 };
48
49 /*
50 * Use this instead of wxMDIChildFrame
51 */
52
53 class WXDLLEXPORT wxDocMDIChildFrame: public wxMDIChildFrame
54 {
55 DECLARE_CLASS(wxDocMDIChildFrame)
56
57 public:
58 wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, const wxString& title,
59 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
60 long type = wxDEFAULT_FRAME_STYLE, const wxString& name = "frame");
61 ~wxDocMDIChildFrame(void);
62
63 bool OnClose(void);
64 // Extend event processing to search the view's event table
65 virtual bool ProcessEvent(wxEvent& event);
66
67 void OnActivate(wxActivateEvent& event);
68
69 inline wxDocument *GetDocument(void) const { return m_childDocument; }
70 inline wxView *GetView(void) const { return m_childView; }
71 inline void SetDocument(wxDocument *doc) { m_childDocument = doc; }
72 inline void SetView(wxView *view) { m_childView = view; }
73 protected:
74 wxDocument* m_childDocument;
75 wxView* m_childView;
76
77 DECLARE_EVENT_TABLE()
78
79 };
80
81 #endif
82 // _WX_DOCMDI_H_