\section{\class{wxMDIChildFrame}}\label{wxmdichildframe}

An MDI child frame is a frame that can only exist on a \helpref{wxMDIClientWindow}{wxmdiclientwindow},
which is itself a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}.

\wxheading{Derived from}

\helpref{wxFrame}{wxframe}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/mdi.h>

\wxheading{Window styles}

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.}
\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxTHICK\_FRAME \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.}
\twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized) (Windows only).}
\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized (Windows only).}
\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame (Windows and Motif only).}
\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}.}
\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame (Windows and Motif only).}
\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window (Motif only;
for Windows, it is implicit in wxTHICK\_FRAME).}
\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows (Windows only).}
\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu (Windows and Motif only).}
\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Displays a thick frame around the window (Windows and Motif only).}
\end{twocollist}

See also \helpref{window styles overview}{windowstyles}.

\wxheading{Remarks}

Although internally an MDI child frame is a child of the MDI client window, in wxWidgets
you create it as a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}. You can usually
forget that the client window exists.

MDI child frames are clipped to the area of the MDI client window, and may be iconized
on the client window.

You can associate a menubar with a child frame as usual, although an MDI child doesn't display
its menubar under its own title bar. The MDI parent frame's menubar will be changed to
reflect the currently active child frame. If there are currently no children, the parent
frame's own menubar will be displayed.

\wxheading{See also}

\helpref{wxMDIClientWindow}{wxmdiclientwindow}, \helpref{wxMDIParentFrame}{wxmdiparentframe},\rtfsp
\helpref{wxFrame}{wxframe}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxMDIChildFrame::wxMDIChildFrame}\label{wxmdichildframeconstr}

\func{}{wxMDIChildFrame}{\void}

Default constructor.

\func{}{wxMDIChildFrame}{\param{wxMDIParentFrame* }{parent}, \param{wxWindowID }{id},\rtfsp
\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE},\rtfsp
\param{const wxString\& }{name = ``frame"}}

Constructor, creating the window.

\wxheading{Parameters}

\docparam{parent}{The window parent. This should not be NULL.}

\docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.}

\docparam{title}{The caption to be displayed on the frame's title bar.}

\docparam{pos}{The window position. A value of (-1, -1) indicates a default position, chosen by
either the windowing system or wxWidgets, depending on platform.}

\docparam{size}{The window size. A value of (-1, -1) indicates a default size, chosen by
either the windowing system or wxWidgets, depending on platform.}

\docparam{style}{The window style. See \helpref{wxMDIChildFrame}{wxmdichildframe}.}

\docparam{name}{The name of the window. This parameter is used to associate a name with the item,
allowing the application user to set Motif resource values for
individual windows.}

\wxheading{Remarks}

None.

\wxheading{See also}

\helpref{wxMDIChildFrame::Create}{wxmdichildframecreate}

\membersection{wxMDIChildFrame::\destruct{wxMDIChildFrame}}

\func{}{\destruct{wxMDIChildFrame}}{\void}

Destructor. Destroys all child windows and menu bar if present.

\membersection{wxMDIChildFrame::Activate}\label{wxmdichildframeactivate}

\func{void}{Activate}{\void}

Activates this MDI child frame.

\wxheading{See also}

\helpref{wxMDIChildFrame::Maximize}{wxmdichildframemaximize},\rtfsp
\helpref{wxMDIChildFrame::Restore}{wxmdichildframerestore}

\membersection{wxMDIChildFrame::Create}\label{wxmdichildframecreate}

\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE},\rtfsp
\param{const wxString\& }{name = ``frame"}}

Used in two-step frame construction. See \helpref{wxMDIChildFrame::wxMDIChildFrame}{wxmdichildframeconstr}\rtfsp
for further details.

\membersection{wxMDIChildFrame::Maximize}\label{wxmdichildframemaximize}

\func{void}{Maximize}{\void}

Maximizes this MDI child frame.

\wxheading{See also}

\helpref{wxMDIChildFrame::Activate}{wxmdichildframeactivate},\rtfsp
\helpref{wxMDIChildFrame::Restore}{wxmdichildframerestore}

\membersection{wxMDIChildFrame::Restore}\label{wxmdichildframerestore}

\func{void}{Restore}{\void}

Restores this MDI child frame (unmaximizes).

\wxheading{See also}

\helpref{wxMDIChildFrame::Activate}{wxmdichildframeactivate},\rtfsp
\helpref{wxMDIChildFrame::Maximize}{wxmdichildframemaximize}

\section{\class{wxMDIClientWindow}}\label{wxmdiclientwindow}

An MDI client window is a child of \helpref{wxMDIParentFrame}{wxmdiparentframe}, and manages zero or
more \helpref{wxMDIChildFrame}{wxmdichildframe} objects.

\wxheading{Derived from}

\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/mdi.h>

\wxheading{Remarks}

The client window is the area where MDI child windows exist. It doesn't have to cover the whole
parent frame; other windows such as toolbars and a help window might coexist with it.
There can be scrollbars on a client window, which are controlled by the parent window style.

The {\bf wxMDIClientWindow} class is usually adequate without further derivation, and it is created
automatically when the MDI parent frame is created. If the application needs to derive a new class,
the function \helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient} must be
overridden in order to give an opportunity to use a different class of client window.

Under Windows 95, the client window will automatically have a sunken border style when
the active child is not maximized, and no border style when a child is maximized.

\wxheading{See also}

\helpref{wxMDIChildFrame}{wxmdichildframe}, \helpref{wxMDIParentFrame}{wxmdiparentframe},\rtfsp
\helpref{wxFrame}{wxframe}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxMDIClientWindow::wxMDIClientWindow}\label{wxmdiclientwindowconstr}

\func{}{wxMDIClientWindow}{\void}

Default constructor.

\func{}{wxMDIClientWindow}{\param{wxMDIParentFrame* }{parent}, \param{long}{ style = 0}}

Constructor, creating the window.

\wxheading{Parameters}

\docparam{parent}{The window parent.}

\docparam{style}{The window style. Currently unused.}

\wxheading{Remarks}

The second style of constructor is called within \helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}.

\wxheading{See also}

\helpref{wxMDIParentFrame::wxMDIParentFrame}{wxmdiparentframeconstr},\rtfsp
\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}

\membersection{wxMDIClientWindow::\destruct{wxMDIClientWindow}}

\func{}{\destruct{wxMDIClientWindow}}{\void}

Destructor.

\membersection{wxMDIClientWindow::CreateClient}\label{wxmdiclientwindowcreateclient}

\func{bool}{CreateClient}{\param{wxMDIParentFrame* }{parent}, \param{long}{ style = 0}}

Used in two-step frame construction. See \helpref{wxMDIClientWindow::wxMDIClientWindow}{wxmdiclientwindowconstr}\rtfsp
for further details.

\section{\class{wxMDIParentFrame}}\label{wxmdiparentframe}

An MDI (Multiple Document Interface) parent frame is a window which can contain
MDI child frames in its own `desktop'. It is a convenient way to avoid window clutter,
and is used in many popular Windows applications, such as Microsoft Word(TM).

\wxheading{Derived from}

\helpref{wxFrame}{wxframe}\\
\helpref{wxWindow}{wxwindow}\\
\helpref{wxEvtHandler}{wxevthandler}\\
\helpref{wxObject}{wxobject}

\wxheading{Include files}

<wx/mdi.h>

\wxheading{Remarks}

There may be multiple MDI parent frames in a single application, but this probably only makes sense
within programming development environments.

Child frames may be of class \helpref{wxMDIChildFrame}{wxmdichildframe} (contained
within the parent frame) or \helpref{wxFrame}{wxframe} (shown as a top-level frame).

An MDI parent frame always has a \helpref{wxMDIClientWindow}{wxmdiclientwindow} associated with it, which
is the parent for MDI client frames.
This client window may be resized to accommodate non-MDI windows, as seen in Microsoft Visual C++ (TM) and
Microsoft Publisher (TM), where a documentation window is placed to one side of the workspace.

MDI remains popular despite dire warnings from Microsoft itself that MDI is an obsolete
user interface style.

The implementation is native in Windows, and simulated under Motif. Under Motif,
the child window frames will often have a different appearance from other frames
because the window decorations are simulated.

\wxheading{Window styles}

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.}
\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxTHICK\_FRAME \pipe wxSYSTEM\_MENU \pipe wxCAPTION}.}
\twocolitem{\windowstyle{wxHSCROLL}}{Displays a horizontal scrollbar in the {\it client window}, allowing
the user to view child frames that are off the current view.}
\twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized) (Windows only).}
\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized (Windows only).}
\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame (Windows and Motif only).}
\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}.}
\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame (Windows and Motif only).}
\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window (Motif only;
for Windows, it is implicit in wxTHICK\_FRAME).}
\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of other windows (Windows only).}
\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu (Windows and Motif only).}
\twocolitem{\windowstyle{wxTHICK\_FRAME}}{Displays a thick frame around the window (Windows and Motif only).}
\twocolitem{\windowstyle{wxVSCROLL}}{Displays a vertical scrollbar in the {\it client window}, allowing
the user to view child frames that are off the current view.}
\twocolitem{\windowstyle{wxFRAME\_NO\_WINDOW\_MENU}}{Under Windows, removes the Window menu that is normally
added automatically.}
\end{twocollist}

See also \helpref{window styles overview}{windowstyles}.

\wxheading{See also}

\helpref{wxMDIChildFrame}{wxmdichildframe}, \helpref{wxMDIClientWindow}{wxmdiclientwindow},\rtfsp
\helpref{wxFrame}{wxframe}, \helpref{wxDialog}{wxdialog}

\latexignore{\rtfignore{\wxheading{Members}}}

\membersection{wxMDIParentFrame::wxMDIParentFrame}\label{wxmdiparentframeconstr}

\func{}{wxMDIParentFrame}{\void}

Default constructor.

\func{}{wxMDIParentFrame}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE \pipe wxVSCROLL \pipe wxHSCROLL},\rtfsp
\param{const wxString\& }{name = ``frame"}}

Constructor, creating the window.

\wxheading{Parameters}

\docparam{parent}{The window parent. This should be NULL.}

\docparam{id}{The window identifier. It may take a value of -1 to indicate a default value.}

\docparam{title}{The caption to be displayed on the frame's title bar.}

\docparam{pos}{The window position. A value of (-1, -1) indicates a default position, chosen by
either the windowing system or wxWidgets, depending on platform.}

\docparam{size}{The window size. A value of (-1, -1) indicates a default size, chosen by
either the windowing system or wxWidgets, depending on platform.}

\docparam{style}{The window style. See \helpref{wxMDIParentFrame}{wxmdiparentframe}.}

\docparam{name}{The name of the window. This parameter is used to associate a name with the item,
allowing the application user to set Motif resource values for
individual windows.}

\wxheading{Remarks}

During the construction of the frame, the client window will be created. To use a different class
from \helpref{wxMDIClientWindow}{wxmdiclientwindow}, override\rtfsp
\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}.

Under Windows 95, the client window will automatically have a sunken border style when
the active child is not maximized, and no border style when a child is maximized.

\wxheading{See also}

\helpref{wxMDIParentFrame::Create}{wxmdiparentframecreate},\rtfsp
\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}

\membersection{wxMDIParentFrame::\destruct{wxMDIParentFrame}}

\func{}{\destruct{wxMDIParentFrame}}{\void}

Destructor. Destroys all child windows and menu bar if present.

\membersection{wxMDIParentFrame::ActivateNext}\label{wxmdiparentframeactivatenext}

\func{void}{ActivateNext}{\void}

Activates the MDI child following the currently active one.

\wxheading{See also}

\helpref{wxMDIParentFrame::ActivatePrevious}{wxmdiparentframeactivateprevious}

\membersection{wxMDIParentFrame::ActivatePrevious}\label{wxmdiparentframeactivateprevious}

\func{void}{ActivatePrevious}{\void}

Activates the MDI child preceding the currently active one.

\wxheading{See also}

\helpref{wxMDIParentFrame::ActivateNext}{wxmdiparentframeactivatenext}


\membersection{wxMDIParentFrame::ArrangeIcons}\label{wxmdiparentframearrangeicons}

\func{void}{ArrangeIcons}{\void}

Arranges any iconized (minimized) MDI child windows.

\wxheading{See also}

\helpref{wxMDIParentFrame::Cascade}{wxmdiparentframecascade},\rtfsp
\helpref{wxMDIParentFrame::Tile}{wxmdiparentframetile}

\membersection{wxMDIParentFrame::Cascade}\label{wxmdiparentframecascade}

\func{void}{Cascade}{\void}

Arranges the MDI child windows in a cascade.

\wxheading{See also}

\helpref{wxMDIParentFrame::Tile}{wxmdiparentframetile},\rtfsp
\helpref{wxMDIParentFrame::ArrangeIcons}{wxmdiparentframearrangeicons}

\membersection{wxMDIParentFrame::Create}\label{wxmdiparentframecreate}

\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id},\rtfsp
\param{const wxString\& }{title}, \param{const wxPoint\&}{ pos = wxDefaultPosition},\rtfsp
\param{const wxSize\&}{ size = wxDefaultSize}, \param{long}{ style = wxDEFAULT\_FRAME\_STYLE \pipe wxVSCROLL \pipe wxHSCROLL},\rtfsp
\param{const wxString\& }{name = ``frame"}}

Used in two-step frame construction. See \helpref{wxMDIParentFrame::wxMDIParentFrame}{wxmdiparentframeconstr}\rtfsp
for further details.

\membersection{wxMDIParentFrame::GetClientSize}\label{wxmdiparentframegetclientsize}

\constfunc{virtual void}{GetClientSize}{\param{int* }{width}, \param{int* }{height}}

This gets the size of the frame `client area' in pixels.

\wxheading{Parameters}

\docparam{width}{Receives the client width in pixels.}

\docparam{height}{Receives the client height in pixels.}

\wxheading{Remarks}

The client area is the area which may be drawn on by the programmer, excluding title bar, border, status bar,
and toolbar if present.

If you wish to manage your own toolbar (or perhaps you have more than one),
provide an {\bf OnSize} event handler. Call {\bf GetClientSize} to
find how much space there is for your windows and don't forget to set the size and position
of the MDI client window as well as your toolbar and other windows (but not the status bar).

If you have set a toolbar with \helpref{wxMDIParentFrame::SetToolbar}{wxmdiparentframesettoolbar},
the client size returned will have subtracted the toolbar height. However, the available positions
for the client window and other windows of the frame do not start at zero - you must add the toolbar height.

The position and size of the status bar and toolbar (if known to the frame) are always managed
by {\bf wxMDIParentFrame}, regardless of what behaviour is defined in your {\bf OnSize} event handler.
However, the client window position and size are always set in {\bf OnSize}, so if you override this
event handler, make sure you deal with the client window.

You do not have to manage the size and position of MDI child windows, since they are managed
automatically by the client window.

\wxheading{See also}

\helpref{wxMDIParentFrame::GetToolBar}{wxmdiparentframegettoolbar},\rtfsp
\helpref{wxMDIParentFrame::SetToolBar}{wxmdiparentframesettoolbar},\rtfsp
\helpref{wxMDIClientWindow}{wxmdiclientwindow}


\pythonnote{The wxPython version of this method takes no arguments and
returns a tuple containing width and height.}

\membersection{wxMDIParentFrame::GetActiveChild}\label{wxmdiparentframegetactivechild}

\constfunc{wxMDIChildFrame*}{GetActiveChild}{\void}

Returns a pointer to the active MDI child, if there is one.

\membersection{wxMDIParentFrame::GetClientWindow}\label{wxmdiparentframegetclientwindow}

\constfunc{wxMDIClientWindow*}{GetClientWindow}{\void}

Returns a pointer to the client window.

\wxheading{See also}

\helpref{wxMDIParentFrame::OnCreateClient}{wxmdiparentframeoncreateclient}

\membersection{wxMDIParentFrame::GetToolBar}\label{wxmdiparentframegettoolbar}

\constfunc{virtual wxWindow*}{GetToolBar}{\void}

Returns the window being used as the toolbar for this frame.

\wxheading{See also}

\helpref{wxMDIParentFrame::SetToolBar}{wxmdiparentframesettoolbar}

\membersection{wxMDIParentFrame::GetWindowMenu}\label{wxmdiparentframegetwindowmenu}

\constfunc{wxMenu*}{GetWindowMenu}{\void}

Returns the current Window menu (added by wxWidgets to the menubar). This function
is available under Windows only.

\membersection{wxMDIParentFrame::OnCreateClient}\label{wxmdiparentframeoncreateclient}

\func{virtual wxMDIClientWindow*}{OnCreateClient}{\void}

Override this to return a different kind of client window. If you override this function,
you must create your parent frame in two stages, or your function will never be called,
due to the way C++ treats virtual functions called from constructors. For example:

\begin{verbatim}
  frame = new MyParentFrame;
  frame->Create(parent, myParentFrameId, wxT("My Parent Frame"));
\end{verbatim}

\wxheading{Remarks}

You might wish to derive from \helpref{wxMDIClientWindow}{wxmdiclientwindow} in order
to implement different erase behaviour, for example, such as painting a bitmap
on the background.

Note that it is probably impossible to have a client window that scrolls as well as painting
a bitmap or pattern, since in {\bf OnScroll}, the scrollbar positions always return zero.
(Solutions to: {\tt julian.smart@btopenworld.com}).

\wxheading{See also}

\helpref{wxMDIParentFrame::GetClientWindow}{wxmdiparentframegetclientwindow},\rtfsp
\helpref{wxMDIClientWindow}{wxmdiclientwindow}

\membersection{wxMDIParentFrame::SetToolBar}\label{wxmdiparentframesettoolbar}

\func{virtual void}{SetToolBar}{\param{wxWindow*}{ toolbar}}

Sets the window to be used as a toolbar for this
MDI parent window. It saves the application having to manage the positioning
of the toolbar MDI client window.

\wxheading{Parameters}

\docparam{toolbar}{Toolbar to manage.}

\wxheading{Remarks}

When the frame is resized, the toolbar is resized to be the width of
the frame client area, and the toolbar height is kept the same.

The parent of the toolbar must be this frame.

If you wish to manage your own toolbar (or perhaps you have more than one),
don't call this function, and instead manage your subwindows and the MDI client window by
providing an {\bf OnSize} event handler. Call \helpref{wxMDIParentFrame::GetClientSize}{wxmdiparentframegetclientsize} to
find how much space there is for your windows.

Note that SDI (normal) frames and MDI child windows must always have their
toolbars managed by the application.

\wxheading{See also}

\helpref{wxMDIParentFrame::GetToolBar}{wxmdiparentframegettoolbar},\rtfsp
\helpref{wxMDIParentFrame::GetClientSize}{wxmdiparentframegetclientsize}

\membersection{wxMDIParentFrame::SetWindowMenu}\label{wxmdiparentframesetwindowmenu}

\func{void}{SetWindowMenu}{\param{wxMenu*}{ menu}}

Call this to change the current Window menu. Ownership of the menu object passes to
the frame when you call this function.

This call is available under Windows only.

To remove the window completely, use the wxFRAME\_NO\_WINDOW\_MENU window style.

\membersection{wxMDIParentFrame::Tile}\label{wxmdiparentframetile}

\func{void}{Tile}{\void}

Tiles the MDI child windows.

\wxheading{See also}

\helpref{wxMDIParentFrame::Cascade}{wxmdiparentframecascade},\rtfsp
\helpref{wxMDIParentFrame::ArrangeIcons}{wxmdiparentframearrangeicons}


