\section{\class{wxFrame}}\label{wxframe}

A frame is a window whose size and position can (usually) be changed by the
user. It usually has thick borders and a title bar, and can optionally contain
a menu bar, toolbar and status bar. A frame can contain any window that is not
a frame or dialog.

A frame that has a status bar and toolbar created via the
CreateStatusBar/CreateToolBar functions manages these windows, and adjusts the
value returned by GetClientSize to reflect the remaining size available to
application windows.

\wxheading{Derived from}

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

\wxheading{Include files}

<wx/frame.h>

\wxheading{Window styles}

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\windowstyle{wxDEFAULT\_FRAME\_STYLE}}{Defined as {\bf wxMINIMIZE\_BOX \pipe wxMAXIMIZE\_BOX \pipe wxRESIZE\_BORDER \pipe wxSYSTEM\_MENU \pipe wxCAPTION \pipe wxCLOSE\_BOX \pipe wxCLIP\_CHILDREN}.}
\twocolitem{\windowstyle{wxICONIZE}}{Display the frame iconized (minimized). Windows only. }
\twocolitem{\windowstyle{wxCAPTION}}{Puts a caption on the frame.}
\twocolitem{\windowstyle{wxMINIMIZE}}{Identical to {\bf wxICONIZE}. Windows only.}
\twocolitem{\windowstyle{wxMINIMIZE\_BOX}}{Displays a minimize box on the frame.}
\twocolitem{\windowstyle{wxMAXIMIZE}}{Displays the frame maximized. Windows only.}
\twocolitem{\windowstyle{wxMAXIMIZE\_BOX}}{Displays a maximize box on the frame.}
\twocolitem{\windowstyle{wxCLOSE\_BOX}}{Displays a close box on the frame.}
\twocolitem{\windowstyle{wxSTAY\_ON\_TOP}}{Stay on top of all other windows,
see also wxFRAME\_FLOAT\_ON\_PARENT.}
\twocolitem{\windowstyle{wxSYSTEM\_MENU}}{Displays a system menu.}
\twocolitem{\windowstyle{wxRESIZE\_BORDER}}{Displays a resizeable border around the window.}
\twocolitem{\windowstyle{wxFRAME\_TOOL\_WINDOW}}{Causes a frame with a small
titlebar to be created; the frame does not appear in the taskbar under Windows or GTK+.}
\twocolitem{\windowstyle{wxFRAME\_NO\_TASKBAR}}{Creates an otherwise normal
frame but it does not appear in the taskbar under Windows or GTK+ (note that it
will minimize to the desktop window under Windows which may seem strange to the
users and thus it might be better to use this style only without
wxMINIMIZE\_BOX style). In wxGTK, the flag is respected only if GTK+ is at
least version 2.2 and the window manager supports 
\urlref{\_NET\_WM\_STATE\_SKIP\_TASKBAR}{http://freedesktop.org/Standards/wm-spec/1.3/ar01s05.html} hint.
Has no effect under other platforms.}
\twocolitem{\windowstyle{wxFRAME\_FLOAT\_ON\_PARENT}}{The frame will always be
on top of its parent (unlike wxSTAY\_ON\_TOP). A frame created with this style
must have a non-NULL parent.}
\twocolitem{\windowstyle{wxFRAME\_EX\_CONTEXTHELP}}{Under Windows, puts a query button on the
caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send
a wxEVT\_HELP event if the user clicked on an application window. {\it Note} that this is an extended
style and must be set by calling \helpref{SetExtraStyle}{wxwindowsetextrastyle} before Create is called (two-step construction).
You cannot use this style together with wxMAXIMIZE\_BOX or wxMINIMIZE\_BOX, so
you should use\rtfsp
{\tt wxDEFAULT\_FRAME\_STYLE \& ~ (wxMINIMIZE\_BOX | wxMAXIMIZE\_BOX)} for the
frames having this style (the dialogs don't have a minimize or a maximize box by
default)}
\twocolitem{\windowstyle{wxFRAME\_SHAPED}}{Windows with this style are
  allowed to have their shape changed with the \helpref{SetShape}{wxtoplevelwindowsetshape} method.}
\twocolitem{\windowstyle{wxFRAME\_EX\_METAL}}{On Mac OS X, frames with this style will be shown with a metallic look. This is an {\it extra} style.}
\end{twocollist}

The default frame style is for normal, resizeable frames. To create a frame
which can not be resized by user, you may use the following combination of
styles: {\tt wxDEFAULT\_FRAME\_STYLE \& ~ (wxRESIZE\_BORDER \pipe wxRESIZE\_BOX \pipe wxMAXIMIZE\_BOX)}.
% Note: the space after the tilde is necessary or Tex2RTF complains.

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

\wxheading{Default event processing}

wxFrame processes the following events:

\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxEVT\_SIZE}{wxsizeevent}}{If the frame has exactly one
child window, not counting the status and toolbar, this child is resized to
take the entire frame client area. If two or more windows are present, they
should be laid out explicitly either by manually handling wxEVT\_SIZE or using
\helpref{sizers}{sizeroverview}}

\twocolitem{\helpref{wxEVT\_MENU\_HIGHLIGHT}{wxmenuevent}}{The default
implementation displays the \helpref{help string}{wxmenuitemgethelp} associated
with the selected item in the first pane of the status bar, if there is one.}
\end{twocollist}

\wxheading{Remarks}

An application should normally define an \helpref{wxCloseEvent}{wxcloseevent} handler for the
frame to respond to system close events, for example so that related data and subwindows can be cleaned up.

\wxheading{See also}

\helpref{wxMDIParentFrame}{wxmdiparentframe}, \helpref{wxMDIChildFrame}{wxmdichildframe},\rtfsp
\helpref{wxMiniFrame}{wxminiframe}, \helpref{wxDialog}{wxdialog}

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

\membersection{wxFrame::wxFrame}\label{wxframector}

\func{}{wxFrame}{\void}

Default constructor.

\func{}{wxFrame}{\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"}}

Constructor, creating the window.

\wxheading{Parameters}

\docparam{parent}{The window parent. This may be NULL. If it is non-NULL, the frame will
always be displayed on top of the parent window on Windows.}

\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{wxFrame}{wxframe}.}

\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}

For Motif, MWM (the Motif Window Manager) should be running for any window styles to work
(otherwise all styles take effect).

\wxheading{See also}

\helpref{wxFrame::Create}{wxframecreate}

\membersection{wxFrame::\destruct{wxFrame}}\label{wxframedtor}

\func{void}{\destruct{wxFrame}}{\void}

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

\membersection{wxFrame::Centre}\label{wxframecentre}

\func{void}{Centre}{\param{int}{ direction = wxBOTH}}

Centres the frame on the display.

\wxheading{Parameters}

\docparam{direction}{The parameter may be {\tt wxHORIZONTAL}, {\tt wxVERTICAL} or {\tt wxBOTH}.}

\membersection{wxFrame::Create}\label{wxframecreate}

\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{wxFrame::wxFrame}{wxframector}\rtfsp
for further details.

\membersection{wxFrame::CreateStatusBar}\label{wxframecreatestatusbar}

\func{virtual wxStatusBar*}{CreateStatusBar}{\param{int}{ number = 1},
 \param{long}{ style = wxST\_SIZEGRIP | wxFULL\_REPAINT\_ON\_RESIZE},
 \param{wxWindowID}{ id = 0}, \param{const wxString\&}{ name = "statusBar"}}

Creates a status bar at the bottom of the frame.

\wxheading{Parameters}

\docparam{number}{The number of fields to create. Specify a
value greater than 1 to create a multi-field status bar.}

\docparam{style}{The status bar style. See \helpref{wxStatusBar}{wxstatusbar} for a list
of valid styles.}

\docparam{id}{The status bar window identifier. If -1, an identifier will be chosen by
wxWidgets.}

\docparam{name}{The status bar window name.}

\wxheading{Return value}

A pointer to the status bar if it was created successfully, NULL otherwise.

\wxheading{Remarks}

The width of the status bar is the whole width of the frame (adjusted automatically when
resizing), and the height and text size are chosen by the host windowing system.

By default, the status bar is an instance of wxStatusBar. To use a different class,
override \helpref{wxFrame::OnCreateStatusBar}{wxframeoncreatestatusbar}.

Note that you can put controls and other windows on the status bar if you wish.

\wxheading{See also}

\helpref{wxFrame::SetStatusText}{wxframesetstatustext},\rtfsp
\helpref{wxFrame::OnCreateStatusBar}{wxframeoncreatestatusbar},\rtfsp
\helpref{wxFrame::GetStatusBar}{wxframegetstatusbar}

\membersection{wxFrame::CreateToolBar}\label{wxframecreatetoolbar}

\func{virtual wxToolBar*}{CreateToolBar}{\param{long}{ style = wxNO\_BORDER \pipe wxTB\_HORIZONTAL},
 \param{wxWindowID}{ id = -1}, \param{const wxString\&}{ name = "toolBar"}}

Creates a toolbar at the top or left of the frame.

\wxheading{Parameters}

\docparam{style}{The toolbar style. See \helpref{wxToolBar}{wxtoolbar} for a list
of valid styles.}

\docparam{id}{The toolbar window identifier. If -1, an identifier will be chosen by
wxWidgets.}

\docparam{name}{The toolbar window name.}

\wxheading{Return value}

A pointer to the toolbar if it was created successfully, NULL otherwise.

\wxheading{Remarks}

By default, the toolbar is an instance of wxToolBar (which is defined to be
a suitable toolbar class on each platform, such as wxToolBar95). To use a different class,
override \helpref{wxFrame::OnCreateToolBar}{wxframeoncreatetoolbar}.

When a toolbar has been created with this function, or made known to the frame
with \helpref{wxFrame::SetToolBar}{wxframesettoolbar}, the frame will manage the toolbar
position and adjust the return value from \helpref{wxWindow::GetClientSize}{wxwindowgetclientsize} to
reflect the available space for application windows.

Under Pocket PC, you should {\it always} use this function for creating the toolbar
to be managed by the frame, so that wxWidgets can use a combined
menubar and toolbar. Where you manage your own toolbars, create a wxToolBar
as usual.

\wxheading{See also}

\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar},\rtfsp
\helpref{wxFrame::OnCreateToolBar}{wxframeoncreatetoolbar},\rtfsp
\helpref{wxFrame::SetToolBar}{wxframesettoolbar},\rtfsp
\helpref{wxFrame::GetToolBar}{wxframegettoolbar}

\membersection{wxFrame::GetClientAreaOrigin}\label{wxframegetclientareaorigin}

\constfunc{wxPoint}{GetClientAreaOrigin}{\void}

Returns the origin of the frame client area (in client coordinates). It may be
different from (0, 0) if the frame has a toolbar.

\membersection{wxFrame::GetMenuBar}\label{wxframegetmenubar}

\constfunc{wxMenuBar*}{GetMenuBar}{\void}

Returns a pointer to the menubar currently associated with the frame (if any).

\wxheading{See also}

\helpref{wxFrame::SetMenuBar}{wxframesetmenubar}, \helpref{wxMenuBar}{wxmenubar}, \helpref{wxMenu}{wxmenu}

\membersection{wxFrame::GetStatusBar}\label{wxframegetstatusbar}

\constfunc{wxStatusBar*}{GetStatusBar}{\void}

Returns a pointer to the status bar currently associated with the frame (if any).

\wxheading{See also}

\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar}

\membersection{wxFrame::GetStatusBarPane}\label{wxframegetstatusbarpane}

\func{int}{GetStatusBarPane}{\void}

Returns the status bar pane used to display menu and toolbar help.

\wxheading{See also}

\helpref{wxFrame::SetStatusBarPane}{wxframesetstatusbarpane}

\membersection{wxFrame::GetToolBar}\label{wxframegettoolbar}

\constfunc{wxToolBar*}{GetToolBar}{\void}

Returns a pointer to the toolbar currently associated with the frame (if any).

\wxheading{See also}

\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar},\rtfsp
\helpref{wxFrame::SetToolBar}{wxframesettoolbar}

\membersection{wxFrame::OnCreateStatusBar}\label{wxframeoncreatestatusbar}

\func{virtual wxStatusBar*}{OnCreateStatusBar}{\param{int }{number},
 \param{long}{ style},
 \param{wxWindowID}{ id}, \param{const wxString\&}{ name}}

Virtual function called when a status bar is requested by \helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}.

\wxheading{Parameters}

\docparam{number}{The number of fields to create.}

\docparam{style}{The window style. See \helpref{wxStatusBar}{wxstatusbar} for a list
of valid styles.}

\docparam{id}{The window identifier. If -1, an identifier will be chosen by
wxWidgets.}

\docparam{name}{The window name.}

\wxheading{Return value}

A status bar object.

\wxheading{Remarks}

An application can override this function to return a different kind of status bar. The default
implementation returns an instance of \helpref{wxStatusBar}{wxstatusbar}.

\wxheading{See also}

\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar}.

\membersection{wxFrame::OnCreateToolBar}\label{wxframeoncreatetoolbar}

\func{virtual wxToolBar*}{OnCreateToolBar}{\param{long}{ style},
 \param{wxWindowID}{ id}, \param{const wxString\&}{ name}}

Virtual function called when a toolbar is requested by \helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}.

\wxheading{Parameters}

\docparam{style}{The toolbar style. See \helpref{wxToolBar}{wxtoolbar} for a list
of valid styles.}

\docparam{id}{The toolbar window identifier. If -1, an identifier will be chosen by
wxWidgets.}

\docparam{name}{The toolbar window name.}

\wxheading{Return value}

A toolbar object.

\wxheading{Remarks}

An application can override this function to return a different kind of toolbar. The default
implementation returns an instance of \helpref{wxToolBar}{wxtoolbar}.

\wxheading{See also}

\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar}.


\membersection{wxFrame::ProcessCommand}\label{wxframeprocesscommand}

\func{void}{ProcessCommand}{\param{int }{id}}

Simulate a menu command.

\wxheading{Parameters}

\docparam{id}{The identifier for a menu item.}


\membersection{wxFrame::SendSizeEvent}\label{wxframesendsizeevent}

\func{void}{SendSizeEvent}{\void}

This function sends a dummy \helpref{size event}{wxsizeevent} to the frame
forcing it to reevaluate its children positions. It is sometimes useful to call
this function after adding or deleting a children after the frame creation or
if a child size changes.

Note that if the frame is using either sizers or constraints for the children
layout, it is enough to call \helpref{Layout()}{wxwindowlayout} directly and
this function should not be used in this case.

% VZ: we don't have all this any more (18.08.00)
%
%Under Windows, instead of using {\bf SetIcon}, you can add the
%following lines to your MS Windows resource file:
%
%\begin{verbatim}
%wxSTD_MDIPARENTFRAME ICON icon1.ico
%wxSTD_MDICHILDFRAME  ICON icon2.ico
%wxSTD_FRAME          ICON icon3.ico
%\end{verbatim}
%
%where icon1.ico will be used for the MDI parent frame, icon2.ico
%will be used for MDI child frames, and icon3.ico will be used for
%non-MDI frames.
%
%If these icons are not supplied, and {\bf SetIcon} is not called either,
%then the following defaults apply if you have included wx.rc.
%
%\begin{verbatim}
%wxDEFAULT_FRAME               ICON std.ico
%wxDEFAULT_MDIPARENTFRAME      ICON mdi.ico
%wxDEFAULT_MDICHILDFRAME       ICON child.ico
%\end{verbatim}
%
%You can replace std.ico, mdi.ico and child.ico with your own defaults
%for all your wxWidgets application. Currently they show the same icon.

\membersection{wxFrame::SetMenuBar}\label{wxframesetmenubar}

\func{void}{SetMenuBar}{\param{wxMenuBar* }{menuBar}}

Tells the frame to show the given menu bar.

\wxheading{Parameters}

\docparam{menuBar}{The menu bar to associate with the frame.}

\wxheading{Remarks}

If the frame is destroyed, the
menu bar and its menus will be destroyed also, so do not delete the menu
bar explicitly (except by resetting the frame's menu bar to another
frame or NULL).

Under Windows, a size event is generated, so be sure to initialize
data members properly before calling {\bf SetMenuBar}.

Note that on some platforms, it is not possible to call this function twice for the same frame object.

\wxheading{See also}

\helpref{wxFrame::GetMenuBar}{wxframegetmenubar}, \helpref{wxMenuBar}{wxmenubar}, \helpref{wxMenu}{wxmenu}.

\membersection{wxFrame::SetStatusBar}\label{wxframesetstatusbar}

\func{void}{SetStatusBar}{\param{wxStatusBar*}{ statusBar}}

Associates a status bar with the frame.

\wxheading{See also}

\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar},\rtfsp
\helpref{wxFrame::GetStatusBar}{wxframegetstatusbar}

\membersection{wxFrame::SetStatusBarPane}\label{wxframesetstatusbarpane}

\func{void}{SetStatusBarPane}{\param{int}{ n}}

Set the status bar pane used to display menu and toolbar help.
Using -1 disables help display.

\membersection{wxFrame::SetStatusText}\label{wxframesetstatustext}

\func{virtual void}{SetStatusText}{\param{const wxString\& }{ text}, \param{int}{ number = 0}}

Sets the status bar text and redraws the status bar.

\wxheading{Parameters}

\docparam{text}{The text for the status field.}

\docparam{number}{The status field (starting from zero).}

\wxheading{Remarks}

Use an empty string to clear the status bar.

\wxheading{See also}

\helpref{wxFrame::CreateStatusBar}{wxframecreatestatusbar}, \helpref{wxStatusBar}{wxstatusbar}

\membersection{wxFrame::SetStatusWidths}\label{wxframesetstatuswidths}

\func{virtual void}{SetStatusWidths}{\param{int}{ n}, \param{int *}{widths}}

Sets the widths of the fields in the status bar.

\wxheading{Parameters}

\docparam{n}{The number of fields in the status bar. It must be the
same used in \helpref{CreateStatusBar}{wxframecreatestatusbar}.}

\docparam{widths}{Must contain an array of {\it n} integers, each of which is a status field width
in pixels. A value of -1 indicates that the field is variable width; at least one
field must be -1. You should delete this array after calling {\bf SetStatusWidths}.}

\wxheading{Remarks}

The widths of the variable fields are calculated from the total width of all fields,
minus the sum of widths of the non-variable fields, divided by the number of
variable fields.

\pythonnote{Only a single parameter is required, a Python list of
integers.}

\perlnote{In wxPerl this method takes the field widths as parameters.}

\membersection{wxFrame::SetToolBar}\label{wxframesettoolbar}

\func{void}{SetToolBar}{\param{wxToolBar*}{ toolBar}}

Associates a toolbar with the frame.

\wxheading{See also}

\helpref{wxFrame::CreateToolBar}{wxframecreatetoolbar}, \helpref{wxToolBar}{wxtoolbar},\rtfsp
\helpref{wxFrame::GetToolBar}{wxframegettoolbar}

