]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/mdi.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxMDIClientWindow
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxMDIClientWindow
13 An MDI client window is a child of wxMDIParentFrame, and manages zero or
14 more wxMDIChildFrame objects.
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.
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
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.
35 @see wxMDIChildFrame, wxMDIParentFrame, wxFrame
37 class wxMDIClientWindow
: public wxWindow
47 Constructor, creating the window.
52 The window style. Currently unused.
54 @remarks This constructor is called within wxMDIParentFrame::OnCreateClient().
56 @see wxMDIParentFrame::wxMDIParentFrame(), wxMDIParentFrame::OnCreateClient()
58 wxMDIClientWindow(wxMDIParentFrame
* parent
, long style
= 0);
66 Used in two-step frame construction. See wxMDIClientWindow()
69 bool CreateClient(wxMDIParentFrame
* parent
, long style
= 0);
75 @class wxMDIParentFrame
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
80 clutter, and is used in many popular Windows applications, such as Microsoft Word(TM).
84 There may be multiple MDI parent frames in a single application, but this probably
85 only makes sense within programming development environments.
87 Child frames may be of class wxMDIChildFrame (contained within the parent frame)
88 or wxFrame (shown as a top-level frame).
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.
95 MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete
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.
105 Puts a caption on the frame.
106 @style{wxDEFAULT_FRAME_STYLE}
107 Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
108 @c wxSYSTEM_MENU | @c wxCAPTION.
110 Displays a horizontal scrollbar in the client window, allowing the
111 user to view child frames that are off the current view.
113 Display the frame iconized (minimized) (Windows only).
115 Displays the frame maximized (Windows only).
116 @style{wxMAXIMIZE_BOX}
117 Displays a maximize box on the frame (Windows and Motif only).
119 Identical to @c wxICONIZE.
120 @style{wxMINIMIZE_BOX}
121 Displays a minimize box on the frame (Windows and Motif only).
122 @style{wxRESIZE_BORDER}
123 Displays a resizeable border around the window (Motif only; for
124 Windows, it is implicit in @c wxTHICK_FRAME).
125 @style{wxSTAY_ON_TOP}
126 Stay on top of other windows (Windows only).
127 @style{wxSYSTEM_MENU}
128 Displays a system menu (Windows and Motif only).
129 @style{wxTHICK_FRAME}
130 Displays a thick frame around the window (Windows and Motif only).
132 Displays a vertical scrollbar in the client window, allowing the
133 user to view child frames that are off the current view.
134 @style{wxFRAME_NO_WINDOW_MENU}
135 Under Windows, removes the Window menu that is normally added
140 @category{managedwnd}
142 @see wxMDIChildFrame, wxMDIClientWindow, wxFrame, wxDialog
144 class wxMDIParentFrame
: public wxFrame
154 Constructor, creating the window.
157 The window parent. This should be @NULL.
159 The window identifier. It may take a value of -1 to indicate a default
162 The caption to be displayed on the frame's title bar.
164 The window position. The value @c wxDefaultPosition indicates a default position,
165 chosen by either the windowing system or wxWidgets, depending on platform.
167 The window size. The value @c wxDefaultSize indicates a default size, chosen by
168 either the windowing system or wxWidgets, depending on platform.
170 The window style. See wxMDIParentFrame.
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.
176 @remarks During the construction of the frame, the client window will be
177 created. To use a different class from wxMDIClientWindow, override
180 @see Create(), OnCreateClient()
182 wxMDIParentFrame(wxWindow
* parent
, wxWindowID id
,
183 const wxString
& title
,
184 const wxPoint
& pos
= wxDefaultPosition
,
185 const wxSize
& size
= wxDefaultSize
,
186 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
187 const wxString
& name
= "frame");
190 Destructor. Destroys all child windows and menu bar if present.
195 Activates the MDI child following the currently active one.
197 @see ActivatePrevious()
202 Activates the MDI child preceding the currently active one.
206 void ActivatePrevious();
209 Arranges any iconized (minimized) MDI child windows.
211 @see Cascade(), Tile()
216 Arranges the MDI child windows in a cascade.
218 @see Tile(), ArrangeIcons()
223 Used in two-step frame construction. See wxMDIParentFrame()
226 bool Create(wxWindow
* parent
, wxWindowID id
,
227 const wxString
& title
,
228 const wxPoint
& pos
= wxDefaultPosition
,
229 const wxSize
& size
= wxDefaultSize
,
230 long style
= wxDEFAULT_FRAME_STYLE
| wxVSCROLL
| wxHSCROLL
,
231 const wxString
& name
= "frame");
234 Returns a pointer to the active MDI child, if there is one.
236 wxMDIChildFrame
* GetActiveChild() const;
239 This gets the size of the frame 'client area' in pixels.
242 Receives the client width in pixels.
244 Receives the client height in pixels.
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.
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
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.
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
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.
271 @see GetToolBar(), SetToolBar(), wxMDIClientWindow
274 The wxPython version of this method takes no arguments and returns a tuple containing
278 virtual void GetClientSize(int* width
, int* height
) const;
281 Returns a pointer to the client window.
283 @see OnCreateClient()
285 wxMDIClientWindow
* GetClientWindow() const;
288 Returns the window being used as the toolbar for this frame.
292 virtual wxWindow
* GetToolBar() const;
295 Returns the current Window menu (added by wxWidgets to the menubar). This
297 is available under Windows only.
299 wxMenu
* GetWindowMenu() const;
302 Override this to return a different kind of client window. If you override this
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.
308 frame = new MyParentFrame;
309 frame->Create(parent, myParentFrameId, wxT("My Parent Frame"));
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.
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).
321 @see GetClientWindow(), wxMDIClientWindow
323 virtual wxMDIClientWindow
* OnCreateClient();
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.
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.
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.
341 The parent of the toolbar must be this frame.
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.
348 Note that SDI (normal) frames and MDI child windows must always have their toolbars
349 managed by the application.
351 @see GetToolBar(), GetClientSize()
353 virtual void SetToolBar(wxWindow
* toolbar
);
356 Call this to change the current Window menu. Ownership of the menu object
357 passes to the frame when you call this function.
359 This call is available under Windows only.
361 To remove the window completely, use the @c wxFRAME_NO_WINDOW_MENU window style.
363 void SetWindowMenu(wxMenu
* menu
);
366 Tiles the MDI child windows either horizontally or vertically depending on
367 whether @a orient is @c wxHORIZONTAL or @c wxVERTICAL.
369 Currently only implemented for MSW, does nothing under the other platforms.
371 void Tile(wxOrientation orient
= wxHORIZONTAL
);
377 @class wxMDIChildFrame
380 An MDI child frame is a frame that can only exist on a wxMDIClientWindow,
381 which is itself a child of wxMDIParentFrame.
385 Puts a caption on the frame.
386 @style{wxDEFAULT_FRAME_STYLE}
387 Defined as @c wxMINIMIZE_BOX | @c wxMAXIMIZE_BOX | @c wxTHICK_FRAME |
388 @c wxSYSTEM_MENU | @c wxCAPTION.
390 Display the frame iconized (minimized) (Windows only).
392 Displays the frame maximized (Windows only).
393 @style{wxMAXIMIZE_BOX}
394 Displays a maximize box on the frame (Windows and Motif only).
396 Identical to @c wxICONIZE.
397 @style{wxMINIMIZE_BOX}
398 Displays a minimize box on the frame (Windows and Motif only).
399 @style{wxRESIZE_BORDER}
400 Displays a resizeable border around the window (Motif only; for
401 Windows, it is implicit in @c wxTHICK_FRAME).
402 @style{wxSTAY_ON_TOP}
403 Stay on top of other windows (Windows only).
404 @style{wxSYSTEM_MENU}
405 Displays a system menu (Windows and Motif only).
406 @style{wxTHICK_FRAME}
407 Displays a thick frame around the window (Windows and Motif only).
411 @category{managedwnd}
413 @see wxMDIClientWindow, wxMDIParentFrame, wxFrame
415 class wxMDIChildFrame
: public wxFrame
425 Constructor, creating the window.
428 The window parent. This should not be @NULL.
430 The window identifier. It may take a value of -1 to indicate a default
433 The caption to be displayed on the frame's title bar.
435 The window position. The value @c wxDefaultPosition indicates a default position,
436 chosen by either the windowing system or wxWidgets, depending on platform.
438 The window size. The value @c wxDefaultSize indicates a default size, chosen by
439 either the windowing system or wxWidgets, depending on platform.
441 The window style. See wxMDIChildFrame.
443 The name of the window. This parameter is used to associate a name with the
444 item, allowing the application user to set Motif resource values for individual
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");
457 Destructor. Destroys all child windows and menu bar if present.
462 Activates this MDI child frame.
464 @see Maximize(), Restore()
469 Used in two-step frame construction. See wxMDIChildFrame()
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");
480 Maximizes this MDI child frame.
482 @see Activate(), Restore()
484 void Maximize(bool maximize
);
487 Restores this MDI child frame (unmaximizes).