/////////////////////////////////////////////////////////////////////////////
// Name: frame.h
-// Purpose: documentation for wxFrame class
+// Purpose: interface of wxFrame
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
@class wxFrame
@wxheader{frame.h}
- 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 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.
+ A frame that has a status bar and toolbar, created via the CreateStatusBar() and
+ CreateToolBar() functions, manages these windows and adjusts the value returned
+ by GetClientSize() to reflect the remaining size available to application windows.
+
+ @remarks An application should normally define an wxCloseEvent handler for the
+ frame to respond to system close events, for example so that related
+ data and subwindows can be cleaned up.
+
+
+ @section wxframe_defaultevent Default event processing
+
+ wxFrame processes the following events:
+
+ @li @c wxEVT_SIZE: 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 sizers;
+ @li @c wxEVT_MENU_HIGHLIGHT: the default implementation displays the help string
+ associated with the selected item in the first pane of the status bar, if there is one.
+
@beginStyleTable
- @style{wxDEFAULT_FRAME_STYLE}:
+ @style{wxDEFAULT_FRAME_STYLE}
Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER |
wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN.
- @style{wxICONIZE}:
+ @style{wxICONIZE}
Display the frame iconized (minimized). Windows only.
- @style{wxCAPTION}:
+ @style{wxCAPTION}
Puts a caption on the frame.
- @style{wxMINIMIZE}:
+ @style{wxMINIMIZE}
Identical to wxICONIZE. Windows only.
- @style{wxMINIMIZE_BOX}:
+ @style{wxMINIMIZE_BOX}
Displays a minimize box on the frame.
- @style{wxMAXIMIZE}:
+ @style{wxMAXIMIZE}
Displays the frame maximized. Windows only.
- @style{wxMAXIMIZE_BOX}:
+ @style{wxMAXIMIZE_BOX}
Displays a maximize box on the frame.
- @style{wxCLOSE_BOX}:
+ @style{wxCLOSE_BOX}
Displays a close box on the frame.
- @style{wxSTAY_ON_TOP}:
+ @style{wxSTAY_ON_TOP}
Stay on top of all other windows, see also wxFRAME_FLOAT_ON_PARENT.
- @style{wxSYSTEM_MENU}:
+ @style{wxSYSTEM_MENU}
Displays a system menu.
- @style{wxRESIZE_BORDER}:
+ @style{wxRESIZE_BORDER}
Displays a resizeable border around the window.
- @style{wxFRAME_TOOL_WINDOW}:
+ @style{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+.
- @style{wxFRAME_NO_TASKBAR}:
+ @style{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
- _NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other
- platforms.
- @style{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.
- @style{wxFRAME_EX_CONTEXTHELP}:
+ _NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other platforms.
+ @style{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.
+ @style{wxFRAME_SHAPED}
+ Windows with this style are allowed to have their shape changed
+ with the SetShape() method.
+ @endStyleTable
+
+ 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:
+
+ @code
+ wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX)
+ @endcode
+
+ See also the @ref overview_windowstyles.
+
+ @beginExtraStyleTable
+ @style{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
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)
- @style{wxFRAME_SHAPED}:
- Windows with this style are allowed to have their shape changed
- with the SetShape method.
- @style{wxFRAME_EX_METAL}:
+ @style{wxFRAME_EX_METAL}
On Mac OS X, frames with this style will be shown with a metallic
look. This is an extra style.
- @endStyleTable
+ @endExtraStyleTable
@library{wxcore}
@category{managedwnd}
- @seealso
- wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog
+ @see wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog
*/
class wxFrame : public wxTopLevelWindow
{
//@{
/**
Constructor, creating the window.
-
+
@param 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.
item,
allowing the application user to set Motif resource values for
individual windows.
-
+
@remarks For Motif, MWM (the Motif Window Manager) should be running for
any window styles to work (otherwise all styles take
effect).
-
+
@see Create()
*/
wxFrame();
/**
Centres the frame on the display.
-
+
@param direction
The parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.
*/
/**
Creates a status bar at the bottom of the frame.
-
+
@param number
The number of fields to create. Specify a
value greater than 1 to create a multi-field status bar.
wxWidgets.
@param name
The status bar window name.
-
- @returns A pointer to the status bar if it was created successfully, @NULL
+
+ @return A pointer to the status bar if it was created successfully, @NULL
otherwise.
-
+
@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.
-
+
@see SetStatusText(), OnCreateStatusBar(), GetStatusBar()
*/
virtual wxStatusBar* CreateStatusBar(int number = 1,
/**
Creates a toolbar at the top or left of the frame.
-
+
@param style
The toolbar style. See wxToolBar for a list
of valid styles.
wxWidgets.
@param name
The toolbar window name.
-
- @returns A pointer to the toolbar if it was created successfully, @NULL
+
+ @return A pointer to the toolbar if it was created successfully, @NULL
otherwise.
-
+
@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 OnCreateToolBar().
-
+
@see CreateStatusBar(), OnCreateToolBar(), SetToolBar(),
GetToolBar()
*/
/**
Returns a pointer to the menubar currently associated with the frame (if any).
-
+
@see SetMenuBar(), wxMenuBar, wxMenu
*/
wxMenuBar* GetMenuBar() const;
/**
Returns a pointer to the status bar currently associated with the frame (if
any).
-
+
@see CreateStatusBar(), wxStatusBar
*/
wxStatusBar* GetStatusBar() const;
/**
Returns the status bar pane used to display menu and toolbar help.
-
+
@see SetStatusBarPane()
*/
int GetStatusBarPane();
/**
Returns a pointer to the toolbar currently associated with the frame (if any).
-
+
@see CreateToolBar(), wxToolBar, SetToolBar()
*/
wxToolBar* GetToolBar() const;
/**
Virtual function called when a status bar is requested by CreateStatusBar().
-
+
@param number
The number of fields to create.
@param style
wxWidgets.
@param name
The window name.
-
- @returns A status bar object.
-
+
+ @return A status bar object.
+
@remarks An application can override this function to return a different
kind of status bar. The default implementation returns
an instance of wxStatusBar.
-
+
@see CreateStatusBar(), wxStatusBar.
*/
virtual wxStatusBar* OnCreateStatusBar(int number, long style,
/**
Virtual function called when a toolbar is requested by CreateToolBar().
-
+
@param style
The toolbar style. See wxToolBar for a list
of valid styles.
wxWidgets.
@param name
The toolbar window name.
-
- @returns A toolbar object.
-
+
+ @return A toolbar object.
+
@remarks An application can override this function to return a different
kind of toolbar. The default implementation returns an
instance of wxToolBar.
-
+
@see CreateToolBar(), wxToolBar.
*/
virtual wxToolBar* OnCreateToolBar(long style, wxWindowID id,
/**
Simulate a menu command.
-
+
@param id
The identifier for a menu item.
*/
/**
Tells the frame to show the given menu bar.
-
+
@param menuBar
The menu bar to associate with the frame.
-
+
@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).
-
+
@see GetMenuBar(), wxMenuBar, wxMenu.
*/
void SetMenuBar(wxMenuBar* menuBar);
/**
Associates a status bar with the frame.
-
+
@see CreateStatusBar(), wxStatusBar, GetStatusBar()
*/
void SetStatusBar(wxStatusBar* statusBar);
/**
Sets the status bar text and redraws the status bar.
-
+
@param text
The text for the status field.
@param number
The status field (starting from zero).
-
+
@remarks Use an empty string to clear the status bar.
-
+
@see CreateStatusBar(), wxStatusBar
*/
virtual void SetStatusText(const wxString& text, int number = 0);
/**
Sets the widths of the fields in the status bar.
-
+
@param n
The number of fields in the status bar. It must be the
same used in CreateStatusBar.
least one
field must be -1. You should delete this array after calling
SetStatusWidths.
-
+
@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
*/
void SetToolBar(wxToolBar* toolBar);
};
+