]>
Commit | Line | Data |
---|---|---|
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) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_DOCMDI_H_ | |
13 | #define _WX_DOCMDI_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | ||
17 | #if wxUSE_MDI_ARCHITECTURE | |
18 | ||
19 | #include "wx/docview.h" | |
20 | #include "wx/mdi.h" | |
21 | ||
22 | /* | |
23 | * Use this instead of wxMDIParentFrame | |
24 | */ | |
25 | ||
26 | class WXDLLIMPEXP_CORE wxDocMDIParentFrame: public wxMDIParentFrame | |
27 | { | |
28 | public: | |
29 | wxDocMDIParentFrame(); | |
30 | wxDocMDIParentFrame(wxDocManager *manager, wxFrame *parent, wxWindowID id, | |
31 | const wxString& title, const wxPoint& pos = wxDefaultPosition, | |
32 | const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); | |
33 | ||
34 | bool Create(wxDocManager *manager, wxFrame *parent, wxWindowID id, | |
35 | const wxString& title, const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); | |
37 | ||
38 | wxDocManager *GetDocumentManager(void) const { return m_docManager; } | |
39 | ||
40 | void OnExit(wxCommandEvent& event); | |
41 | void OnMRUFile(wxCommandEvent& event); | |
42 | void OnCloseWindow(wxCloseEvent& event); | |
43 | ||
44 | protected: | |
45 | void Init(); | |
46 | ||
47 | virtual bool TryValidator(wxEvent& event); | |
48 | ||
49 | wxDocManager *m_docManager; | |
50 | ||
51 | private: | |
52 | DECLARE_CLASS(wxDocMDIParentFrame) | |
53 | DECLARE_EVENT_TABLE() | |
54 | DECLARE_NO_COPY_CLASS(wxDocMDIParentFrame) | |
55 | }; | |
56 | ||
57 | /* | |
58 | * Use this instead of wxMDIChildFrame | |
59 | */ | |
60 | ||
61 | class WXDLLIMPEXP_CORE wxDocMDIChildFrame: public wxMDIChildFrame | |
62 | { | |
63 | public: | |
64 | wxDocMDIChildFrame(); | |
65 | wxDocMDIChildFrame(wxDocument *doc, wxView *view, wxMDIParentFrame *frame, wxWindowID id, | |
66 | const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, | |
67 | long type = wxDEFAULT_FRAME_STYLE, const wxString& name = wxFrameNameStr); | |
68 | virtual ~wxDocMDIChildFrame(); | |
69 | ||
70 | bool Create(wxDocument *doc, | |
71 | wxView *view, | |
72 | wxMDIParentFrame *frame, | |
73 | wxWindowID id, | |
74 | const wxString& title, | |
75 | const wxPoint& pos = wxDefaultPosition, | |
76 | const wxSize& size = wxDefaultSize, | |
77 | long type = wxDEFAULT_FRAME_STYLE, | |
78 | const wxString& name = wxFrameNameStr); | |
79 | ||
80 | void OnActivate(wxActivateEvent& event); | |
81 | void OnCloseWindow(wxCloseEvent& event); | |
82 | ||
83 | inline wxDocument *GetDocument() const { return m_childDocument; } | |
84 | inline wxView *GetView(void) const { return m_childView; } | |
85 | inline void SetDocument(wxDocument *doc) { m_childDocument = doc; } | |
86 | inline void SetView(wxView *view) { m_childView = view; } | |
87 | bool Destroy() { m_childView = (wxView *)NULL; return wxMDIChildFrame::Destroy(); } | |
88 | ||
89 | protected: | |
90 | void Init(); | |
91 | ||
92 | virtual bool TryValidator(wxEvent& event); | |
93 | ||
94 | wxDocument* m_childDocument; | |
95 | wxView* m_childView; | |
96 | ||
97 | private: | |
98 | DECLARE_EVENT_TABLE() | |
99 | DECLARE_CLASS(wxDocMDIChildFrame) | |
100 | DECLARE_NO_COPY_CLASS(wxDocMDIChildFrame) | |
101 | }; | |
102 | ||
103 | #endif | |
104 | // wxUSE_MDI_ARCHITECTURE | |
105 | ||
106 | #endif | |
107 | // _WX_DOCMDI_H_ |