Version: 2.9.4
Public Member Functions
wxFrame Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/frame.h>

Inheritance diagram for wxFrame:

Detailed Description

フレームは (通常は) ユーザがサイズや位置を変更可能なウィンドウです。

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() and CreateToolBar() functions, manages these windows and adjusts the value returned by GetClientSize() to reflect the remaining size available to application windows.

注意:
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.

Default event processing

wxFrame processes the following events:

Styles

This class supports the following styles:

The default frame style is for normal, resizable frames. To create a frame which cannot be resized by user, you may use the following combination of styles:

See also the Window Styles.


Extra styles

This class supports the following extra styles:

Events emitted by this class

Event macros for events emitted by this class:

Library:  wxCore
Category:  Managed Windows
参照:
wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog

Public Member Functions

 wxFrame ()
 Default constructor.
 wxFrame (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE, const wxString &name=wxFrameNameStr)
 Constructor, creating the window.
virtual ~wxFrame ()
 Destructor.
void Centre (int direction=wxBOTH)
 Centres the frame on the display.
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=wxFrameNameStr)
 Used in two-step frame construction.
virtual wxStatusBarCreateStatusBar (int number=1, long style=wxSTB_DEFAULT_STYLE, wxWindowID id=0, const wxString &name=wxStatusBarNameStr)
 Creates a status bar at the bottom of the frame.
virtual wxToolBarCreateToolBar (long style=wxBORDER_NONE|wxTB_HORIZONTAL, wxWindowID id=wxID_ANY, const wxString &name=wxToolBarNameStr)
 Creates a toolbar at the top or left of the frame.
virtual wxPoint GetClientAreaOrigin () const
 Returns the origin of the frame client area (in client coordinates).
virtual wxMenuBarGetMenuBar () const
 Returns a pointer to the menubar currently associated with the frame (if any).
virtual wxStatusBarGetStatusBar () const
 Returns a pointer to the status bar currently associated with the frame (if any).
int GetStatusBarPane () const
 Returns the status bar pane used to display menu and toolbar help.
virtual wxToolBarGetToolBar () const
 Returns a pointer to the toolbar currently associated with the frame (if any).
virtual wxStatusBarOnCreateStatusBar (int number, long style, wxWindowID id, const wxString &name)
 Virtual function called when a status bar is requested by CreateStatusBar().
virtual wxToolBarOnCreateToolBar (long style, wxWindowID id, const wxString &name)
 Virtual function called when a toolbar is requested by CreateToolBar().
bool ProcessCommand (int id)
 Simulate a menu command.
virtual void SetMenuBar (wxMenuBar *menuBar)
 Tells the frame to show the given menu bar.
virtual void SetStatusBar (wxStatusBar *statusBar)
 Associates a status bar with the frame.
void SetStatusBarPane (int n)
 Set the status bar pane used to display menu and toolbar help.
virtual void SetStatusText (const wxString &text, int number=0)
 Sets the status bar text and redraws the status bar.
virtual void SetStatusWidths (int n, const int *widths_field)
 Sets the widths of the fields in the status bar.
virtual void SetToolBar (wxToolBar *toolBar)
 Associates a toolbar with the frame.
void PushStatusText (const wxString &text, int number=0)
void PopStatusText (int number=0)

List of all members.


Constructor & Destructor Documentation

wxFrame::wxFrame ( )

Default constructor.

wxFrame::wxFrame ( wxWindow parent,
wxWindowID  id,
const wxString title,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxDEFAULT_FRAME_STYLE,
const wxString name = wxFrameNameStr 
)

Constructor, creating the window.

Parameters:
parentThe 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.
idThe window identifier. It may take a value of -1 to indicate a default value.
titleThe caption to be displayed on the frame's title bar.
posThe window position. The value wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
sizeThe window size. The value wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
styleThe window style. See wxFrame class description.
nameThe 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.
注意:
For Motif, MWM (the Motif Window Manager) should be running for any window styles to work (otherwise all styles take effect).
参照:
Create()
virtual wxFrame::~wxFrame ( ) [virtual]

Destructor.

Destroys all child windows and menu bar if present.

See Window Deletion for more info.


Member Function Documentation

void wxFrame::Centre ( int  direction = wxBOTH)

Centres the frame on the display.

Parameters:
directionThe parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.

Reimplemented from wxWindow.

bool wxFrame::Create ( wxWindow parent,
wxWindowID  id,
const wxString title,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxDEFAULT_FRAME_STYLE,
const wxString name = wxFrameNameStr 
)

Used in two-step frame construction.

See wxFrame() for further details.

Reimplemented from wxTopLevelWindow.

Reimplemented in wxMDIParentFrame, and wxMiniFrame.

virtual wxStatusBar* wxFrame::CreateStatusBar ( int  number = 1,
long  style = wxSTB_DEFAULT_STYLE,
wxWindowID  id = 0,
const wxString name = wxStatusBarNameStr 
) [virtual]

Creates a status bar at the bottom of the frame.

Parameters:
numberThe number of fields to create. Specify a value greater than 1 to create a multi-field status bar.
styleThe status bar style. See wxStatusBar for a list of valid styles.
idThe status bar window identifier. If -1, an identifier will be chosen by wxWidgets.
nameThe status bar window name.
Returns:
A pointer to the status bar if it was created successfully, NULL otherwise.
注意:
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.
参照:
SetStatusText(), OnCreateStatusBar(), GetStatusBar()
virtual wxToolBar* wxFrame::CreateToolBar ( long  style = wxBORDER_NONE|wxTB_HORIZONTAL,
wxWindowID  id = wxID_ANY,
const wxString name = wxToolBarNameStr 
) [virtual]

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

Parameters:
styleThe toolbar style. See wxToolBar for a list of valid styles.
idThe toolbar window identifier. If -1, an identifier will be chosen by wxWidgets.
nameThe toolbar window name.
Returns:
A pointer to the toolbar if it was created successfully, NULL otherwise.
注意:
By default, the toolbar is an instance of wxToolBar. To use a different class, override OnCreateToolBar(). When a toolbar has been created with this function, or made known to the frame with wxFrame::SetToolBar(), the frame will manage the toolbar position and adjust the return value from wxWindow::GetClientSize() to reflect the available space for application windows. Under Pocket PC, you should 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.
参照:
CreateStatusBar(), OnCreateToolBar(), SetToolBar(), GetToolBar()
virtual wxPoint wxFrame::GetClientAreaOrigin ( ) const [virtual]

Returns the origin of the frame client area (in client coordinates).

It may be different from (0, 0) if the frame has a toolbar.

Reimplemented from wxWindow.

virtual wxMenuBar* wxFrame::GetMenuBar ( ) const [virtual]

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

参照:
SetMenuBar(), wxMenuBar, wxMenu
virtual wxStatusBar* wxFrame::GetStatusBar ( ) const [virtual]

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

参照:
CreateStatusBar(), wxStatusBar
int wxFrame::GetStatusBarPane ( ) const

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

参照:
SetStatusBarPane()
virtual wxToolBar* wxFrame::GetToolBar ( ) const [virtual]

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

参照:
CreateToolBar(), wxToolBar, SetToolBar()
virtual wxStatusBar* wxFrame::OnCreateStatusBar ( int  number,
long  style,
wxWindowID  id,
const wxString name 
) [virtual]

Virtual function called when a status bar is requested by CreateStatusBar().

Parameters:
numberThe number of fields to create.
styleThe window style. See wxStatusBar for a list of valid styles.
idThe window identifier. If -1, an identifier will be chosen by wxWidgets.
nameThe window name.
Returns:
A status bar object.
注意:
An application can override this function to return a different kind of status bar. The default implementation returns an instance of wxStatusBar.
参照:
CreateStatusBar(), wxStatusBar.
virtual wxToolBar* wxFrame::OnCreateToolBar ( long  style,
wxWindowID  id,
const wxString name 
) [virtual]

Virtual function called when a toolbar is requested by CreateToolBar().

Parameters:
styleThe toolbar style. See wxToolBar for a list of valid styles.
idThe toolbar window identifier. If -1, an identifier will be chosen by wxWidgets.
nameThe toolbar window name.
Returns:
A toolbar object.
注意:
An application can override this function to return a different kind of toolbar. The default implementation returns an instance of wxToolBar.
参照:
CreateToolBar(), wxToolBar.
void wxFrame::PopStatusText ( int  number = 0)
bool wxFrame::ProcessCommand ( int  id)

Simulate a menu command.

Parameters:
idThe identifier for a menu item.
void wxFrame::PushStatusText ( const wxString text,
int  number = 0 
)
virtual void wxFrame::SetMenuBar ( wxMenuBar menuBar) [virtual]

Tells the frame to show the given menu bar.

Parameters:
menuBarThe menu bar to associate with the frame.
注意:
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 SetMenuBar(). Note that on some platforms, it is not possible to call this function twice for the same frame object.
参照:
GetMenuBar(), wxMenuBar, wxMenu.
virtual void wxFrame::SetStatusBar ( wxStatusBar statusBar) [virtual]

Associates a status bar with the frame.

If statusBar is NULL, then the status bar, if present, is detached from the frame, but not deleted.

参照:
CreateStatusBar(), wxStatusBar, GetStatusBar()
void wxFrame::SetStatusBarPane ( int  n)

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

Using -1 disables help display.

virtual void wxFrame::SetStatusText ( const wxString text,
int  number = 0 
) [virtual]

Sets the status bar text and redraws the status bar.

Parameters:
textThe text for the status field.
numberThe status field (starting from zero).
注意:
Use an empty string to clear the status bar.
参照:
CreateStatusBar(), wxStatusBar
virtual void wxFrame::SetStatusWidths ( int  n,
const int *  widths_field 
) [virtual]

Sets the widths of the fields in the status bar.

Parameters:
nThe number of fields in the status bar. It must be the same used in CreateStatusBar.
widths_fieldMust 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().
注意:
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.

wxPerl Note: In wxPerl this method takes the field widths as parameters.

virtual void wxFrame::SetToolBar ( wxToolBar toolBar) [virtual]

Associates a toolbar with the frame.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines