]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/mdi.h
Add wxDataViewCtrl::GetCurrentColumn().
[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$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxMDIClientWindow
7c913512 11
23324ae1
FM
12 An MDI client window is a child of wxMDIParentFrame, and manages zero or
13 more wxMDIChildFrame objects.
7c913512 14
5c3a762d
FM
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
bb69632a 28 Under wxMSW, the client window will automatically have a sunken border style
5c3a762d 29 when the active child is not maximized, and no border style when a child is maximized.
7c913512 30
ba1d7a6c
FM
31 @library{wxcore}
32 @category{managedwnd}
33
e54c96f1 34 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
23324ae1
FM
35*/
36class wxMDIClientWindow : public wxWindow
37{
38public:
5c3a762d
FM
39 /**
40 Default constructor.
d2824cdb
VZ
41
42 Objects of this class are only created by wxMDIParentFrame which uses
43 the default constructor and calls CreateClient() immediately
44 afterwards.
45 */
5c3a762d
FM
46 wxMDIClientWindow();
47
23324ae1 48 /**
d2824cdb
VZ
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.
3c4f71cc 54
7c913512 55 @param parent
4cc4bfaf 56 The window parent.
7c913512 57 @param style
d2824cdb
VZ
58 The window style. Only wxHSCROLL and wxVSCROLL bits are meaningful
59 here.
3c4f71cc 60
23324ae1 61 */
adaaa686 62 virtual bool CreateClient(wxMDIParentFrame* parent, long style = 0);
23324ae1
FM
63};
64
65
e54c96f1 66
23324ae1
FM
67/**
68 @class wxMDIParentFrame
7c913512 69
d2824cdb
VZ
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).
5c3a762d
FM
93
94 @remarks
95
d2824cdb
VZ
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.
5c3a762d 99
5c3a762d 100
d2824cdb 101 @beginStyleTable
5c3a762d 102
d2824cdb
VZ
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.
7c913512 108
23324ae1 109 @endStyleTable
7c913512 110
23324ae1
FM
111 @library{wxcore}
112 @category{managedwnd}
7c913512 113
e54c96f1 114 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
23324ae1
FM
115*/
116class wxMDIParentFrame : public wxFrame
117{
118public:
5c3a762d
FM
119
120 /**
121 Default constructor.
d2824cdb
VZ
122
123 Use Create() for the objects created using this constructor.
5c3a762d
FM
124 */
125 wxMDIParentFrame();
126
23324ae1
FM
127 /**
128 Constructor, creating the window.
3c4f71cc 129
d2824cdb
VZ
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
7c913512 135 @param parent
d2824cdb 136 The window parent. Usually is @NULL.
7c913512 137 @param id
d2824cdb
VZ
138 The window identifier. It may take a value of @c wxID_ANY to
139 indicate a default value.
7c913512 140 @param title
4cc4bfaf 141 The caption to be displayed on the frame's title bar.
7c913512 142 @param pos
76e2b570 143 The window position. The value ::wxDefaultPosition indicates a
d2824cdb
VZ
144 default position, chosen by either the windowing system or
145 wxWidgets, depending on platform.
7c913512 146 @param size
76e2b570 147 The window size. The value ::wxDefaultSize indicates a default
d2824cdb
VZ
148 size, chosen by either the windowing system or wxWidgets, depending
149 on platform.
7c913512 150 @param style
d2824cdb
VZ
151 The window style. Default value includes wxHSCROLL and wxVSCROLL
152 styles.
7c913512 153 @param name
5c3a762d 154 The name of the window. This parameter is used to associate a name
d2824cdb
VZ
155 with the item, allowing the application user to set Motif resource
156 values for individual windows.
157
158 @remarks
3c4f71cc 159
bb69632a 160 Under wxMSW, the client window will automatically have a sunken
d2824cdb
VZ
161 border style when the active child is not maximized, and no border
162 style when a child is maximized.
3c4f71cc 163
4cc4bfaf 164 @see Create(), OnCreateClient()
23324ae1 165 */
7c913512
FM
166 wxMDIParentFrame(wxWindow* parent, wxWindowID id,
167 const wxString& title,
168 const wxPoint& pos = wxDefaultPosition,
169 const wxSize& size = wxDefaultSize,
4cc4bfaf 170 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
408776d0 171 const wxString& name = wxFrameNameStr);
23324ae1
FM
172
173 /**
d2824cdb
VZ
174 Destructor.
175
176 Destroys all child windows and menu bar if present.
23324ae1 177 */
adaaa686 178 virtual ~wxMDIParentFrame();
23324ae1
FM
179
180 /**
181 Activates the MDI child following the currently active one.
3c4f71cc 182
d2824cdb
VZ
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
4cc4bfaf 187 @see ActivatePrevious()
23324ae1 188 */
adaaa686 189 virtual void ActivateNext();
23324ae1
FM
190
191 /**
192 Activates the MDI child preceding the currently active one.
3c4f71cc 193
4cc4bfaf 194 @see ActivateNext()
23324ae1 195 */
adaaa686 196 virtual void ActivatePrevious();
23324ae1
FM
197
198 /**
199 Arranges any iconized (minimized) MDI child windows.
3c4f71cc 200
d2824cdb
VZ
201 This method is only implemented in MSW MDI implementation and does
202 nothing under the other platforms.
203
4cc4bfaf 204 @see Cascade(), Tile()
23324ae1 205 */
adaaa686 206 virtual void ArrangeIcons();
23324ae1
FM
207
208 /**
209 Arranges the MDI child windows in a cascade.
3c4f71cc 210
d2824cdb
VZ
211 This method is only implemented in MSW MDI implementation and does
212 nothing under the other platforms.
213
4cc4bfaf 214 @see Tile(), ArrangeIcons()
23324ae1 215 */
adaaa686 216 virtual void Cascade();
23324ae1
FM
217
218 /**
ba1d7a6c 219 Used in two-step frame construction.
d2824cdb 220
ba1d7a6c 221 See wxMDIParentFrame() for further details.
23324ae1 222 */
d2824cdb
VZ
223 bool Create(wxWindow* parent,
224 wxWindowID id,
225 const wxString& title,
23324ae1 226 const wxPoint& pos = wxDefaultPosition,
d2824cdb
VZ
227 const wxSize& size = wxDefaultSize,
228 long style = wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxHSCROLL,
5267aefd 229 const wxString& name = wxFrameNameStr);
23324ae1
FM
230
231 /**
232 Returns a pointer to the active MDI child, if there is one.
d2824cdb
VZ
233
234 If there are any children at all this function returns a non-@NULL
235 pointer.
23324ae1 236 */
26818748 237 virtual wxMDIChildFrame* GetActiveChild() const;
23324ae1
FM
238
239 /**
d2824cdb 240 Returns a pointer to the client window.
5c3a762d 241
d2824cdb
VZ
242 @see OnCreateClient()
243 */
26818748 244 wxMDIClientWindowBase* GetClientWindow() const;
5c3a762d 245
d2824cdb
VZ
246 /**
247 Returns the current MDI Window menu.
5c3a762d 248
d2824cdb
VZ
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().
5c3a762d 254
d2824cdb 255 This function is currently not available under OS X.
5c3a762d 256
d2824cdb 257 @return The current Window menu or @NULL.
23324ae1 258 */
d2824cdb 259 wxMenu *GetWindowMenu() const;
23324ae1
FM
260
261 /**
d2824cdb 262 Returns whether the MDI implementation is tab-based.
3c4f71cc 263
d2824cdb
VZ
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.
23324ae1 267
d2824cdb
VZ
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();
23324ae1
FM
274
275 /**
d2824cdb 276 Override this to return a different kind of client window.
23324ae1 277
d2824cdb
VZ
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:
5c3a762d
FM
281
282 @code
283 frame = new MyParentFrame;
f8ebb70d 284 frame->Create(parent, myParentFrameId, "My Parent Frame");
5c3a762d 285 @endcode
3c4f71cc 286
5c3a762d
FM
287 @remarks
288
d2824cdb
VZ
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.
5c3a762d
FM
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
ba1d7a6c 295 positions always return zero.
3c4f71cc 296
4cc4bfaf 297 @see GetClientWindow(), wxMDIClientWindow
23324ae1
FM
298 */
299 virtual wxMDIClientWindow* OnCreateClient();
300
301 /**
d2824cdb 302 Replace the current MDI Window menu.
5c3a762d 303
d2824cdb
VZ
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).
5c3a762d 308
d2824cdb
VZ
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.
5c3a762d 312
1483e5db
VZ
313 The menu may include the items with the following standard identifiers
314 (but may use arbitrary text and help strings and bitmaps for them):
315 - @c wxID_MDI_WINDOW_CASCADE
316 - @c wxID_MDI_WINDOW_TILE_HORZ
317 - @c wxID_MDI_WINDOW_TILE_VERT
318 - @c wxID_MDI_WINDOW_ARRANGE_ICONS
319 - @c wxID_MDI_WINDOW_PREV
320 - @c wxID_MDI_WINDOW_NEXT
321 All of which are handled by wxMDIParentFrame itself. If any other
322 commands are used in the menu, the derived frame should handle them.
323
d2824cdb 324 This function is currently not available under OS X.
3c4f71cc 325
d2824cdb
VZ
326 @param menu
327 The menu to be used instead of the standard MDI Window menu or @NULL.
23324ae1 328 */
26818748 329 virtual void SetWindowMenu(wxMenu* menu);
23324ae1
FM
330
331 /**
d2824cdb
VZ
332 Tiles the MDI child windows either horizontally or vertically depending
333 on whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
5c3a762d 334
d2824cdb
VZ
335 This method is only implemented in MSW MDI implementation and does
336 nothing under the other platforms.
5c3a762d 337
23324ae1 338 */
adaaa686 339 virtual void Tile(wxOrientation orient = wxHORIZONTAL);
23324ae1
FM
340};
341
342
e54c96f1 343
23324ae1
FM
344/**
345 @class wxMDIChildFrame
7c913512 346
d2824cdb
VZ
347 An MDI child frame is a frame that can only exist inside a
348 wxMDIClientWindow, which is itself a child of wxMDIParentFrame.
7c913512 349
23324ae1 350 @beginStyleTable
d2824cdb
VZ
351 All of the standard wxFrame styles can be used but most of them are ignored
352 by TDI-based MDI implementations.
23324ae1 353 @endStyleTable
7c913512 354
ba1d7a6c
FM
355 @remarks
356 Although internally an MDI child frame is a child of the MDI client window,
d2824cdb
VZ
357 in wxWidgets you create it as a child of wxMDIParentFrame. In fact, you can
358 usually forget that the client window exists. MDI child frames are clipped
359 to the area of the MDI client window, and may be iconized on the client
360 window. You can associate a menubar with a child frame as usual, although
361 an MDI child doesn't display its menubar under its own title bar. The MDI
362 parent frame's menubar will be changed to reflect the currently active
363 child frame. If there are currently no children, the parent frame's own
364 menubar will be displayed.
ba1d7a6c 365
23324ae1
FM
366 @library{wxcore}
367 @category{managedwnd}
7c913512 368
e54c96f1 369 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
23324ae1
FM
370*/
371class wxMDIChildFrame : public wxFrame
372{
373public:
5c3a762d
FM
374 /**
375 Default constructor.
376 */
377 wxMDIChildFrame();
378
23324ae1
FM
379 /**
380 Constructor, creating the window.
3c4f71cc 381
7c913512 382 @param parent
4cc4bfaf 383 The window parent. This should not be @NULL.
7c913512 384 @param id
4cc4bfaf 385 The window identifier. It may take a value of -1 to indicate a default
5c3a762d 386 value.
7c913512 387 @param title
4cc4bfaf 388 The caption to be displayed on the frame's title bar.
7c913512 389 @param pos
76e2b570 390 The window position. The value ::wxDefaultPosition indicates a default position,
5c3a762d 391 chosen by either the windowing system or wxWidgets, depending on platform.
7c913512 392 @param size
76e2b570 393 The window size. The value ::wxDefaultSize indicates a default size, chosen by
4cc4bfaf 394 either the windowing system or wxWidgets, depending on platform.
7c913512 395 @param style
4cc4bfaf 396 The window style. See wxMDIChildFrame.
7c913512 397 @param name
4cc4bfaf 398 The name of the window. This parameter is used to associate a name with the
5c3a762d
FM
399 item, allowing the application user to set Motif resource values for individual
400 windows.
3c4f71cc 401
4cc4bfaf 402 @see Create()
23324ae1 403 */
7c913512
FM
404 wxMDIChildFrame(wxMDIParentFrame* parent, wxWindowID id,
405 const wxString& title,
406 const wxPoint& pos = wxDefaultPosition,
407 const wxSize& size = wxDefaultSize,
408 long style = wxDEFAULT_FRAME_STYLE,
408776d0 409 const wxString& name = wxFrameNameStr);
23324ae1
FM
410
411 /**
412 Destructor. Destroys all child windows and menu bar if present.
413 */
adaaa686 414 virtual ~wxMDIChildFrame();
23324ae1
FM
415
416 /**
417 Activates this MDI child frame.
3c4f71cc 418
4cc4bfaf 419 @see Maximize(), Restore()
23324ae1 420 */
adaaa686 421 virtual void Activate();
23324ae1
FM
422
423 /**
ba1d7a6c
FM
424 Used in two-step frame construction.
425 See wxMDIChildFrame() for further details.
23324ae1 426 */
5267aefd 427 bool Create(wxMDIParentFrame* parent, wxWindowID id, const wxString& title,
23324ae1
FM
428 const wxPoint& pos = wxDefaultPosition,
429 const wxSize& size = wxDefaultSize,
430 long style = wxDEFAULT_FRAME_STYLE,
5267aefd 431 const wxString& name = wxFrameNameStr);
23324ae1 432
d2824cdb
VZ
433 /**
434 Returns the MDI parent frame containing this child.
435
436 Notice that this may return a different object than GetParent() as the
437 child frames may be created as children of the client window
438 internally.
439 */
440 wxMDIParentFrame *GetMDIParent() const;
441
442 /**
443 Returns true for MDI children in TDI implementations.
444
445 TDI-based implementations represent MDI children as pages in a
446 wxNotebook and so they are always maximized and can't be restored or
447 iconized.
448
449 @see wxMDIParentFrame::IsTDI().
450 */
451 virtual bool IsAlwaysMaximized() const;
452
23324ae1
FM
453 /**
454 Maximizes this MDI child frame.
3c4f71cc 455
d2824cdb
VZ
456 This function doesn't do anything if IsAlwaysMaximized() returns @true.
457
4cc4bfaf 458 @see Activate(), Restore()
23324ae1 459 */
5267aefd 460 virtual void Maximize(bool maximize = true);
23324ae1
FM
461
462 /**
463 Restores this MDI child frame (unmaximizes).
d2824cdb
VZ
464
465 This function doesn't do anything if IsAlwaysMaximized() returns @true.
466
467 @see Activate(), Maximize()
23324ae1 468 */
adaaa686 469 virtual void Restore();
23324ae1 470};
e54c96f1 471