]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: docmdi.h | |
3 | // Purpose: interface of wxDocMDIParentFrame and wxDocMDIChildFrame | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxDocMDIParentFrame | |
11 | @wxheader{docmdi.h} | |
12 | ||
13 | The wxDocMDIParentFrame class provides a default top-level frame for | |
14 | applications using the document/view framework. This class can only be used | |
15 | for MDI parent frames. | |
16 | ||
17 | It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate | |
18 | classes. | |
19 | ||
20 | @library{wxcore} | |
21 | @category{docview} | |
22 | ||
23 | @see @ref overview_docview, @ref page_samples_docview, wxMDIParentFrame | |
24 | */ | |
25 | class wxDocMDIParentFrame : public wxMDIParentFrame | |
26 | { | |
27 | public: | |
28 | //@{ | |
29 | /** | |
30 | Constructor. | |
31 | */ | |
32 | wxDocMDIParentFrame(); | |
33 | wxDocMDIParentFrame(wxDocManager* manager, wxFrame* parent, | |
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"); | |
40 | //@} | |
41 | ||
42 | /** | |
43 | Destructor. | |
44 | */ | |
45 | ~wxDocMDIParentFrame(); | |
46 | ||
47 | /** | |
48 | Creates the window. | |
49 | */ | |
50 | bool Create(wxDocManager* manager, wxFrame* parent, | |
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. | |
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 | |
75 | */ | |
76 | void OnCloseWindow(wxCloseEvent& event); | |
77 | }; | |
78 | ||
79 | ||
80 | ||
81 | /** | |
82 | @class wxDocMDIChildFrame | |
83 | @wxheader{docmdi.h} | |
84 | ||
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. | |
88 | ||
89 | The class is part of the document/view framework supported by wxWidgets, | |
90 | and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate | |
91 | classes. | |
92 | ||
93 | @library{wxcore} | |
94 | @category{docview} | |
95 | ||
96 | @see @ref overview_docview, @ref page_samples_docview, wxMDIChildFrame | |
97 | */ | |
98 | class wxDocMDIChildFrame : public wxMDIChildFrame | |
99 | { | |
100 | public: | |
101 | /** | |
102 | Constructor. | |
103 | */ | |
104 | wxDocMDIChildFrame(wxDocument* doc, wxView* view, | |
105 | wxFrame* parent, wxWindowID id, | |
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 | */ | |
120 | wxDocument* GetDocument() const; | |
121 | ||
122 | /** | |
123 | Returns the view associated with this frame. | |
124 | */ | |
125 | wxView* GetView() const; | |
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 | */ | |
142 | void SetDocument(wxDocument* doc); | |
143 | ||
144 | /** | |
145 | Sets the view for this frame. | |
146 | */ | |
147 | void SetView(wxView* view); | |
148 | }; | |
149 |