]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: mdi.h | |
3 | // Purpose: interface of wxMDIClientWindow | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxMDIClientWindow | |
11 | ||
12 | An MDI client window is a child of wxMDIParentFrame, and manages zero or | |
13 | more wxMDIChildFrame objects. | |
14 | ||
15 | @library{wxcore} | |
16 | @category{FIXME} | |
17 | ||
18 | @see wxMDIChildFrame, wxMDIParentFrame, wxFrame | |
19 | */ | |
20 | class wxMDIClientWindow : public wxWindow | |
21 | { | |
22 | public: | |
23 | //@{ | |
24 | /** | |
25 | Constructor, creating the window. | |
26 | ||
27 | @param parent | |
28 | The window parent. | |
29 | @param style | |
30 | The window style. Currently unused. | |
31 | ||
32 | @remarks The second style of constructor is called within | |
33 | wxMDIParentFrame::OnCreateClient. | |
34 | ||
35 | @see wxMDIParentFrame::wxMDIParentFrame, wxMDIParentFrame::OnCreateClient | |
36 | */ | |
37 | wxMDIClientWindow(); | |
38 | wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0); | |
39 | //@} | |
40 | ||
41 | /** | |
42 | Destructor. | |
43 | */ | |
44 | ~wxMDIClientWindow(); | |
45 | ||
46 | /** | |
47 | Used in two-step frame construction. See wxMDIClientWindow() | |
48 | for further details. | |
49 | */ | |
50 | bool CreateClient(wxMDIParentFrame* parent, long style = 0); | |
51 | }; | |
52 | ||
53 | ||
54 | ||
55 | /** | |
56 | @class wxMDIParentFrame | |
57 | ||
58 | An MDI (Multiple Document Interface) parent frame is a window which can contain | |
59 | MDI child frames in its own 'desktop'. It is a convenient way to avoid window | |
60 | clutter, | |
61 | and is used in many popular Windows applications, such as Microsoft Word(TM). | |
62 | ||
63 | @beginStyleTable | |
64 | @style{wxCAPTION} | |
65 | Puts a caption on the frame. | |
66 | @style{wxDEFAULT_FRAME_STYLE} | |
67 | Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | | |
68 | wxSYSTEM_MENU | wxCAPTION. | |
69 | @style{wxHSCROLL} | |
70 | Displays a horizontal scrollbar in the client window, allowing the | |
71 | user to view child frames that are off the current view. | |
72 | @style{wxICONIZE} | |
73 | Display the frame iconized (minimized) (Windows only). | |
74 | @style{wxMAXIMIZE} | |
75 | Displays the frame maximized (Windows only). | |
76 | @style{wxMAXIMIZE_BOX} | |
77 | Displays a maximize box on the frame (Windows and Motif only). | |
78 | @style{wxMINIMIZE} | |
79 | Identical to wxICONIZE. | |
80 | @style{wxMINIMIZE_BOX} | |
81 | Displays a minimize box on the frame (Windows and Motif only). | |
82 | @style{wxRESIZE_BORDER} | |
83 | Displays a resizeable border around the window (Motif only; for | |
84 | Windows, it is implicit in wxTHICK_FRAME). | |
85 | @style{wxSTAY_ON_TOP} | |
86 | Stay on top of other windows (Windows only). | |
87 | @style{wxSYSTEM_MENU} | |
88 | Displays a system menu (Windows and Motif only). | |
89 | @style{wxTHICK_FRAME} | |
90 | Displays a thick frame around the window (Windows and Motif only). | |
91 | @style{wxVSCROLL} | |
92 | Displays a vertical scrollbar in the client window, allowing the | |
93 | user to view child frames that are off the current view. | |
94 | @style{wxFRAME_NO_WINDOW_MENU} | |
95 | Under Windows, removes the Window menu that is normally added | |
96 | automatically. | |
97 | @endStyleTable | |
98 | ||
99 | @library{wxcore} | |
100 | @category{managedwnd} | |
101 | ||
102 | @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog | |
103 | */ | |
104 | class wxMDIParentFrame : public wxFrame | |
105 | { | |
106 | public: | |
107 | //@{ | |
108 | /** | |
109 | Constructor, creating the window. | |
110 | ||
111 | @param parent | |
112 | The window parent. This should be @NULL. | |
113 | @param id | |
114 | The window identifier. It may take a value of -1 to indicate a default | |
115 | value. | |
116 | @param title | |
117 | The caption to be displayed on the frame's title bar. | |
118 | @param pos | |
119 | The window position. The value wxDefaultPosition indicates a default position, | |
120 | chosen by | |
121 | either the windowing system or wxWidgets, depending on platform. | |
122 | @param size | |
123 | The window size. The value wxDefaultSize indicates a default size, chosen by | |
124 | either the windowing system or wxWidgets, depending on platform. | |
125 | @param style | |
126 | The window style. See wxMDIParentFrame. | |
127 | @param name | |
128 | The name of the window. This parameter is used to associate a name with the | |
129 | item, | |
130 | allowing the application user to set Motif resource values for | |
131 | individual windows. | |
132 | ||
133 | @remarks During the construction of the frame, the client window will be | |
134 | created. To use a different class from | |
135 | wxMDIClientWindow, override | |
136 | OnCreateClient(). | |
137 | ||
138 | @see Create(), OnCreateClient() | |
139 | */ | |
140 | wxMDIParentFrame(); | |
141 | wxMDIParentFrame(wxWindow* parent, wxWindowID id, | |
142 | const wxString& title, | |
143 | const wxPoint& pos = wxDefaultPosition, | |
144 | const wxSize& size = wxDefaultSize, | |
145 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
146 | const wxString& name = "frame"); | |
147 | //@} | |
148 | ||
149 | /** | |
150 | Destructor. Destroys all child windows and menu bar if present. | |
151 | */ | |
152 | ~wxMDIParentFrame(); | |
153 | ||
154 | /** | |
155 | Activates the MDI child following the currently active one. | |
156 | ||
157 | @see ActivatePrevious() | |
158 | */ | |
159 | void ActivateNext(); | |
160 | ||
161 | /** | |
162 | Activates the MDI child preceding the currently active one. | |
163 | ||
164 | @see ActivateNext() | |
165 | */ | |
166 | void ActivatePrevious(); | |
167 | ||
168 | /** | |
169 | Arranges any iconized (minimized) MDI child windows. | |
170 | ||
171 | @see Cascade(), Tile() | |
172 | */ | |
173 | void ArrangeIcons(); | |
174 | ||
175 | /** | |
176 | Arranges the MDI child windows in a cascade. | |
177 | ||
178 | @see Tile(), ArrangeIcons() | |
179 | */ | |
180 | void Cascade(); | |
181 | ||
182 | /** | |
183 | Used in two-step frame construction. See wxMDIParentFrame() | |
184 | for further details. | |
185 | */ | |
186 | bool Create(wxWindow* parent, wxWindowID id, | |
187 | const wxString& title, | |
188 | const wxPoint& pos = wxDefaultPosition, | |
189 | const wxSize& size = wxDefaultSize, | |
190 | long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL, | |
191 | const wxString& name = "frame"); | |
192 | ||
193 | /** | |
194 | Returns a pointer to the active MDI child, if there is one. | |
195 | */ | |
196 | wxMDIChildFrame* GetActiveChild() const; | |
197 | ||
198 | /** | |
199 | This gets the size of the frame 'client area' in pixels. | |
200 | ||
201 | @param width | |
202 | Receives the client width in pixels. | |
203 | @param height | |
204 | Receives the client height in pixels. | |
205 | ||
206 | @remarks The client area is the area which may be drawn on by the | |
207 | programmer, excluding title bar, border, status bar, | |
208 | and toolbar if present. | |
209 | ||
210 | @see GetToolBar(), SetToolBar(), | |
211 | wxMDIClientWindow | |
212 | */ | |
213 | virtual void GetClientSize(int* width, int* height) const; | |
214 | ||
215 | /** | |
216 | Returns a pointer to the client window. | |
217 | ||
218 | @see OnCreateClient() | |
219 | */ | |
220 | wxMDIClientWindow* GetClientWindow() const; | |
221 | ||
222 | /** | |
223 | Returns the window being used as the toolbar for this frame. | |
224 | ||
225 | @see SetToolBar() | |
226 | */ | |
227 | virtual wxWindow* GetToolBar() const; | |
228 | ||
229 | /** | |
230 | Returns the current Window menu (added by wxWidgets to the menubar). This | |
231 | function | |
232 | is available under Windows only. | |
233 | */ | |
234 | wxMenu* GetWindowMenu() const; | |
235 | ||
236 | /** | |
237 | Override this to return a different kind of client window. If you override this | |
238 | function, | |
239 | you must create your parent frame in two stages, or your function will never be | |
240 | called, | |
241 | due to the way C++ treats virtual functions called from constructors. For | |
242 | example: | |
243 | ||
244 | @remarks You might wish to derive from wxMDIClientWindow in order to | |
245 | implement different erase behaviour, for example, such | |
246 | as painting a bitmap on the background. | |
247 | ||
248 | @see GetClientWindow(), wxMDIClientWindow | |
249 | */ | |
250 | virtual wxMDIClientWindow* OnCreateClient(); | |
251 | ||
252 | /** | |
253 | Sets the window to be used as a toolbar for this | |
254 | MDI parent window. It saves the application having to manage the positioning | |
255 | of the toolbar MDI client window. | |
256 | ||
257 | @param toolbar | |
258 | Toolbar to manage. | |
259 | ||
260 | @remarks When the frame is resized, the toolbar is resized to be the | |
261 | width of the frame client area, and the toolbar height | |
262 | is kept the same. | |
263 | ||
264 | @see GetToolBar(), GetClientSize() | |
265 | */ | |
266 | virtual void SetToolBar(wxWindow* toolbar); | |
267 | ||
268 | /** | |
269 | Call this to change the current Window menu. Ownership of the menu object | |
270 | passes to | |
271 | the frame when you call this function. | |
272 | This call is available under Windows only. | |
273 | To remove the window completely, use the wxFRAME_NO_WINDOW_MENU window style. | |
274 | */ | |
275 | void SetWindowMenu(wxMenu* menu); | |
276 | ||
277 | /** | |
278 | Tiles the MDI child windows either horizontally or vertically depending on | |
279 | whether @a orient is wxHORIZONTAL or wxVERTICAL. | |
280 | Currently only implemented for MSW, does nothing under the other platforms. | |
281 | */ | |
282 | void Tile(wxOrientation orient = wxHORIZONTAL); | |
283 | }; | |
284 | ||
285 | ||
286 | ||
287 | /** | |
288 | @class wxMDIChildFrame | |
289 | ||
290 | An MDI child frame is a frame that can only exist on a wxMDIClientWindow, | |
291 | which is itself a child of wxMDIParentFrame. | |
292 | ||
293 | @beginStyleTable | |
294 | @style{wxCAPTION} | |
295 | Puts a caption on the frame. | |
296 | @style{wxDEFAULT_FRAME_STYLE} | |
297 | Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxTHICK_FRAME | | |
298 | wxSYSTEM_MENU | wxCAPTION. | |
299 | @style{wxICONIZE} | |
300 | Display the frame iconized (minimized) (Windows only). | |
301 | @style{wxMAXIMIZE} | |
302 | Displays the frame maximized (Windows only). | |
303 | @style{wxMAXIMIZE_BOX} | |
304 | Displays a maximize box on the frame (Windows and Motif only). | |
305 | @style{wxMINIMIZE} | |
306 | Identical to wxICONIZE. | |
307 | @style{wxMINIMIZE_BOX} | |
308 | Displays a minimize box on the frame (Windows and Motif only). | |
309 | @style{wxRESIZE_BORDER} | |
310 | Displays a resizeable border around the window (Motif only; for | |
311 | Windows, it is implicit in wxTHICK_FRAME). | |
312 | @style{wxSTAY_ON_TOP} | |
313 | Stay on top of other windows (Windows only). | |
314 | @style{wxSYSTEM_MENU} | |
315 | Displays a system menu (Windows and Motif only). | |
316 | @style{wxTHICK_FRAME} | |
317 | Displays a thick frame around the window (Windows and Motif only). | |
318 | @endStyleTable | |
319 | ||
320 | @library{wxcore} | |
321 | @category{managedwnd} | |
322 | ||
323 | @see wxMDIClientWindow, wxMDIParentFrame, wxFrame | |
324 | */ | |
325 | class wxMDIChildFrame : public wxFrame | |
326 | { | |
327 | public: | |
328 | //@{ | |
329 | /** | |
330 | Constructor, creating the window. | |
331 | ||
332 | @param parent | |
333 | The window parent. This should not be @NULL. | |
334 | @param id | |
335 | The window identifier. It may take a value of -1 to indicate a default | |
336 | value. | |
337 | @param title | |
338 | The caption to be displayed on the frame's title bar. | |
339 | @param pos | |
340 | The window position. The value wxDefaultPosition indicates a default position, | |
341 | chosen by | |
342 | either the windowing system or wxWidgets, depending on platform. | |
343 | @param size | |
344 | The window size. The value wxDefaultSize indicates a default size, chosen by | |
345 | either the windowing system or wxWidgets, depending on platform. | |
346 | @param style | |
347 | The window style. See wxMDIChildFrame. | |
348 | @param name | |
349 | The name of the window. This parameter is used to associate a name with the | |
350 | item, | |
351 | allowing the application user to set Motif resource values for | |
352 | individual windows. | |
353 | ||
354 | @remarks None. | |
355 | ||
356 | @see Create() | |
357 | */ | |
358 | wxMDIChildFrame(); | |
359 | wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id, | |
360 | const wxString& title, | |
361 | const wxPoint& pos = wxDefaultPosition, | |
362 | const wxSize& size = wxDefaultSize, | |
363 | long style = wxDEFAULT_FRAME_STYLE, | |
364 | const wxString& name = "frame"); | |
365 | //@} | |
366 | ||
367 | /** | |
368 | Destructor. Destroys all child windows and menu bar if present. | |
369 | */ | |
370 | ~wxMDIChildFrame(); | |
371 | ||
372 | /** | |
373 | Activates this MDI child frame. | |
374 | ||
375 | @see Maximize(), Restore() | |
376 | */ | |
377 | void Activate(); | |
378 | ||
379 | /** | |
380 | Used in two-step frame construction. See wxMDIChildFrame() | |
381 | for further details. | |
382 | */ | |
383 | bool Create(wxWindow* parent, wxWindowID id, | |
384 | const wxString& title, | |
385 | const wxPoint& pos = wxDefaultPosition, | |
386 | const wxSize& size = wxDefaultSize, | |
387 | long style = wxDEFAULT_FRAME_STYLE, | |
388 | const wxString& name = "frame"); | |
389 | ||
390 | /** | |
391 | Maximizes this MDI child frame. | |
392 | ||
393 | @see Activate(), Restore() | |
394 | */ | |
395 | void Maximize(bool maximize); | |
396 | ||
397 | /** | |
398 | Restores this MDI child frame (unmaximizes). | |
399 | */ | |
400 | void Restore(); | |
401 | }; | |
402 |