Version: 2.9.4
Public Member Functions
wxPanel Class Reference

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

Inheritance diagram for wxPanel:

Detailed Description

A panel is a window on which controls are placed.

It is usually placed within a frame. Its main feature over its parent class wxWindow is code for handling child windows and TAB traversal. Since wxWidgets 2.9, there is support both for TAB traversal implemented by wxWidgets itself as well as native TAB traversal (such as for GTK 2.0).

注:
Tab traversal is implemented through an otherwise undocumented intermediate wxControlContainer class from which any class can derive in addition to the normal wxWindow base class. Please see wx/containr.h and wx/panel.h to find out how this is achieved.
if not all characters are being intercepted by your OnKeyDown or OnChar handler, it may be because you are using the wxTAB_TRAVERSAL style, which grabs some keypresses for use by child controls.
注意:
By default, a panel has the same colouring as a dialog.

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxNavigationKeyEvent& event)

Event macros for events emitted by this class:

Library:  wxBase
Category:  Miscellaneous Windows
参照:
wxDialog

Public Member Functions

 wxPanel ()
 Default constructor.
 wxPanel (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr)
 Constructor.
virtual ~wxPanel ()
 Destructor.
bool AcceptsFocus () const
 This method is overridden from wxWindow::AcceptsFocus() and returns true only if there is no child window in the panel which can accept the focus.
bool Create (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxPanelNameStr)
 Used for two-step panel construction.
virtual void InitDialog ()
 Sends a wxInitDialogEvent, which in turn transfers data to the dialog via validators.
virtual bool Layout ()
 See wxWindow::SetAutoLayout(): when auto layout is on, this function gets called automatically when the window is resized.
void OnSysColourChanged (wxSysColourChangedEvent &event)
 The default handler for wxEVT_SYS_COLOUR_CHANGED.
virtual void SetFocus ()
 Overrides wxWindow::SetFocus().
void SetFocusIgnoringChildren ()
 In contrast to SetFocus() (see above) this will set the focus to the panel even if there are child windows in the panel.

List of all members.


Constructor & Destructor Documentation

wxPanel::wxPanel ( )

Default constructor.

wxPanel::wxPanel ( wxWindow parent,
wxWindowID  id = wxID_ANY,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL,
const wxString name = wxPanelNameStr 
)

Constructor.

Parameters:
parentThe parent window.
idAn identifier for the panel. wxID_ANY is taken to mean a default.
posThe panel position. The value wxDefaultPosition indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform.
sizeThe panel size. The value wxDefaultSize indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform.
styleThe window style. See wxPanel.
nameWindow name.
参照:
Create()
virtual wxPanel::~wxPanel ( ) [virtual]

Destructor.

Deletes any child windows before deleting the physical window.


Member Function Documentation

bool wxPanel::AcceptsFocus ( ) const [virtual]

This method is overridden from wxWindow::AcceptsFocus() and returns true only if there is no child window in the panel which can accept the focus.

This is reevaluated each time a child window is added or removed from the panel.

Reimplemented from wxWindow.

bool wxPanel::Create ( wxWindow parent,
wxWindowID  id = wxID_ANY,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL,
const wxString name = wxPanelNameStr 
)

Used for two-step panel construction.

See wxPanel() for details.

Reimplemented from wxWindow.

Reimplemented in wxHtmlListBox, wxPropertyGridManager, wxVListBox, wxVScrolledWindow, wxHScrolledWindow, and wxHVScrolledWindow.

virtual void wxPanel::InitDialog ( ) [virtual]

Sends a wxInitDialogEvent, which in turn transfers data to the dialog via validators.

参照:
wxInitDialogEvent

Reimplemented from wxWindow.

virtual bool wxPanel::Layout ( ) [virtual]

See wxWindow::SetAutoLayout(): when auto layout is on, this function gets called automatically when the window is resized.

Reimplemented from wxWindow.

void wxPanel::OnSysColourChanged ( wxSysColourChangedEvent event)

The default handler for wxEVT_SYS_COLOUR_CHANGED.

Parameters:
eventThe colour change event.
注意:
Changes the panel's colour to conform to the current settings (Windows only). Add an event table entry for your panel class if you wish the behaviour to be different (such as keeping a user-defined background colour). If you do override this function, call wxEvent::Skip() to propagate the notification to child windows and controls.
参照:
wxSysColourChangedEvent
virtual void wxPanel::SetFocus ( ) [virtual]

Overrides wxWindow::SetFocus().

This method uses the (undocumented) mix-in class wxControlContainer which manages the focus and TAB logic for controls which usually have child controls.

In practice, if you call this method and the control has at least one child window, the focus will be given to the child window.

参照:
wxFocusEvent, wxWindow::SetFocus()

Reimplemented from wxWindow.

void wxPanel::SetFocusIgnoringChildren ( )

In contrast to SetFocus() (see above) this will set the focus to the panel even if there are child windows in the panel.

This is only rarely needed.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines