]>
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 | ||
12 | The wxDocMDIParentFrame class provides a default top-level frame for | |
13 | applications using the document/view framework. This class can only be used | |
14 | for MDI parent frames. | |
15 | ||
16 | It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate | |
17 | classes. | |
18 | ||
19 | @library{wxcore} | |
20 | @category{docview} | |
21 | ||
22 | @see @ref overview_docview, @ref page_samples_docview, wxMDIParentFrame | |
23 | */ | |
24 | class wxDocMDIParentFrame : public wxMDIParentFrame | |
25 | { | |
26 | public: | |
27 | //@{ | |
28 | /** | |
29 | Constructor. | |
30 | */ | |
31 | wxDocMDIParentFrame(); | |
32 | wxDocMDIParentFrame(wxDocManager* manager, wxFrame* parent, | |
33 | wxWindowID id, | |
34 | const wxString& title, | |
35 | const wxPoint& pos = wxDefaultPosition, | |
36 | const wxSize& size = wxDefaultSize, | |
37 | long style = wxDEFAULT_FRAME_STYLE, | |
38 | const wxString& name = wxFrameNameStr); | |
39 | //@} | |
40 | ||
41 | /** | |
42 | Destructor. | |
43 | */ | |
44 | virtual ~wxDocMDIParentFrame(); | |
45 | ||
46 | /** | |
47 | Creates the window. | |
48 | */ | |
49 | bool Create(wxDocManager* manager, wxFrame* parent, | |
50 | wxWindowID id, const wxString& title, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | long style = wxDEFAULT_FRAME_STYLE, | |
54 | const wxString& name = wxFrameNameStr); | |
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. | |
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 | |
74 | */ | |
75 | void OnCloseWindow(wxCloseEvent& event); | |
76 | }; | |
77 | ||
78 | ||
79 | ||
80 | /** | |
81 | @class wxDocMDIChildFrame | |
82 | ||
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. | |
86 | ||
87 | The class is part of the document/view framework supported by wxWidgets, | |
88 | and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate | |
89 | classes. | |
90 | ||
91 | @library{wxcore} | |
92 | @category{docview} | |
93 | ||
94 | @see @ref overview_docview, @ref page_samples_docview, wxMDIChildFrame | |
95 | */ | |
96 | class wxDocMDIChildFrame : public wxMDIChildFrame | |
97 | { | |
98 | public: | |
99 | /** | |
100 | Constructor. | |
101 | */ | |
102 | wxDocMDIChildFrame(wxDocument* doc, wxView* view, | |
103 | wxMDIParentFrame* parent, wxWindowID id, | |
104 | const wxString& title, | |
105 | const wxPoint& pos = wxDefaultPosition, | |
106 | const wxSize& size = wxDefaultSize, | |
107 | long style = wxDEFAULT_FRAME_STYLE, | |
108 | const wxString& name = wxFrameNameStr); | |
109 | ||
110 | /** | |
111 | Destructor. | |
112 | */ | |
113 | virtual ~wxDocMDIChildFrame(); | |
114 | ||
115 | /** | |
116 | Returns the document associated with this frame. | |
117 | */ | |
118 | wxDocument* GetDocument() const; | |
119 | ||
120 | /** | |
121 | Returns the view associated with this frame. | |
122 | */ | |
123 | wxView* GetView() const; | |
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 | */ | |
130 | void OnActivate(wxActivateEvent& event); | |
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 | */ | |
140 | void SetDocument(wxDocument* doc); | |
141 | ||
142 | /** | |
143 | Sets the view for this frame. | |
144 | */ | |
145 | void SetView(wxView* view); | |
146 | }; | |
147 |