]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/mdi.h
Removed wxPG_EX_LEGACY_VALIDATORS
[wxWidgets.git] / interface / wx / mdi.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: mdi.h
e54c96f1 3// Purpose: interface of wxMDIClientWindow
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMDIClientWindow
5c3a762d 11 @wxheader{mdi.h}
7c913512 12
23324ae1
FM
13 An MDI client window is a child of wxMDIParentFrame, and manages zero or
14 more wxMDIChildFrame objects.
7c913512 15
23324ae1 16 @library{wxcore}
5c3a762d
FM
17 @category{managedwnd}
18
19 @remarks
20
21 The client window is the area where MDI child windows exist. It doesn't have to
22 cover the whole parent frame; other windows such as toolbars and a help window
23 might coexist with it. There can be scrollbars on a client window, which are
24 controlled by the parent window style.
25
26 The wxMDIClientWindow class is usually adequate without further derivation, and
27 it is created automatically when the MDI parent frame is created. If the application
28 needs to derive a new class, the function wxMDIParentFrame::OnCreateClient() must
29 be overridden in order to give an opportunity to use a different class of client
30 window.
31
32 Under Windows 95, the client window will automatically have a sunken border style
33 when the active child is not maximized, and no border style when a child is maximized.
7c913512 34
e54c96f1 35 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
23324ae1
FM
36*/
37class wxMDIClientWindow : public wxWindow
38{
39public:
5c3a762d
FM
40
41 /**
42 Default constructor.
43 */
44 wxMDIClientWindow();
45
23324ae1
FM
46 /**
47 Constructor, creating the window.
3c4f71cc 48
7c913512 49 @param parent
4cc4bfaf 50 The window parent.
7c913512 51 @param style
4cc4bfaf 52 The window style. Currently unused.
3c4f71cc 53
5c3a762d 54 @remarks This constructor is called within wxMDIParentFrame::OnCreateClient().
3c4f71cc 55
5c3a762d 56 @see wxMDIParentFrame::wxMDIParentFrame(), wxMDIParentFrame::OnCreateClient()
23324ae1 57 */
7c913512 58 wxMDIClientWindow(wxMDIParentFrame* parent, long style = 0);
23324ae1
FM
59
60 /**
61 Destructor.
62 */
adaaa686 63 virtual ~wxMDIClientWindow();
23324ae1
FM
64
65 /**
66 Used in two-step frame construction. See wxMDIClientWindow()
67 for further details.
68 */
adaaa686 69 virtual bool CreateClient(wxMDIParentFrame* parent, long style = 0);
23324ae1
FM
70};
71
72
e54c96f1 73
23324ae1
FM
74/**
75 @class wxMDIParentFrame
5c3a762d 76 @wxheader{mdi.h}
7c913512 77
23324ae1
FM
78 An MDI (Multiple Document Interface) parent frame is a window which can contain
79 MDI child frames in its own 'desktop'. It is a convenient way to avoid window
5c3a762d
FM
80 clutter, and is used in many popular Windows applications, such as Microsoft Word(TM).
81
82 @remarks
83
84 There may be multiple MDI parent frames in a single application, but this probably
85 only makes sense within programming development environments.
86
87 Child frames may be of class wxMDIChildFrame (contained within the parent frame)
88 or wxFrame (shown as a top-level frame).
89
90 An MDI parent frame always has a wxMDIClientWindow associated with it, which is the
91 parent for MDI child frames. This client window may be resized to accommodate non-MDI
92 windows, as seen in Microsoft Visual C++ (TM) and Microsoft Publisher (TM), where
93 a documentation window is placed to one side of the workspace.
94
95 MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete
96 user interface style.
97
98 The implementation is native in Windows, and simulated under Motif. Under Motif, the
99 child window frames will often have a different appearance from other frames because
100 the window decorations are simulated.
101
7c913512 102
23324ae1 103 @beginStyleTable
8c6791e4 104 @style{wxCAPTION}
23324ae1 105 Puts a caption on the frame.
8c6791e4 106 @style{wxDEFAULT_FRAME_STYLE}
5c3a762d
FM
107 Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
108 @c wxSYSTEM_MENU | @c wxCAPTION.
8c6791e4 109 @style{wxHSCROLL}
23324ae1
FM
110 Displays a horizontal scrollbar in the client window, allowing the
111 user to view child frames that are off the current view.
8c6791e4 112 @style{wxICONIZE}
23324ae1 113 Display the frame iconized (minimized) (Windows only).
8c6791e4 114 @style{wxMAXIMIZE}
23324ae1 115 Displays the frame maximized (Windows only).
8c6791e4 116 @style{wxMAXIMIZE_BOX}
23324ae1 117 Displays a maximize box on the frame (Windows and Motif only).
8c6791e4 118 @style{wxMINIMIZE}
5c3a762d 119 Identical to @c wxICONIZE.
8c6791e4 120 @style{wxMINIMIZE_BOX}
23324ae1 121 Displays a minimize box on the frame (Windows and Motif only).
8c6791e4 122 @style{wxRESIZE_BORDER}
23324ae1 123 Displays a resizeable border around the window (Motif only; for
5c3a762d 124 Windows, it is implicit in @c wxTHICK_FRAME).
8c6791e4 125 @style{wxSTAY_ON_TOP}
23324ae1 126 Stay on top of other windows (Windows only).
8c6791e4 127 @style{wxSYSTEM_MENU}
23324ae1 128 Displays a system menu (Windows and Motif only).
8c6791e4 129 @style{wxTHICK_FRAME}
23324ae1 130 Displays a thick frame around the window (Windows and Motif only).
8c6791e4 131 @style{wxVSCROLL}
23324ae1
FM
132 Displays a vertical scrollbar in the client window, allowing the
133 user to view child frames that are off the current view.
8c6791e4 134 @style{wxFRAME_NO_WINDOW_MENU}
23324ae1
FM
135 Under Windows, removes the Window menu that is normally added
136 automatically.
137 @endStyleTable
7c913512 138
23324ae1
FM
139 @library{wxcore}
140 @category{managedwnd}
7c913512 141
e54c96f1 142 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
23324ae1
FM
143*/
144class wxMDIParentFrame : public wxFrame
145{
146public:
5c3a762d
FM
147
148 /**
149 Default constructor.
150 */
151 wxMDIParentFrame();
152
23324ae1
FM
153 /**
154 Constructor, creating the window.
3c4f71cc 155
7c913512 156 @param parent
4cc4bfaf 157 The window parent. This should be @NULL.
7c913512 158 @param id
4cc4bfaf 159 The window identifier. It may take a value of -1 to indicate a default
5c3a762d 160 value.
7c913512 161 @param title
4cc4bfaf 162 The caption to be displayed on the frame's title bar.
7c913512 163 @param pos
5c3a762d
FM
164 The window position. The value @c wxDefaultPosition indicates a default position,
165 chosen by either the windowing system or wxWidgets, depending on platform.
7c913512 166 @param size
5c3a762d 167 The window size. The value @c wxDefaultSize indicates a default size, chosen by
4cc4bfaf 168 either the windowing system or wxWidgets, depending on platform.
7c913512 169 @param style
4cc4bfaf 170 The window style. See wxMDIParentFrame.
7c913512 171 @param name
5c3a762d
FM
172 The name of the window. This parameter is used to associate a name
173 with the item, allowing the application user to set Motif resource values
174 for individual windows.
3c4f71cc 175
23324ae1 176 @remarks During the construction of the frame, the client window will be
5c3a762d 177 created. To use a different class from wxMDIClientWindow, override
4cc4bfaf 178 OnCreateClient().
3c4f71cc 179
4cc4bfaf 180 @see Create(), OnCreateClient()
23324ae1 181 */
7c913512
FM
182 wxMDIParentFrame(wxWindow* parent, wxWindowID id,
183 const wxString& title,
184 const wxPoint& pos = wxDefaultPosition,
185 const wxSize& size = wxDefaultSize,
4cc4bfaf 186 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
7c913512 187 const wxString& name = "frame");
23324ae1
FM
188
189 /**
190 Destructor. Destroys all child windows and menu bar if present.
191 */
adaaa686 192 virtual ~wxMDIParentFrame();
23324ae1
FM
193
194 /**
195 Activates the MDI child following the currently active one.
3c4f71cc 196
4cc4bfaf 197 @see ActivatePrevious()
23324ae1 198 */
adaaa686 199 virtual void ActivateNext();
23324ae1
FM
200
201 /**
202 Activates the MDI child preceding the currently active one.
3c4f71cc 203
4cc4bfaf 204 @see ActivateNext()
23324ae1 205 */
adaaa686 206 virtual void ActivatePrevious();
23324ae1
FM
207
208 /**
209 Arranges any iconized (minimized) MDI child windows.
3c4f71cc 210
4cc4bfaf 211 @see Cascade(), Tile()
23324ae1 212 */
adaaa686 213 virtual void ArrangeIcons();
23324ae1
FM
214
215 /**
216 Arranges the MDI child windows in a cascade.
3c4f71cc 217
4cc4bfaf 218 @see Tile(), ArrangeIcons()
23324ae1 219 */
adaaa686 220 virtual void Cascade();
23324ae1
FM
221
222 /**
223 Used in two-step frame construction. See wxMDIParentFrame()
224 for further details.
225 */
226 bool Create(wxWindow* parent, wxWindowID id,
227 const wxString& title,
228 const wxPoint& pos = wxDefaultPosition,
229 const wxSize& size = wxDefaultSize,
4cc4bfaf 230 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
23324ae1
FM
231 const wxString& name = "frame");
232
233 /**
234 Returns a pointer to the active MDI child, if there is one.
235 */
328f5751 236 wxMDIChildFrame* GetActiveChild() const;
23324ae1
FM
237
238 /**
239 This gets the size of the frame 'client area' in pixels.
3c4f71cc 240
7c913512 241 @param width
4cc4bfaf 242 Receives the client width in pixels.
7c913512 243 @param height
4cc4bfaf 244 Receives the client height in pixels.
3c4f71cc 245
5c3a762d 246 @remarks
3c4f71cc 247
5c3a762d
FM
248 The client area is the area which may be drawn on by the programmer, excluding
249 title bar, border, status bar, and toolbar if present.
250
251 If you wish to manage your own toolbar (or perhaps you have more than one),
252 provide an @b OnSize event handler. Call GetClientSize() to find how much space
253 there is for your windows and don't forget to set the size and position of
254 the MDI client window as well as your toolbar and other windows (but not the
255 status bar).
256
257 If you have set a toolbar with wxMDIParentFrame::SetToolbar(), the client size
258 returned will have subtracted the toolbar height. However, the available positions
259 for the client window and other windows of the frame do not start at zero - you
260 must add the toolbar height.
261
262 The position and size of the status bar and toolbar (if known to the frame) are
263 always managed by wxMDIParentFrame, regardless of what behaviour is defined in
264 your @b OnSize event handler. However, the client window position and size are always
265 set in @b OnSize, so if you override this event handler, make sure you deal with the
266 client window.
267
268 You do not have to manage the size and position of MDI child windows, since they
269 are managed automatically by the client window.
270
271 @see GetToolBar(), SetToolBar(), wxMDIClientWindow
272
273 @beginWxPythonOnly
274 The wxPython version of this method takes no arguments and returns a tuple containing
275 width and height.
276 @endWxPythonOnly
23324ae1 277 */
328f5751 278 virtual void GetClientSize(int* width, int* height) const;
23324ae1
FM
279
280 /**
281 Returns a pointer to the client window.
3c4f71cc 282
4cc4bfaf 283 @see OnCreateClient()
23324ae1 284 */
328f5751 285 wxMDIClientWindow* GetClientWindow() const;
23324ae1
FM
286
287 /**
288 Returns the window being used as the toolbar for this frame.
3c4f71cc 289
4cc4bfaf 290 @see SetToolBar()
23324ae1 291 */
328f5751 292 virtual wxWindow* GetToolBar() const;
23324ae1
FM
293
294 /**
295 Returns the current Window menu (added by wxWidgets to the menubar). This
296 function
297 is available under Windows only.
298 */
328f5751 299 wxMenu* GetWindowMenu() const;
23324ae1
FM
300
301 /**
302 Override this to return a different kind of client window. If you override this
5c3a762d
FM
303 function, you must create your parent frame in two stages, or your function will
304 never be called, due to the way C++ treats virtual functions called from constructors.
305 For example:
306
307 @code
308 frame = new MyParentFrame;
309 frame->Create(parent, myParentFrameId, wxT("My Parent Frame"));
310 @endcode
3c4f71cc 311
5c3a762d
FM
312 @remarks
313
314 You might wish to derive from wxMDIClientWindow in order to implement different
315 erase behaviour, for example, such as painting a bitmap on the background.
316
317 Note that it is probably impossible to have a client window that scrolls
318 as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar
319 positions always return zero. (Solutions to: julian.smart@btopenworld.com).
3c4f71cc 320
4cc4bfaf 321 @see GetClientWindow(), wxMDIClientWindow
23324ae1
FM
322 */
323 virtual wxMDIClientWindow* OnCreateClient();
324
325 /**
326 Sets the window to be used as a toolbar for this
327 MDI parent window. It saves the application having to manage the positioning
328 of the toolbar MDI client window.
3c4f71cc 329
7c913512 330 @param toolbar
4cc4bfaf 331 Toolbar to manage.
3c4f71cc 332
5c3a762d
FM
333 @remarks
334
335 When the frame is resized, the toolbar is resized to be the width of the frame
336 client area, and the toolbar height is kept the same.
337
338 When the frame is resized, the toolbar is resized to be the width of the frame
339 client area, and the toolbar height is kept the same.
340
341 The parent of the toolbar must be this frame.
342
343 If you wish to manage your own toolbar (or perhaps you have more than one),
344 don't call this function, and instead manage your subwindows and the MDI client
345 window by providing an @b OnSize event handler. Call wxMDIParentFrame::GetClientSize()
346 to find how much space there is for your windows.
347
348 Note that SDI (normal) frames and MDI child windows must always have their toolbars
349 managed by the application.
3c4f71cc 350
4cc4bfaf 351 @see GetToolBar(), GetClientSize()
23324ae1
FM
352 */
353 virtual void SetToolBar(wxWindow* toolbar);
354
355 /**
356 Call this to change the current Window menu. Ownership of the menu object
5c3a762d
FM
357 passes to the frame when you call this function.
358
23324ae1 359 This call is available under Windows only.
5c3a762d
FM
360
361 To remove the window completely, use the @c wxFRAME_NO_WINDOW_MENU window style.
23324ae1
FM
362 */
363 void SetWindowMenu(wxMenu* menu);
364
365 /**
366 Tiles the MDI child windows either horizontally or vertically depending on
5c3a762d
FM
367 whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
368
23324ae1
FM
369 Currently only implemented for MSW, does nothing under the other platforms.
370 */
adaaa686 371 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
23324ae1
FM
372};
373
374
e54c96f1 375
23324ae1
FM
376/**
377 @class wxMDIChildFrame
5c3a762d 378 @wxheader{mdi.h}
7c913512 379
23324ae1
FM
380 An MDI child frame is a frame that can only exist on a wxMDIClientWindow,
381 which is itself a child of wxMDIParentFrame.
7c913512 382
23324ae1 383 @beginStyleTable
8c6791e4 384 @style{wxCAPTION}
23324ae1 385 Puts a caption on the frame.
8c6791e4 386 @style{wxDEFAULT_FRAME_STYLE}
5c3a762d
FM
387 Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
388 @c wxSYSTEM_MENU | @c wxCAPTION.
8c6791e4 389 @style{wxICONIZE}
23324ae1 390 Display the frame iconized (minimized) (Windows only).
8c6791e4 391 @style{wxMAXIMIZE}
23324ae1 392 Displays the frame maximized (Windows only).
8c6791e4 393 @style{wxMAXIMIZE_BOX}
23324ae1 394 Displays a maximize box on the frame (Windows and Motif only).
8c6791e4 395 @style{wxMINIMIZE}
5c3a762d 396 Identical to @c wxICONIZE.
8c6791e4 397 @style{wxMINIMIZE_BOX}
23324ae1 398 Displays a minimize box on the frame (Windows and Motif only).
8c6791e4 399 @style{wxRESIZE_BORDER}
23324ae1 400 Displays a resizeable border around the window (Motif only; for
5c3a762d 401 Windows, it is implicit in @c wxTHICK_FRAME).
8c6791e4 402 @style{wxSTAY_ON_TOP}
23324ae1 403 Stay on top of other windows (Windows only).
8c6791e4 404 @style{wxSYSTEM_MENU}
23324ae1 405 Displays a system menu (Windows and Motif only).
8c6791e4 406 @style{wxTHICK_FRAME}
23324ae1
FM
407 Displays a thick frame around the window (Windows and Motif only).
408 @endStyleTable
7c913512 409
23324ae1
FM
410 @library{wxcore}
411 @category{managedwnd}
7c913512 412
e54c96f1 413 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
23324ae1
FM
414*/
415class wxMDIChildFrame : public wxFrame
416{
417public:
5c3a762d
FM
418
419 /**
420 Default constructor.
421 */
422 wxMDIChildFrame();
423
23324ae1
FM
424 /**
425 Constructor, creating the window.
3c4f71cc 426
7c913512 427 @param parent
4cc4bfaf 428 The window parent. This should not be @NULL.
7c913512 429 @param id
4cc4bfaf 430 The window identifier. It may take a value of -1 to indicate a default
5c3a762d 431 value.
7c913512 432 @param title
4cc4bfaf 433 The caption to be displayed on the frame's title bar.
7c913512 434 @param pos
5c3a762d
FM
435 The window position. The value @c wxDefaultPosition indicates a default position,
436 chosen by either the windowing system or wxWidgets, depending on platform.
7c913512 437 @param size
5c3a762d 438 The window size. The value @c wxDefaultSize indicates a default size, chosen by
4cc4bfaf 439 either the windowing system or wxWidgets, depending on platform.
7c913512 440 @param style
4cc4bfaf 441 The window style. See wxMDIChildFrame.
7c913512 442 @param name
4cc4bfaf 443 The name of the window. This parameter is used to associate a name with the
5c3a762d
FM
444 item, allowing the application user to set Motif resource values for individual
445 windows.
3c4f71cc 446
4cc4bfaf 447 @see Create()
23324ae1 448 */
7c913512
FM
449 wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id,
450 const wxString& title,
451 const wxPoint& pos = wxDefaultPosition,
452 const wxSize& size = wxDefaultSize,
453 long style = wxDEFAULT_FRAME_STYLE,
454 const wxString& name = "frame");
23324ae1
FM
455
456 /**
457 Destructor. Destroys all child windows and menu bar if present.
458 */
adaaa686 459 virtual ~wxMDIChildFrame();
23324ae1
FM
460
461 /**
462 Activates this MDI child frame.
3c4f71cc 463
4cc4bfaf 464 @see Maximize(), Restore()
23324ae1 465 */
adaaa686 466 virtual void Activate();
23324ae1
FM
467
468 /**
469 Used in two-step frame construction. See wxMDIChildFrame()
470 for further details.
471 */
472 bool Create(wxWindow* parent, wxWindowID id,
473 const wxString& title,
474 const wxPoint& pos = wxDefaultPosition,
475 const wxSize& size = wxDefaultSize,
476 long style = wxDEFAULT_FRAME_STYLE,
477 const wxString& name = "frame");
478
479 /**
480 Maximizes this MDI child frame.
3c4f71cc 481
4cc4bfaf 482 @see Activate(), Restore()
23324ae1
FM
483 */
484 void Maximize(bool maximize);
485
486 /**
487 Restores this MDI child frame (unmaximizes).
488 */
adaaa686 489 virtual void Restore();
23324ae1 490};
e54c96f1 491