2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: frame.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxFrame
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFrame
|
|
|
|
@wxheader{frame.h}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxDEFAULT_FRAME_STYLE}:
|
2008-03-08 09:43:31 -05:00
|
|
|
Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER |
|
2008-03-08 08:52:38 -05:00
|
|
|
wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN.
|
|
|
|
@style{wxICONIZE}:
|
|
|
|
Display the frame iconized (minimized). Windows only.
|
|
|
|
@style{wxCAPTION}:
|
|
|
|
Puts a caption on the frame.
|
|
|
|
@style{wxMINIMIZE}:
|
|
|
|
Identical to wxICONIZE. Windows only.
|
|
|
|
@style{wxMINIMIZE_BOX}:
|
|
|
|
Displays a minimize box on the frame.
|
|
|
|
@style{wxMAXIMIZE}:
|
|
|
|
Displays the frame maximized. Windows only.
|
|
|
|
@style{wxMAXIMIZE_BOX}:
|
|
|
|
Displays a maximize box on the frame.
|
|
|
|
@style{wxCLOSE_BOX}:
|
|
|
|
Displays a close box on the frame.
|
|
|
|
@style{wxSTAY_ON_TOP}:
|
|
|
|
Stay on top of all other windows, see also wxFRAME_FLOAT_ON_PARENT.
|
|
|
|
@style{wxSYSTEM_MENU}:
|
|
|
|
Displays a system menu.
|
|
|
|
@style{wxRESIZE_BORDER}:
|
|
|
|
Displays a resizeable border around the 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}:
|
|
|
|
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+
|
2008-03-08 09:43:31 -05:00
|
|
|
is at least version 2.2 and the window manager supports
|
2008-03-08 08:52:38 -05:00
|
|
|
_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}:
|
|
|
|
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. Note that this is an extended style and must be set by
|
|
|
|
calling SetExtraStyle before Create is called (two-step
|
|
|
|
construction). You cannot use this style together with
|
|
|
|
wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so you should use
|
|
|
|
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}:
|
|
|
|
On Mac OS X, frames with this style will be shown with a metallic
|
|
|
|
look. This is an extra style.
|
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{managedwnd}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxFrame : public wxTopLevelWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
|
|
|
Constructor, creating the window.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
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.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The window identifier. It may take a value of -1 to indicate a default
|
|
|
|
value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param title
|
2008-03-09 08:33:59 -04:00
|
|
|
The caption to be displayed on the frame's title bar.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
The window position. The value wxDefaultPosition indicates a default position,
|
|
|
|
chosen by
|
|
|
|
either the windowing system or wxWidgets, depending on platform.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
The window size. The value wxDefaultSize indicates a default size, chosen by
|
|
|
|
either the windowing system or wxWidgets, depending on platform.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style. See wxFrame.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The name of the window. This parameter is used to associate a name with the
|
2008-03-08 08:52:38 -05:00
|
|
|
item,
|
2008-03-09 08:33:59 -04:00
|
|
|
allowing the application user to set Motif resource values for
|
|
|
|
individual windows.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks For Motif, MWM (the Motif Window Manager) should be running for
|
2008-03-09 08:33:59 -04:00
|
|
|
any window styles to work (otherwise all styles take
|
|
|
|
effect).
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxFrame();
|
2008-03-08 09:43:31 -05:00
|
|
|
wxFrame(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = "frame");
|
2008-03-08 08:52:38 -05:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor. Destroys all child windows and menu bar if present.
|
|
|
|
*/
|
|
|
|
~wxFrame();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Centres the frame on the display.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param direction
|
2008-03-09 08:33:59 -04:00
|
|
|
The parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void Centre(int direction = wxBOTH);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Used in two-step frame construction. See wxFrame()
|
|
|
|
for further details.
|
|
|
|
*/
|
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = "frame");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a status bar at the bottom of the frame.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param number
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of fields to create. Specify a
|
|
|
|
value greater than 1 to create a multi-field status bar.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The status bar style. See wxStatusBar for a list
|
|
|
|
of valid styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The status bar window identifier. If -1, an identifier will be chosen by
|
|
|
|
wxWidgets.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The status bar window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@returns A pointer to the status bar if it was created successfully, @NULL
|
2008-03-09 08:33:59 -04:00
|
|
|
otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks The width of the status bar is the whole width of the frame
|
2008-03-09 08:33:59 -04:00
|
|
|
(adjusted automatically when resizing), and the height
|
|
|
|
and text size are chosen by the host windowing system.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetStatusText(), OnCreateStatusBar(), GetStatusBar()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual wxStatusBar* CreateStatusBar(int number = 1,
|
|
|
|
long style = 0,
|
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& name = "statusBar");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Creates a toolbar at the top or left of the frame.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar style. See wxToolBar for a list
|
|
|
|
of valid styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar window identifier. If -1, an identifier will be chosen by
|
|
|
|
wxWidgets.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@returns A pointer to the toolbar if it was created successfully, @NULL
|
2008-03-09 08:33:59 -04:00
|
|
|
otherwise.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks By default, the toolbar is an instance of wxToolBar (which is
|
2008-03-09 08:33:59 -04:00
|
|
|
defined to be a suitable toolbar class on each
|
|
|
|
platform, such as wxToolBar95). To use a different
|
|
|
|
class, override OnCreateToolBar().
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateStatusBar(), OnCreateToolBar(), SetToolBar(),
|
|
|
|
GetToolBar()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual wxToolBar* CreateToolBar(long style = wxBORDER_NONE | wxTB_HORIZONTAL,
|
2008-03-08 08:52:38 -05:00
|
|
|
wxWindowID id = -1,
|
|
|
|
const wxString& name = "toolBar");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the origin of the frame client area (in client coordinates). It may be
|
|
|
|
different from (0, 0) if the frame has a toolbar.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetClientAreaOrigin() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the menubar currently associated with the frame (if any).
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetMenuBar(), wxMenuBar, wxMenu
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxMenuBar* GetMenuBar() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the status bar currently associated with the frame (if
|
|
|
|
any).
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateStatusBar(), wxStatusBar
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxStatusBar* GetStatusBar() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the status bar pane used to display menu and toolbar help.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetStatusBarPane()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
int GetStatusBarPane();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns a pointer to the toolbar currently associated with the frame (if any).
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateToolBar(), wxToolBar, SetToolBar()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxToolBar* GetToolBar() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Virtual function called when a status bar is requested by CreateStatusBar().
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param number
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of fields to create.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The window style. See wxStatusBar for a list
|
|
|
|
of valid styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The window identifier. If -1, an identifier will be chosen by
|
|
|
|
wxWidgets.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@returns A status bar object.
|
|
|
|
|
|
|
|
@remarks An application can override this function to return a different
|
2008-03-09 08:33:59 -04:00
|
|
|
kind of status bar. The default implementation returns
|
|
|
|
an instance of wxStatusBar.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateStatusBar(), wxStatusBar.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual wxStatusBar* OnCreateStatusBar(int number, long style,
|
|
|
|
wxWindowID id,
|
|
|
|
const wxString& name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Virtual function called when a toolbar is requested by CreateToolBar().
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar style. See wxToolBar for a list
|
|
|
|
of valid styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar window identifier. If -1, an identifier will be chosen by
|
|
|
|
wxWidgets.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
The toolbar window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@returns A toolbar object.
|
|
|
|
|
|
|
|
@remarks An application can override this function to return a different
|
2008-03-09 08:33:59 -04:00
|
|
|
kind of toolbar. The default implementation returns an
|
|
|
|
instance of wxToolBar.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateToolBar(), wxToolBar.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual wxToolBar* OnCreateToolBar(long style, wxWindowID id,
|
|
|
|
const wxString& name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Simulate a menu command.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
The identifier for a menu item.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void ProcessCommand(int id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
This function sends a dummy @ref overview_wxsizeevent "size event" 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 wxWindow::Layout directly and
|
|
|
|
this function should not be used in this case.
|
|
|
|
*/
|
|
|
|
void SendSizeEvent();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Tells the frame to show the given menu bar.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param menuBar
|
2008-03-09 08:33:59 -04:00
|
|
|
The menu bar to associate with the frame.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks If the frame is destroyed, the menu bar and its menus will be
|
2008-03-09 08:33:59 -04:00
|
|
|
destroyed also, so do not delete the menu bar
|
|
|
|
explicitly (except by resetting the frame's menu bar to
|
|
|
|
another frame or @NULL).
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetMenuBar(), wxMenuBar, wxMenu.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetMenuBar(wxMenuBar* menuBar);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Associates a status bar with the frame.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateStatusBar(), wxStatusBar, GetStatusBar()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetStatusBar(wxStatusBar* statusBar);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Set the status bar pane used to display menu and toolbar help.
|
|
|
|
Using -1 disables help display.
|
|
|
|
*/
|
|
|
|
void SetStatusBarPane(int n);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the status bar text and redraws the status bar.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param text
|
2008-03-09 08:33:59 -04:00
|
|
|
The text for the status field.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param number
|
2008-03-09 08:33:59 -04:00
|
|
|
The status field (starting from zero).
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks Use an empty string to clear the status bar.
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see CreateStatusBar(), wxStatusBar
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
virtual void SetStatusText(const wxString& text, int number = 0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the widths of the fields in the status bar.
|
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param n
|
2008-03-09 08:33:59 -04:00
|
|
|
The number of fields in the status bar. It must be the
|
|
|
|
same used in CreateStatusBar.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param widths
|
2008-03-09 08:33:59 -04:00
|
|
|
Must contain an array of 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
|
|
|
|
SetStatusWidths.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
@remarks The widths of the variable fields are calculated from the total
|
2008-03-09 08:33:59 -04:00
|
|
|
width of all fields, minus the sum of widths of the
|
|
|
|
non-variable fields, divided by the number of variable
|
|
|
|
fields.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 08:33:59 -04:00
|
|
|
virtual void SetStatusWidths(int n, int* widths);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Associates a toolbar with the frame.
|
|
|
|
*/
|
|
|
|
void SetToolBar(wxToolBar* toolBar);
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|