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