]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/mdi.h
fix few doxygen warnings
[wxWidgets.git] / interface / wx / mdi.h
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 @remarks
16
17 The client window is the area where MDI child windows exist. It doesn't have to
18 cover the whole parent frame; other windows such as toolbars and a help window
19 might coexist with it. There can be scrollbars on a client window, which are
20 controlled by the parent window style.
21
22 The wxMDIClientWindow class is usually adequate without further derivation, and
23 it is created automatically when the MDI parent frame is created. If the application
24 needs to derive a new class, the function wxMDIParentFrame::OnCreateClient() must
25 be overridden in order to give an opportunity to use a different class of client
26 window.
27
28 Under wxMSW, the client window will automatically have a sunken border style
29 when the active child is not maximized, and no border style when a child is maximized.
30
31 @library{wxcore}
32 @category{managedwnd}
33
34 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
35 */
36 class wxMDIClientWindow : public wxWindow
37 {
38 public:
39 /**
40 Default constructor.
41
42 Objects of this class are only created by wxMDIParentFrame which uses
43 the default constructor and calls CreateClient() immediately
44 afterwards.
45 */
46 wxMDIClientWindow();
47
48 /**
49 Called by wxMDIParentFrame immediately after creating the client
50 window.
51
52 This function may be overridden in the derived class but the base class
53 version must usually be called first to really create the window.
54
55 @param parent
56 The window parent.
57 @param style
58 The window style. Only wxHSCROLL and wxVSCROLL bits are meaningful
59 here.
60
61 */
62 virtual bool CreateClient(wxMDIParentFrame* parent, long style = 0);
63 };
64
65
66
67 /**
68 @class wxMDIParentFrame
69
70 An MDI (Multiple Document Interface) parent frame is a window which can
71 contain MDI child frames in its client area which emulates the full
72 desktop.
73
74 MDI is a user-interface model in which all the window reside inside the
75 single parent window as opposed to being separate from each other. It
76 remains popular despite dire warnings from Microsoft itself (which
77 popularized this model in the first model) that MDI is obsolete.
78
79 An MDI parent frame always has a wxMDIClientWindow associated with it,
80 which is the parent for MDI child frames. In the simplest case, the client
81 window takes up the entire parent frame area but it is also possible to
82 resize it to be smaller in order to have other windows in the frame, a
83 typical example is using a sidebar along one of the window edges.
84
85 The appearance of MDI applications differs between different ports. The
86 classic MDI model, with child windows which can be independently moved,
87 resized etc, is only available under MSW, which provides native support for
88 it. In Mac ports, multiple top level windows are used for the MDI children
89 too and the MDI parent frame itself is invisible, to accommodate the native
90 look and feel requirements. In all the other ports, a tab-based MDI
91 implementation (sometimes called TDI) is used and so at most one MDI child
92 is visible at any moment (child frames are always maximized).
93
94 @remarks
95
96 Although it is possible to have multiple MDI parent frames, a typical MDI
97 application has a single MDI parent frame window inside which multiple MDI
98 child frames, i.e. objects of class wxMDIChildFrame, can be created.
99
100
101 @beginStyleTable
102
103 There are no special styles for this class, all wxFrame styles apply to it
104 in the usual way. The only exception is that wxHSCROLL and wxVSCROLL styles
105 apply not to the frame itself but to the client window, so that using them
106 enables horizontal and vertical scrollbars for this window and not the
107 frame.
108
109 @endStyleTable
110
111 @library{wxcore}
112 @category{managedwnd}
113
114 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
115 */
116 class wxMDIParentFrame : public wxFrame
117 {
118 public:
119
120 /**
121 Default constructor.
122
123 Use Create() for the objects created using this constructor.
124 */
125 wxMDIParentFrame();
126
127 /**
128 Constructor, creating the window.
129
130 Notice that if you override virtual OnCreateClient() method you
131 shouldn't be using this constructor but the default constructor and
132 Create() as otherwise your overridden method is never going to be
133 called because of the usual C++ virtual call resolution rules.
134
135 @param parent
136 The window parent. Usually is @NULL.
137 @param id
138 The window identifier. It may take a value of @c wxID_ANY to
139 indicate a default value.
140 @param title
141 The caption to be displayed on the frame's title bar.
142 @param pos
143 The window position. The value @c wxDefaultPosition indicates a
144 default position, chosen by either the windowing system or
145 wxWidgets, depending on platform.
146 @param size
147 The window size. The value @c wxDefaultSize indicates a default
148 size, chosen by either the windowing system or wxWidgets, depending
149 on platform.
150 @param style
151 The window style. Default value includes wxHSCROLL and wxVSCROLL
152 styles.
153 @param name
154 The name of the window. This parameter is used to associate a name
155 with the item, allowing the application user to set Motif resource
156 values for individual windows.
157
158 @remarks
159
160 Under wxMSW, the client window will automatically have a sunken
161 border style when the active child is not maximized, and no border
162 style when a child is maximized.
163
164 @see Create(), OnCreateClient()
165 */
166 wxMDIParentFrame(wxWindow* parent, wxWindowID id,
167 const wxString& title,
168 const wxPoint& pos = wxDefaultPosition,
169 const wxSize& size = wxDefaultSize,
170 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
171 const wxString& name = wxFrameNameStr);
172
173 /**
174 Destructor.
175
176 Destroys all child windows and menu bar if present.
177 */
178 virtual ~wxMDIParentFrame();
179
180 /**
181 Activates the MDI child following the currently active one.
182
183 The MDI children are maintained in an ordered list and this function
184 switches to the next element in this list, wrapping around the end of
185 it if the currently active child is the last one.
186
187 @see ActivatePrevious()
188 */
189 virtual void ActivateNext();
190
191 /**
192 Activates the MDI child preceding the currently active one.
193
194 @see ActivateNext()
195 */
196 virtual void ActivatePrevious();
197
198 /**
199 Arranges any iconized (minimized) MDI child windows.
200
201 This method is only implemented in MSW MDI implementation and does
202 nothing under the other platforms.
203
204 @see Cascade(), Tile()
205 */
206 virtual void ArrangeIcons();
207
208 /**
209 Arranges the MDI child windows in a cascade.
210
211 This method is only implemented in MSW MDI implementation and does
212 nothing under the other platforms.
213
214 @see Tile(), ArrangeIcons()
215 */
216 virtual void Cascade();
217
218 /**
219 Used in two-step frame construction.
220
221 See wxMDIParentFrame() for further details.
222 */
223 bool Create(wxWindow* parent,
224 wxWindowID id,
225 const wxString& title,
226 const wxPoint& pos = wxDefaultPosition,
227 const wxSize& size = wxDefaultSize,
228 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
229 const wxString& name = wxFrameNameStr);
230
231 /**
232 Returns a pointer to the active MDI child, if there is one.
233
234 If there are any children at all this function returns a non-@NULL
235 pointer.
236 */
237 virtual wxMDIChildFrame* GetActiveChild() const;
238
239 /**
240 Returns a pointer to the client window.
241
242 @see OnCreateClient()
243 */
244 wxMDIClientWindowBase* GetClientWindow() const;
245
246 /**
247 Returns the current MDI Window menu.
248
249 Unless wxFRAME_NO_WINDOW_MENU style was used, a default menu listing
250 all the currently active children and providing the usual operations
251 (tile, cascade, ...) on them is created automatically by the library
252 and this function can be used to retrieve it. Notice that the default
253 menu can be replaced by calling SetWindowMenu().
254
255 This function is currently not available under OS X.
256
257 @return The current Window menu or @NULL.
258 */
259 wxMenu *GetWindowMenu() const;
260
261 /**
262 Returns whether the MDI implementation is tab-based.
263
264 Currently only the MSW port uses the real MDI. In Mac ports the usual
265 SDI is used, as common under this platforms, and all the other ports
266 use TDI implementation.
267
268 TDI-based MDI applications have different appearance and functionality
269 (e.g. child frames can't be minimized and only one of them is visible
270 at any given time) so the application may need to adapt its interface
271 somewhat depending on the return value of this function.
272 */
273 static bool IsTDI();
274
275 /**
276 Override this to return a different kind of client window.
277
278 If you override this function, you must create your parent frame in two
279 stages, or your function will never be called, due to the way C++
280 treats virtual functions called from constructors. For example:
281
282 @code
283 frame = new MyParentFrame;
284 frame->Create(parent, myParentFrameId, wxT("My Parent Frame"));
285 @endcode
286
287 @remarks
288
289 You might wish to derive from wxMDIClientWindow in order to implement
290 different erase behaviour, for example, such as painting a bitmap on
291 the background.
292
293 Note that it is probably impossible to have a client window that scrolls
294 as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar
295 positions always return zero.
296
297 @see GetClientWindow(), wxMDIClientWindow
298 */
299 virtual wxMDIClientWindow* OnCreateClient();
300
301 /**
302 Replace the current MDI Window menu.
303
304 Ownership of the menu object passes to the frame when you call this
305 function, i.e. the menu will be deleted by it when it's no longer
306 needed (usually when the frame itself is deleted or when
307 SetWindowMenu() is called again).
308
309 To remove the window completely, you can use the wxFRAME_NO_WINDOW_MENU
310 window style but this function also allows to do it by passing @NULL
311 pointer as @a menu.
312
313 This function is currently not available under OS X.
314
315 @param menu
316 The menu to be used instead of the standard MDI Window menu or @NULL.
317 */
318 virtual void SetWindowMenu(wxMenu* menu);
319
320 /**
321 Tiles the MDI child windows either horizontally or vertically depending
322 on whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
323
324 This method is only implemented in MSW MDI implementation and does
325 nothing under the other platforms.
326
327 */
328 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
329 };
330
331
332
333 /**
334 @class wxMDIChildFrame
335
336 An MDI child frame is a frame that can only exist inside a
337 wxMDIClientWindow, which is itself a child of wxMDIParentFrame.
338
339 @beginStyleTable
340 All of the standard wxFrame styles can be used but most of them are ignored
341 by TDI-based MDI implementations.
342 @endStyleTable
343
344 @remarks
345 Although internally an MDI child frame is a child of the MDI client window,
346 in wxWidgets you create it as a child of wxMDIParentFrame. In fact, you can
347 usually forget that the client window exists. MDI child frames are clipped
348 to the area of the MDI client window, and may be iconized on the client
349 window. You can associate a menubar with a child frame as usual, although
350 an MDI child doesn't display its menubar under its own title bar. The MDI
351 parent frame's menubar will be changed to reflect the currently active
352 child frame. If there are currently no children, the parent frame's own
353 menubar will be displayed.
354
355 @library{wxcore}
356 @category{managedwnd}
357
358 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
359 */
360 class wxMDIChildFrame : public wxFrame
361 {
362 public:
363 /**
364 Default constructor.
365 */
366 wxMDIChildFrame();
367
368 /**
369 Constructor, creating the window.
370
371 @param parent
372 The window parent. This should not be @NULL.
373 @param id
374 The window identifier. It may take a value of -1 to indicate a default
375 value.
376 @param title
377 The caption to be displayed on the frame's title bar.
378 @param pos
379 The window position. The value @c wxDefaultPosition indicates a default position,
380 chosen by either the windowing system or wxWidgets, depending on platform.
381 @param size
382 The window size. The value @c wxDefaultSize indicates a default size, chosen by
383 either the windowing system or wxWidgets, depending on platform.
384 @param style
385 The window style. See wxMDIChildFrame.
386 @param name
387 The name of the window. This parameter is used to associate a name with the
388 item, allowing the application user to set Motif resource values for individual
389 windows.
390
391 @see Create()
392 */
393 wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id,
394 const wxString& title,
395 const wxPoint& pos = wxDefaultPosition,
396 const wxSize& size = wxDefaultSize,
397 long style = wxDEFAULT_FRAME_STYLE,
398 const wxString& name = wxFrameNameStr);
399
400 /**
401 Destructor. Destroys all child windows and menu bar if present.
402 */
403 virtual ~wxMDIChildFrame();
404
405 /**
406 Activates this MDI child frame.
407
408 @see Maximize(), Restore()
409 */
410 virtual void Activate();
411
412 /**
413 Used in two-step frame construction.
414 See wxMDIChildFrame() for further details.
415 */
416 bool Create(wxMDIParentFrame* parent, wxWindowID id, const wxString& title,
417 const wxPoint& pos = wxDefaultPosition,
418 const wxSize& size = wxDefaultSize,
419 long style = wxDEFAULT_FRAME_STYLE,
420 const wxString& name = wxFrameNameStr);
421
422 /**
423 Returns the MDI parent frame containing this child.
424
425 Notice that this may return a different object than GetParent() as the
426 child frames may be created as children of the client window
427 internally.
428 */
429 wxMDIParentFrame *GetMDIParent() const;
430
431 /**
432 Returns true for MDI children in TDI implementations.
433
434 TDI-based implementations represent MDI children as pages in a
435 wxNotebook and so they are always maximized and can't be restored or
436 iconized.
437
438 @see wxMDIParentFrame::IsTDI().
439 */
440 virtual bool IsAlwaysMaximized() const;
441
442 /**
443 Maximizes this MDI child frame.
444
445 This function doesn't do anything if IsAlwaysMaximized() returns @true.
446
447 @see Activate(), Restore()
448 */
449 virtual void Maximize(bool maximize = true);
450
451 /**
452 Restores this MDI child frame (unmaximizes).
453
454 This function doesn't do anything if IsAlwaysMaximized() returns @true.
455
456 @see Activate(), Maximize()
457 */
458 virtual void Restore();
459 };
460