]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/mdi.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMDIClientWindow
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
9 @class wxMDIClientWindow
11 An MDI client window is a child of wxMDIParentFrame, and manages zero or
12 more wxMDIChildFrame objects.
16 The client window is the area where MDI child windows exist. It doesn't have to
17 cover the whole parent frame; other windows such as toolbars and a help window
18 might coexist with it. There can be scrollbars on a client window, which are
19 controlled by the parent window style.
21 The wxMDIClientWindow class is usually adequate without further derivation, and
22 it is created automatically when the MDI parent frame is created. If the application
23 needs to derive a new class, the function wxMDIParentFrame::OnCreateClient() must
24 be overridden in order to give an opportunity to use a different class of client
27 Under wxMSW, the client window will automatically have a sunken border style
28 when the active child is not maximized, and no border style when a child is maximized.
33 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
35 class wxMDIClientWindow
: public wxWindow
41 Objects of this class are only created by wxMDIParentFrame which uses
42 the default constructor and calls CreateClient() immediately
48 Called by wxMDIParentFrame immediately after creating the client
51 This function may be overridden in the derived class but the base class
52 version must usually be called first to really create the window.
57 The window style. Only wxHSCROLL and wxVSCROLL bits are meaningful
61 virtual bool CreateClient(wxMDIParentFrame
* parent
, long style
= 0);
67 @class wxMDIParentFrame
69 An MDI (Multiple Document Interface) parent frame is a window which can
70 contain MDI child frames in its client area which emulates the full
73 MDI is a user-interface model in which all the window reside inside the
74 single parent window as opposed to being separate from each other. It
75 remains popular despite dire warnings from Microsoft itself (which
76 popularized this model in the first model) that MDI is obsolete.
78 An MDI parent frame always has a wxMDIClientWindow associated with it,
79 which is the parent for MDI child frames. In the simplest case, the client
80 window takes up the entire parent frame area but it is also possible to
81 resize it to be smaller in order to have other windows in the frame, a
82 typical example is using a sidebar along one of the window edges.
84 The appearance of MDI applications differs between different ports. The
85 classic MDI model, with child windows which can be independently moved,
86 resized etc, is only available under MSW, which provides native support for
87 it. In Mac ports, multiple top level windows are used for the MDI children
88 too and the MDI parent frame itself is invisible, to accommodate the native
89 look and feel requirements. In all the other ports, a tab-based MDI
90 implementation (sometimes called TDI) is used and so at most one MDI child
91 is visible at any moment (child frames are always maximized).
95 Although it is possible to have multiple MDI parent frames, a typical MDI
96 application has a single MDI parent frame window inside which multiple MDI
97 child frames, i.e. objects of class wxMDIChildFrame, can be created.
102 There are no special styles for this class, all wxFrame styles apply to it
103 in the usual way. The only exception is that wxHSCROLL and wxVSCROLL styles
104 apply not to the frame itself but to the client window, so that using them
105 enables horizontal and vertical scrollbars for this window and not the
111 @category{managedwnd}
113 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
115 class wxMDIParentFrame
: public wxFrame
122 Use Create() for the objects created using this constructor.
127 Constructor, creating the window.
129 Notice that if you override virtual OnCreateClient() method you
130 shouldn't be using this constructor but the default constructor and
131 Create() as otherwise your overridden method is never going to be
132 called because of the usual C++ virtual call resolution rules.
135 The window parent. Usually is @NULL.
137 The window identifier. It may take a value of @c wxID_ANY to
138 indicate a default value.
140 The caption to be displayed on the frame's title bar.
142 The window position. The value ::wxDefaultPosition indicates a
143 default position, chosen by either the windowing system or
144 wxWidgets, depending on platform.
146 The window size. The value ::wxDefaultSize indicates a default
147 size, chosen by either the windowing system or wxWidgets, depending
150 The window style. Default value includes wxHSCROLL and wxVSCROLL
153 The name of the window. This parameter is used to associate a name
154 with the item, allowing the application user to set Motif resource
155 values for individual windows.
159 Under wxMSW, the client window will automatically have a sunken
160 border style when the active child is not maximized, and no border
161 style when a child is maximized.
163 @see Create(), OnCreateClient()
165 wxMDIParentFrame(wxWindow
* parent
, wxWindowID id
,
166 const wxString
& title
,
167 const wxPoint
& pos
= wxDefaultPosition
,
168 const wxSize
& size
= wxDefaultSize
,
169 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
170 const wxString
& name
= wxFrameNameStr
);
175 Destroys all child windows and menu bar if present.
177 virtual ~wxMDIParentFrame();
180 Activates the MDI child following the currently active one.
182 The MDI children are maintained in an ordered list and this function
183 switches to the next element in this list, wrapping around the end of
184 it if the currently active child is the last one.
186 @see ActivatePrevious()
188 virtual void ActivateNext();
191 Activates the MDI child preceding the currently active one.
195 virtual void ActivatePrevious();
198 Arranges any iconized (minimized) MDI child windows.
200 This method is only implemented in MSW MDI implementation and does
201 nothing under the other platforms.
203 @see Cascade(), Tile()
205 virtual void ArrangeIcons();
208 Arranges the MDI child windows in a cascade.
210 This method is only implemented in MSW MDI implementation and does
211 nothing under the other platforms.
213 @see Tile(), ArrangeIcons()
215 virtual void Cascade();
218 Used in two-step frame construction.
220 See wxMDIParentFrame() for further details.
222 bool Create(wxWindow
* parent
,
224 const wxString
& title
,
225 const wxPoint
& pos
= wxDefaultPosition
,
226 const wxSize
& size
= wxDefaultSize
,
227 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
228 const wxString
& name
= wxFrameNameStr
);
231 Returns a pointer to the active MDI child, if there is one.
233 If there are any children at all this function returns a non-@NULL
236 virtual wxMDIChildFrame
* GetActiveChild() const;
239 Returns a pointer to the client window.
241 @see OnCreateClient()
243 wxMDIClientWindowBase
* GetClientWindow() const;
246 Returns the current MDI Window menu.
248 Unless wxFRAME_NO_WINDOW_MENU style was used, a default menu listing
249 all the currently active children and providing the usual operations
250 (tile, cascade, ...) on them is created automatically by the library
251 and this function can be used to retrieve it. Notice that the default
252 menu can be replaced by calling SetWindowMenu().
254 This function is currently not available under OS X.
256 @return The current Window menu or @NULL.
258 wxMenu
*GetWindowMenu() const;
261 Returns whether the MDI implementation is tab-based.
263 Currently only the MSW port uses the real MDI. In Mac ports the usual
264 SDI is used, as common under this platforms, and all the other ports
265 use TDI implementation.
267 TDI-based MDI applications have different appearance and functionality
268 (e.g. child frames can't be minimized and only one of them is visible
269 at any given time) so the application may need to adapt its interface
270 somewhat depending on the return value of this function.
275 Override this to return a different kind of client window.
277 If you override this function, you must create your parent frame in two
278 stages, or your function will never be called, due to the way C++
279 treats virtual functions called from constructors. For example:
282 frame = new MyParentFrame;
283 frame->Create(parent, myParentFrameId, "My Parent Frame");
288 You might wish to derive from wxMDIClientWindow in order to implement
289 different erase behaviour, for example, such as painting a bitmap on
292 Note that it is probably impossible to have a client window that scrolls
293 as well as painting a bitmap or pattern, since in @b OnScroll, the scrollbar
294 positions always return zero.
296 @see GetClientWindow(), wxMDIClientWindow
298 virtual wxMDIClientWindow
* OnCreateClient();
301 Replace the current MDI Window menu.
303 Ownership of the menu object passes to the frame when you call this
304 function, i.e. the menu will be deleted by it when it's no longer
305 needed (usually when the frame itself is deleted or when
306 SetWindowMenu() is called again).
308 To remove the window completely, you can use the wxFRAME_NO_WINDOW_MENU
309 window style but this function also allows to do it by passing @NULL
312 The menu may include the items with the following standard identifiers
313 (but may use arbitrary text and help strings and bitmaps for them):
314 - @c wxID_MDI_WINDOW_CASCADE
315 - @c wxID_MDI_WINDOW_TILE_HORZ
316 - @c wxID_MDI_WINDOW_TILE_VERT
317 - @c wxID_MDI_WINDOW_ARRANGE_ICONS
318 - @c wxID_MDI_WINDOW_PREV
319 - @c wxID_MDI_WINDOW_NEXT
320 All of which are handled by wxMDIParentFrame itself. If any other
321 commands are used in the menu, the derived frame should handle them.
323 This function is currently not available under OS X.
326 The menu to be used instead of the standard MDI Window menu or @NULL.
328 virtual void SetWindowMenu(wxMenu
* menu
);
331 Tiles the MDI child windows either horizontally or vertically depending
332 on whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
334 This method is only implemented in MSW MDI implementation and does
335 nothing under the other platforms.
338 virtual void Tile(wxOrientation orient
= wxHORIZONTAL
);
344 @class wxMDIChildFrame
346 An MDI child frame is a frame that can only exist inside a
347 wxMDIClientWindow, which is itself a child of wxMDIParentFrame.
350 All of the standard wxFrame styles can be used but most of them are ignored
351 by TDI-based MDI implementations.
355 Although internally an MDI child frame is a child of the MDI client window,
356 in wxWidgets you create it as a child of wxMDIParentFrame. In fact, you can
357 usually forget that the client window exists. MDI child frames are clipped
358 to the area of the MDI client window, and may be iconized on the client
359 window. You can associate a menubar with a child frame as usual, although
360 an MDI child doesn't display its menubar under its own title bar. The MDI
361 parent frame's menubar will be changed to reflect the currently active
362 child frame. If there are currently no children, the parent frame's own
363 menubar will be displayed.
366 @category{managedwnd}
368 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
370 class wxMDIChildFrame
: public wxFrame
379 Constructor, creating the window.
382 The window parent. This should not be @NULL.
384 The window identifier. It may take a value of -1 to indicate a default
387 The caption to be displayed on the frame's title bar.
389 The window position. The value ::wxDefaultPosition indicates a default position,
390 chosen by either the windowing system or wxWidgets, depending on platform.
392 The window size. The value ::wxDefaultSize indicates a default size, chosen by
393 either the windowing system or wxWidgets, depending on platform.
395 The window style. See wxMDIChildFrame.
397 The name of the window. This parameter is used to associate a name with the
398 item, allowing the application user to set Motif resource values for individual
403 wxMDIChildFrame(wxMDIParentFrame
* parent
, wxWindowID id
,
404 const wxString
& title
,
405 const wxPoint
& pos
= wxDefaultPosition
,
406 const wxSize
& size
= wxDefaultSize
,
407 long style
= wxDEFAULT_FRAME_STYLE
,
408 const wxString
& name
= wxFrameNameStr
);
411 Destructor. Destroys all child windows and menu bar if present.
413 virtual ~wxMDIChildFrame();
416 Activates this MDI child frame.
418 @see Maximize(), Restore()
420 virtual void Activate();
423 Used in two-step frame construction.
424 See wxMDIChildFrame() for further details.
426 bool Create(wxMDIParentFrame
* parent
, wxWindowID id
, const wxString
& title
,
427 const wxPoint
& pos
= wxDefaultPosition
,
428 const wxSize
& size
= wxDefaultSize
,
429 long style
= wxDEFAULT_FRAME_STYLE
,
430 const wxString
& name
= wxFrameNameStr
);
433 Returns the MDI parent frame containing this child.
435 Notice that this may return a different object than GetParent() as the
436 child frames may be created as children of the client window
439 wxMDIParentFrame
*GetMDIParent() const;
442 Returns true for MDI children in TDI implementations.
444 TDI-based implementations represent MDI children as pages in a
445 wxNotebook and so they are always maximized and can't be restored or
448 @see wxMDIParentFrame::IsTDI().
450 virtual bool IsAlwaysMaximized() const;
453 Maximizes this MDI child frame.
455 This function doesn't do anything if IsAlwaysMaximized() returns @true.
457 @see Activate(), Restore()
459 virtual void Maximize(bool maximize
= true);
462 Restores this MDI child frame (unmaximizes).
464 This function doesn't do anything if IsAlwaysMaximized() returns @true.
466 @see Activate(), Maximize()
468 virtual void Restore();