]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: docmdi.h | |
0c1fe6e9 | 3 | // Purpose: interface of wxDocMDIParentFrame and wxDocMDIChildFrame |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxDocMDIParentFrame | |
7c913512 | 11 | |
23324ae1 | 12 | The wxDocMDIParentFrame class provides a default top-level frame for |
0c1fe6e9 BP |
13 | applications using the document/view framework. This class can only be used |
14 | for MDI parent frames. | |
7c913512 | 15 | |
0c1fe6e9 BP |
16 | It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate |
17 | classes. | |
7c913512 | 18 | |
23324ae1 | 19 | @library{wxcore} |
0c1fe6e9 | 20 | @category{docview} |
7c913512 | 21 | |
0c1fe6e9 | 22 | @see @ref overview_docview, @ref page_samples_docview, wxMDIParentFrame |
23324ae1 FM |
23 | */ |
24 | class wxDocMDIParentFrame : public wxMDIParentFrame | |
25 | { | |
26 | public: | |
27 | //@{ | |
28 | /** | |
29 | Constructor. | |
30 | */ | |
31 | wxDocMDIParentFrame(); | |
4cc4bfaf | 32 | wxDocMDIParentFrame(wxDocManager* manager, wxFrame* parent, |
7c913512 FM |
33 | wxWindowID id, |
34 | const wxString& title, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxDEFAULT_FRAME_STYLE, | |
408776d0 | 38 | const wxString& name = wxFrameNameStr); |
23324ae1 FM |
39 | //@} |
40 | ||
41 | /** | |
42 | Destructor. | |
43 | */ | |
adaaa686 | 44 | virtual ~wxDocMDIParentFrame(); |
23324ae1 FM |
45 | |
46 | /** | |
47 | Creates the window. | |
48 | */ | |
4cc4bfaf | 49 | bool Create(wxDocManager* manager, wxFrame* parent, |
23324ae1 FM |
50 | wxWindowID id, const wxString& title, |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = wxDEFAULT_FRAME_STYLE, | |
408776d0 | 54 | const wxString& name = wxFrameNameStr); |
23324ae1 FM |
55 | |
56 | /** | |
57 | Deletes all views and documents. If no user input cancelled the | |
58 | operation, the frame will be destroyed and the application will exit. | |
0c1fe6e9 BP |
59 | |
60 | Since understanding how document/view clean-up takes place can be | |
61 | difficult, the implementation of this function is shown below: | |
62 | ||
63 | @code | |
64 | void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event) | |
65 | { | |
66 | if (m_docManager->Clear(!event.CanVeto())) | |
67 | { | |
68 | this->Destroy(); | |
69 | } | |
70 | else | |
71 | event.Veto(); | |
72 | } | |
73 | @endcode | |
23324ae1 FM |
74 | */ |
75 | void OnCloseWindow(wxCloseEvent& event); | |
76 | }; | |
77 | ||
78 | ||
e54c96f1 | 79 | |
23324ae1 FM |
80 | /** |
81 | @class wxDocMDIChildFrame | |
7c913512 | 82 | |
0c1fe6e9 BP |
83 | The wxDocMDIChildFrame class provides a default frame for displaying |
84 | documents on separate windows. This class can only be used for MDI child | |
85 | frames. | |
7c913512 | 86 | |
23324ae1 | 87 | The class is part of the document/view framework supported by wxWidgets, |
0c1fe6e9 BP |
88 | and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate |
89 | classes. | |
7c913512 | 90 | |
23324ae1 | 91 | @library{wxcore} |
0c1fe6e9 | 92 | @category{docview} |
7c913512 | 93 | |
0c1fe6e9 | 94 | @see @ref overview_docview, @ref page_samples_docview, wxMDIChildFrame |
23324ae1 FM |
95 | */ |
96 | class wxDocMDIChildFrame : public wxMDIChildFrame | |
97 | { | |
98 | public: | |
99 | /** | |
100 | Constructor. | |
101 | */ | |
102 | wxDocMDIChildFrame(wxDocument* doc, wxView* view, | |
408776d0 | 103 | wxMDIParentFrame* parent, wxWindowID id, |
23324ae1 FM |
104 | const wxString& title, |
105 | const wxPoint& pos = wxDefaultPosition, | |
106 | const wxSize& size = wxDefaultSize, | |
107 | long style = wxDEFAULT_FRAME_STYLE, | |
408776d0 | 108 | const wxString& name = wxFrameNameStr); |
23324ae1 FM |
109 | |
110 | /** | |
111 | Destructor. | |
112 | */ | |
adaaa686 | 113 | virtual ~wxDocMDIChildFrame(); |
23324ae1 FM |
114 | |
115 | /** | |
116 | Returns the document associated with this frame. | |
117 | */ | |
328f5751 | 118 | wxDocument* GetDocument() const; |
23324ae1 FM |
119 | |
120 | /** | |
121 | Returns the view associated with this frame. | |
122 | */ | |
328f5751 | 123 | wxView* GetView() const; |
23324ae1 FM |
124 | |
125 | /** | |
126 | Sets the currently active view to be the frame's view. You may need | |
127 | to override (but still call) this function in order to set the keyboard | |
128 | focus for your subwindow. | |
129 | */ | |
b91c4601 | 130 | void OnActivate(wxActivateEvent& event); |
23324ae1 FM |
131 | |
132 | /** | |
133 | Closes and deletes the current view and document. | |
134 | */ | |
135 | void OnCloseWindow(wxCloseEvent& event); | |
136 | ||
137 | /** | |
138 | Sets the document for this frame. | |
139 | */ | |
4cc4bfaf | 140 | void SetDocument(wxDocument* doc); |
23324ae1 FM |
141 | |
142 | /** | |
143 | Sets the view for this frame. | |
144 | */ | |
4cc4bfaf | 145 | void SetView(wxView* view); |
23324ae1 | 146 | }; |
e54c96f1 | 147 |