]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/panel.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPanel
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 A panel is a window on which controls are placed. It is usually placed within
13 a frame. Its main feature over its parent class wxWindow is code for handling
14 child windows and TAB traversal. Since wxWidgets 2.9, there is support both
15 for TAB traversal implemented by wxWidgets itself as well as native TAB
16 traversal (such as for GTK 2.0).
18 @note Tab traversal is implemented through an otherwise undocumented
19 intermediate wxControlContainer class from which any class can derive
20 in addition to the normal wxWindow base class. Please see @c wx/containr.h
21 and @c wx/panel.h to find out how this is achieved.
23 @note if not all characters are being intercepted by your OnKeyDown or
24 OnChar handler, it may be because you are using the @c wxTAB_TRAVERSAL style,
25 which grabs some keypresses for use by child controls.
27 @remarks By default, a panel has the same colouring as a dialog.
34 class wxPanel
: public wxWindow
49 An identifier for the panel. @c wxID_ANY is taken to mean a default.
51 The panel position. The value @c wxDefaultPosition indicates a default position,
52 chosen by either the windowing system or wxWidgets, depending on platform.
54 The panel size. The value @c wxDefaultSize indicates a default size, chosen by
55 either the windowing system or wxWidgets, depending on platform.
57 The window style. See wxPanel.
63 wxPanel(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
64 const wxPoint
& pos
= wxDefaultPosition
,
65 const wxSize
& size
= wxDefaultSize
,
66 long style
= wxTAB_TRAVERSAL
,
67 const wxString
& name
= "panel");
70 Destructor. Deletes any child windows before deleting the physical window.
75 This method is overridden from wxWindow::AcceptsFocus()
76 and returns @true only if there is no child window in the panel which
77 can accept the focus. This is reevaluated each time a child
78 window is added or removed from the panel.
80 bool AcceptsFocus() const;
83 Used for two-step panel construction. See wxPanel() for details.
85 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
88 long style
= wxTAB_TRAVERSAL
,
89 const wxString
& name
= wxPanelNameStr
);
92 Sends a wxInitDialogEvent, which in turn transfers data to the dialog via
95 @see wxInitDialogEvent
97 virtual void InitDialog();
100 The default handler for wxEVT_SYS_COLOUR_CHANGED.
103 The colour change event.
105 @remarks Changes the panel's colour to conform to the current settings
106 (Windows only). Add an event table entry for your panel
107 class if you wish the behaviour to be different (such
108 as keeping a user-defined background colour). If you do
109 override this function, call wxEvent::Skip() to propagate
110 the notification to child windows and controls.
112 @see wxSysColourChangedEvent
114 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
117 Overrides wxWindow::SetFocus().
119 This method uses the (undocumented) mix-in class wxControlContainer which manages
120 the focus and TAB logic for controls which usually have child controls.
122 In practice, if you call this method and the control has at least
123 one child window, the focus will be given to the child window.
125 @see wxFocusEvent, wxWindow::SetFocus()
127 virtual void SetFocus();
130 In contrast to SetFocus() (see above) this will set the focus to the panel
131 even if there are child windows in the panel. This is only rarely needed.
133 void SetFocusIgnoringChildren();