]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/mdi.tex
Added wxRegion version of wxWindowDC::SetClippingRegion
[wxWidgets.git] / docs / latex / wx / mdi.tex
CommitLineData
a660d684
KB
1\section{\class{wxMDIChildFrame}}\label{wxmdichildframe}
2
3An MDI child frame is a frame that can only exist on a \helpref{wxMDIClientWindow}{wxmdiclientwindow},
4which is itself a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}.
5
6\wxheading{Derived from}
7
8\helpref{wxFrame}{wxframe}\\
9\helpref{wxWindow}{wxwindow}\\
10\helpref{wxEvtHandler}{wxevthandler}\\
11\helpref{wxObject}{wxobject}
12
13\wxheading{Window styles}
14
15\twocolwidtha{5cm}
16\begin{twocollist}\itemsep=0pt
17\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.}
18\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxTHICK\_FRAME \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.}
19\twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized) (Windows only).}
20\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized (Windows only).}
21\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame (Windows and Motif only).}
22\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}.}
23\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame (Windows and Motif only).}
24\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window (Motif only;
25for Windows, it is implicit in wxTHICK\_FRAME).}
26\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows (Windows only).}
27\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu (Windows and Motif only).}
28\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Displays a thick frame around the window (Windows and Motif only).}
29\end{twocollist}
30
31See also \helpref{window styles overview}{windowstyles}.
32
33\wxheading{Remarks}
34
35Although internally an MDI child frame is a child of the MDI client window, in wxWindows
36you create it as a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}. You can usually
37forget that the client window exists.
38
39MDI child frames are clipped to the area of the MDI client window, and may be iconized
40on the client window.
41
42You can associate a menubar with a child frame as usual, although an MDI child doesn't display
43its menubar under its own title bar. The MDI parent frame's menubar will be changed to
44reflect the currently active child frame. If there are currently no children, the parent
45frame's own menubar will be displayed.
46
47\wxheading{See also}
48
49\helpref{wxMDIClientWindow}{wxmdiclientwindow}, \helpref{wxMDIParentFrame}{wxmdiparentframe},\rtfsp
50\helpref{wxFrame}{wxframe}
51
52\latexignore{\rtfignore{\wxheading{Members}}}
53
54\membersection{wxMDIChildFrame::wxMDIChildFrame}\label{wxmdichildframeconstr}
55
56\func{}{wxMDIChildFrame}{\void}
57
58Default constructor.
59
eaaa6a06 60\func{}{wxMDIChildFrame}{\param{wxMDIParentFrame* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
61\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
62\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE},\rtfsp
63\param{const wxString\& }{name = ``frame"}}
64
65Constructor, creating the window.
66
67\wxheading{Parameters}
68
69\docparam{parent}{The window parent. This should not be NULL.}
70
71\docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.}
72
73\docparam{title}{The caption to be displayed on the frame's title bar.}
74
75\docparam{pos}{The window position. A value of (-1, -1) indicates a default position, chosen by
76either the windowing system or wxWindows, depending on platform.}
77
78\docparam{size}{The window size. A value of (-1, -1) indicates a default size, chosen by
79either the windowing system or wxWindows, depending on platform.}
80
81\docparam{style}{The window style. See \helpref{wxMDIChildFrame}{wxmdichildframe}.}
82
83\docparam{name}{The name of the window. This parameter is used to associate a name with the item,
84allowing the application user to set Motif resource values for
85individual windows.}
86
87\wxheading{Remarks}
88
89None.
90
91\wxheading{See also}
92
93\helpref{wxMDIChildFrame::Create}{wxmdichildframecreate}
94
95\membersection{wxMDIChildFrame::\destruct{wxMDIChildFrame}}
96
97\func{}{\destruct{wxMDIChildFrame}}{\void}
98
99Destructor. Destroys all child windows and menu bar if present.
100
101\membersection{wxMDIChildFrame::Activate}\label{wxmdichildframeactivate}
102
103\func{void}{Activate}{\void}
104
105Activates this MDI child frame.
106
107\wxheading{See also}
108
109\helpref{wxMDIChildFrame::Maximize}{wxmdichildframemaximize},\rtfsp
110\helpref{wxMDIChildFrame::Restore}{wxmdichildframerestore}
111
112\membersection{wxMDIChildFrame::Create}\label{wxmdichildframecreate}
113
eaaa6a06 114\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
115\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
116\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE},\rtfsp
117\param{const wxString\& }{name = ``frame"}}
118
119Used in two-step frame construction. See \helpref{wxMDIChildFrame::wxMDIChildFrame}{wxmdichildframeconstr}\rtfsp
120for further details.
121
122\membersection{wxMDIChildFrame::Maximize}\label{wxmdichildframemaximize}
123
124\func{void}{Maximize}{\void}
125
126Maximizes this MDI child frame.
127
128\wxheading{See also}
129
130\helpref{wxMDIChildFrame::Activate}{wxmdichildframeactivate},\rtfsp
131\helpref{wxMDIChildFrame::Restore}{wxmdichildframerestore}
132
133\membersection{wxMDIChildFrame::Restore}\label{wxmdichildframerestore}
134
135\func{void}{Restore}{\void}
136
137Restores this MDI child frame (unmaximizes).
138
139\wxheading{See also}
140
141\helpref{wxMDIChildFrame::Activate}{wxmdichildframeactivate},\rtfsp
142\helpref{wxMDIChildFrame::Maximize}{wxmdichildframemaximize}
143
144
145\section{\class{wxMDIClientWindow}}\label{wxmdiclientwindow}
146
147An MDI client window is a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}, and manages zero or
148more \helpref{wxMDIChildFrame}{wxmdichildframe} objects.
149
150\wxheading{Derived from}
151
152\helpref{wxWindow}{wxwindow}\\
153\helpref{wxEvtHandler}{wxevthandler}\\
154\helpref{wxObject}{wxobject}
155
156\wxheading{Remarks}
157
158The client window is the area where MDI child windows exist. It doesn't have to cover the whole
159parent frame; other windows such as toolbars and a help window might coexist with it.
160There can be scrollbars on a client window, which are controlled by the parent window style.
161
162The {\bf wxMDIClientWindow} class is usually adequate without further derivation, and it is created
163automatically when the MDI parent frame is created. If the application needs to derive a new class,
164the function \helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient} must be
165overridden in order to give an opportunity to use a different class of client window.
166
167Under Windows 95, the client window will automatically have a sunken border style when
168the active child is not maximized, and no border style when a child is maximized.
169
170\wxheading{See also}
171
172\helpref{wxMDIChildFrame}{wxmdichildframe}, \helpref{wxMDIParentFrame}{wxmdiparentframe},\rtfsp
173\helpref{wxFrame}{wxframe}
174
175\latexignore{\rtfignore{\wxheading{Members}}}
176
177\membersection{wxMDIClientWindow::wxMDIClientWindow}\label{wxmdiclientwindowconstr}
178
179\func{}{wxMDIClientWindow}{\void}
180
181Default constructor.
182
183\func{}{wxMDIClientWindow}{\param{wxMDIParentFrame* }{parent}, \param{long}{ style = 0}}
184
185Constructor, creating the window.
186
187\wxheading{Parameters}
188
189\docparam{parent}{The window parent.}
190
191\docparam{style}{The window style. Currently unused.}
192
193\wxheading{Remarks}
194
195The second style of constructor is called within \helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}.
196
197\wxheading{See also}
198
199\helpref{wxMDIParentFrame::wxMDIParentFrame}{wxmdiparentframeconstr},\rtfsp
200\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}
201
202\membersection{wxMDIClientWindow::\destruct{wxMDIClientWindow}}
203
204\func{}{\destruct{wxMDIClientWindow}}{\void}
205
206Destructor.
207
208\membersection{wxMDIClientWindow::CreateClient}\label{wxmdiclientwindowcreateclient}
209
210\func{bool}{CreateClient}{\param{wxMDIParentFrame* }{parent}, \param{long}{ style = 0}}
211
212Used in two-step frame construction. See \helpref{wxMDIClientWindow::wxMDIClientWindow}{wxmdiclientwindowconstr}\rtfsp
213for further details.
214
215\section{\class{wxMDIParentFrame}}\label{wxmdiparentframe}
216
217An MDI (Multiple Document Interface) parent frame is a window which can contain
218MDI child frames in its own `desktop'. It is a convenient way to avoid window clutter,
219and is used in many popular Windows applications, such as Microsoft Word(TM).
220
221\wxheading{Derived from}
222
223\helpref{wxFrame}{wxframe}\\
224\helpref{wxWindow}{wxwindow}\\
225\helpref{wxEvtHandler}{wxevthandler}\\
226\helpref{wxObject}{wxobject}
227
228\wxheading{Remarks}
229
230There may be multiple MDI parent frames in a single application, but this probably only makes sense
231within programming development environments.
232
233Child frames may be either \helpref{wxMDIChildFrame}{wxmdichildframe}, or \helpref{wxFrame}{wxframe}.
234
235An MDI parent frame always has a \helpref{wxMDIClientWindow}{wxmdiclientwindow} associated with it, which
236is the parent for MDI client frames.
237This client window may be resized to accomodate non-MDI windows, as seen in Microsoft Visual C++ (TM) and
238Microsoft Publisher (TM), where a documentation window is placed to one side of the workspace.
239
240MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete
241user interface style.
242
243The implementation is native in Windows, and simulated under Motif. Under Motif,
244the child window frames will often have a different appearance from other frames
245because the window decorations are simulated.
246
247\wxheading{Window styles}
248
249\twocolwidtha{5cm}
250\begin{twocollist}\itemsep=0pt
251\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.}
252\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxTHICK\_FRAME \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.}
253\twocolitem{\windowstyle{wxHSCROLL}}{Displays a horizontal scrollbar in the {\it client window}, allowing
254the user to view child frames that are off the current view.}
255\twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized) (Windows only).}
256\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized (Windows only).}
257\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame (Windows and Motif only).}
258\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}.}
259\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame (Windows and Motif only).}
260\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window (Motif only;
261for Windows, it is implicit in wxTHICK\_FRAME).}
262\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows (Windows only).}
263\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu (Windows and Motif only).}
264\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Displays a thick frame around the window (Windows and Motif only).}
265\twocolitem{\windowstyle{wxVSCROLL}}{Displays a vertical scrollbar in the {\it client window}, allowing
266the user to view child frames that are off the current view.}
267\end{twocollist}
268
269See also \helpref{window styles overview}{windowstyles}.
270
271\wxheading{See also}
272
273\helpref{wxMDIChildFrame}{wxmdichildframe}, \helpref{wxMDIClientWindow}{wxmdiclientwindow},\rtfsp
274\helpref{wxFrame}{wxframe}, \helpref{wxDialog}{wxdialog}
275
276\latexignore{\rtfignore{\wxheading{Members}}}
277
278\membersection{wxMDIParentFrame::wxMDIParentFrame}\label{wxmdiparentframeconstr}
279
280\func{}{wxMDIParentFrame}{\void}
281
282Default constructor.
283
eaaa6a06 284\func{}{wxMDIParentFrame}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
285\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
286\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE \pipe wxVSCROLL \pipe wxHSCROLL},\rtfsp
287\param{const wxString\& }{name = ``frame"}}
288
289Constructor, creating the window.
290
291\wxheading{Parameters}
292
293\docparam{parent}{The window parent. This should be NULL.}
294
295\docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.}
296
297\docparam{title}{The caption to be displayed on the frame's title bar.}
298
299\docparam{pos}{The window position. A value of (-1, -1) indicates a default position, chosen by
300either the windowing system or wxWindows, depending on platform.}
301
302\docparam{size}{The window size. A value of (-1, -1) indicates a default size, chosen by
303either the windowing system or wxWindows, depending on platform.}
304
305\docparam{style}{The window style. See \helpref{wxMDIParentFrame}{wxmdiparentframe}.}
306
307\docparam{name}{The name of the window. This parameter is used to associate a name with the item,
308allowing the application user to set Motif resource values for
309individual windows.}
310
311\wxheading{Remarks}
312
313During the construction of the frame, the client window will be created. To use a different class
314from \helpref{wxMDIClientWindow}{wxmdiclientwindow}, override\rtfsp
315\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}.
316
317Under Windows 95, the client window will automatically have a sunken border style when
318the active child is not maximized, and no border style when a child is maximized.
319
320\wxheading{See also}
321
322\helpref{wxMDIParentFrame::Create}{wxmdiparentframecreate},\rtfsp
323\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}
324
325\membersection{wxMDIParentFrame::\destruct{wxMDIParentFrame}}
326
327\func{}{\destruct{wxMDIParentFrame}}{\void}
328
329Destructor. Destroys all child windows and menu bar if present.
330
331\membersection{wxMDIParentFrame::ActivateNext}\label{wxmdiparentframeactivatenext}
332
333\func{void}{ActivateNext}{\void}
334
335Activates the MDI child following the currently active one.
336
337\wxheading{See also}
338
339\helpref{wxMDIParentFrame::ActivatePrevious}{wxmdiparentframeactivateprevious}
340
341\membersection{wxMDIParentFrame::ActivatePrevious}\label{wxmdiparentframeactivateprevious}
342
343\func{void}{ActivatePrevious}{\void}
344
345Activates the MDI child preceding the currently active one.
346
347\wxheading{See also}
348
349\helpref{wxMDIParentFrame::ActivateNext}{wxmdiparentframeactivatenext}
350
351
352\membersection{wxMDIParentFrame::ArrangeIcons}\label{wxmdiparentframearrangeicons}
353
354\func{void}{ArrangeIcons}{\void}
355
356Arranges any iconized (minimized) MDI child windows.
357
358\wxheading{See also}
359
360\helpref{wxMDIParentFrame::Cascade}{wxmdiparentframecascade},\rtfsp
361\helpref{wxMDIParentFrame::Tile}{wxmdiparentframetile}
362
363\membersection{wxMDIParentFrame::Cascade}\label{wxmdiparentframecascade}
364
365\func{void}{Cascade}{\void}
366
367Arranges the MDI child windows in a cascade.
368
369\wxheading{See also}
370
371\helpref{wxMDIParentFrame::Tile}{wxmdiparentframetile},\rtfsp
372\helpref{wxMDIParentFrame::ArrangeIcons}{wxmdiparentframearrangeicons}
373
374\membersection{wxMDIParentFrame::Create}\label{wxmdiparentframecreate}
375
eaaa6a06 376\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
a660d684
KB
377\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
378\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE \pipe wxVSCROLL \pipe wxHSCROLL},\rtfsp
379\param{const wxString\& }{name = ``frame"}}
380
381Used in two-step frame construction. See \helpref{wxMDIParentFrame::wxMDIParentFrame}{wxmdiparentframeconstr}\rtfsp
382for further details.
383
384\membersection{wxMDIParentFrame::GetClientSize}\label{wxmdiparentframegetclientsize}
385
386\constfunc{virtual void}{GetClientSize}{\param{int* }{width}, \param{int* }{height}}
387
388This gets the size of the frame `client area' in pixels.
389
390\wxheading{Parameters}
391
392\docparam{width}{Receives the client width in pixels.}
393
394\docparam{height}{Receives the client height in pixels.}
395
396\wxheading{Remarks}
397
398The client area is the area which may be drawn on by the programmer, excluding title bar, border, status bar,
399and toolbar if present.
400
401If you wish to manage your own toolbar (or perhaps you have more than one),
402provide an {\bf OnSize} event handler. Call {\bf GetClientSize} to
403find how much space there is for your windows and don't forget to set the size and position
404of the MDI client window as well as your toolbar and other windows (but not the status bar).
405
406If you have set a toolbar with \helpref{wxMDIParentFrame::SetToolbar}{wxmdiparentframesettoolbar},
407the client size returned will have subtracted the toolbar height. However, the available positions
408for the client window and other windows of the frame do not start at zero - you must add the toolbar height.
409
410The position and size of the status bar and toolbar (if known to the frame) are always managed
411by {\bf wxMDIParentFrame}, regardless of what behaviour is defined in your {\bf OnSize} event handler.
412However, the client window position and size are always set in {\bf OnSize}, so if you override this
413event handler, make sure you deal with the client window.
414
415You do not have to manage the size and position of MDI child windows, since they are managed
416automatically by the client window.
417
418\wxheading{See also}
419
420\helpref{wxMDIParentFrame::GetToolBar}{wxmdiparentframegettoolbar},\rtfsp
421\helpref{wxMDIParentFrame::SetToolBar}{wxmdiparentframesettoolbar},\rtfsp
422\helpref{wxWindow}{wxwindowonsize},\rtfsp
423\helpref{wxMDIClientWindow}{wxmdiclientwindow}
424
425\membersection{wxMDIParentFrame::GetActiveChild}\label{wxmdiparentframegetactivechild}
426
427\constfunc{wxMDIChildFrame*}{GetActiveChild}{\void}
428
429Returns a pointer to the active MDI child, if there is one.
430
431\membersection{wxMDIParentFrame::GetClientWindow}\label{wxmdiparentframegetclientwindow}
432
433\constfunc{wxMDIClientWindow*}{GetClientWindow}{\void}
434
435Returns a pointer to the client window.
436
437\wxheading{See also}
438
439\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}
440
441\membersection{wxMDIParentFrame::GetToolBar}\label{wxmdiparentframegettoolbar}
442
443\constfunc{virtual wxWindow*}{GetToolBar}{\void}
444
445Returns the window being used as the toolbar for this frame.
446
447\wxheading{See also}
448
449\helpref{wxMDIParentFrame::SetToolBar}{wxmdiparentframesettoolbar}
450
451\membersection{wxMDIParentFrame::OnCreateClient}\label{wxmdiparentframeoncreateclient}
452
453\func{virtual wxMDIClientWindow*}{OnCreateClient}{\void}
454
455Override this to return a different kind of client window.
456
457\wxheading{Remarks}
458
459You might wish to derive from \helpref{wxMDIClientWindow}{wxmdiclientwindow} in order
460to implement different erase behaviour, for example, such as painting a bitmap
461on the background.
462
463Note that it is probably impossible to have a client window that scrolls as well as painting
464a bitmap or pattern, since in {\bf OnScroll}, the scrollbar positions always return zero.
465(Solutions to: \verb$julian.smart@ukonline.co.uk$).
466
467\wxheading{See also}
468
469\helpref{wxMDIParentFrame::GetClientWindow}{wxmdiparentframegetclientwindow},\rtfsp
470\helpref{wxMDIClientWindow}{wxmdiclientwindow}
471
472\membersection{wxMDIParentFrame::SetToolBar}\label{wxmdiparentframesettoolbar}
473
474\func{virtual void}{SetToolBar}{\param{wxWindow*}{ toolbar}}
475
476Sets the window to be used as a toolbar for this
477MDI parent window. It saves the application having to manage the positioning
478of the toolbar MDI client window.
479
480\wxheading{Parameters}
481
482\docparam{toolbar}{Toolbar to manage.}
483
484\wxheading{Remarks}
485
486When the frame is resized, the toolbar is resized to be the width of
487the frame client area, and the toolbar height is kept the same.
488
489The parent of the toolbar must be this frame.
490
491If you wish to manage your own toolbar (or perhaps you have more than one),
492don't call this function, and instead manage your subwindows and the MDI client window by
493providing an {\bf OnSize} event handler. Call \helpref{wxMDIParentFrame::GetClientSize}{wxmdiparentframegetclientsize} to
494find how much space there is for your windows.
495
496Note that SDI (normal) frames and MDI child windows must always have their
497toolbars managed by the application.
498
499\wxheading{See also}
500
501\helpref{wxMDIParentFrame::GetToolBar}{wxmdiparentframegettoolbar},\rtfsp
502\helpref{wxMDIParentFrame::GetClientSize}{wxmdiparentframegetclientsize}
503
504\membersection{wxMDIParentFrame::Tile}\label{wxmdiparentframetile}
505
506\func{void}{Tile}{\void}
507
508Tiles the MDI child windows.
509
510\wxheading{See also}
511
512\helpref{wxMDIParentFrame::Cascade}{wxmdiparentframecascade},\rtfsp
513\helpref{wxMDIParentFrame::ArrangeIcons}{wxmdiparentframearrangeicons}
514
515