]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/panel.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPanel
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 A panel is a window on which controls are placed. It is usually placed within
12 a frame. Its main feature over its parent class wxWindow is code for handling
13 child windows and TAB traversal. Since wxWidgets 2.9, there is support both
14 for TAB traversal implemented by wxWidgets itself as well as native TAB
15 traversal (such as for GTK 2.0).
17 @note Tab traversal is implemented through an otherwise undocumented
18 intermediate wxControlContainer class from which any class can derive
19 in addition to the normal wxWindow base class. Please see @c wx/containr.h
20 and @c wx/panel.h to find out how this is achieved.
22 @note if not all characters are being intercepted by your OnKeyDown or
23 OnChar handler, it may be because you are using the @c wxTAB_TRAVERSAL style,
24 which grabs some keypresses for use by child controls.
26 @remarks By default, a panel has the same colouring as a dialog.
28 @beginEventEmissionTable{wxNavigationKeyEvent}
29 @event{EVT_NAVIGATION_KEY(func)}
30 Process a navigation key event.
38 class wxPanel
: public wxWindow
53 An identifier for the panel. @c wxID_ANY is taken to mean a default.
55 The panel position. The value ::wxDefaultPosition indicates a default position,
56 chosen by either the windowing system or wxWidgets, depending on platform.
58 The panel size. The value ::wxDefaultSize indicates a default size, chosen by
59 either the windowing system or wxWidgets, depending on platform.
61 The window style. See wxPanel.
67 wxPanel(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
68 const wxPoint
& pos
= wxDefaultPosition
,
69 const wxSize
& size
= wxDefaultSize
,
70 long style
= wxTAB_TRAVERSAL
,
71 const wxString
& name
= wxPanelNameStr
);
74 Destructor. Deletes any child windows before deleting the physical window.
79 This method is overridden from wxWindow::AcceptsFocus()
80 and returns @true only if there is no child window in the panel which
81 can accept the focus. This is reevaluated each time a child
82 window is added or removed from the panel.
84 bool AcceptsFocus() const;
87 Used for two-step panel construction. See wxPanel() for details.
89 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
90 const wxPoint
& pos
= wxDefaultPosition
,
91 const wxSize
& size
= wxDefaultSize
,
92 long style
= wxTAB_TRAVERSAL
,
93 const wxString
& name
= wxPanelNameStr
);
96 Sends a wxInitDialogEvent, which in turn transfers data to the dialog via
99 @see wxInitDialogEvent
101 virtual void InitDialog();
104 See wxWindow::SetAutoLayout(): when auto layout is on, this function gets
105 called automatically when the window is resized.
107 virtual bool Layout();
110 The default handler for @c wxEVT_SYS_COLOUR_CHANGED.
113 The colour change event.
115 @remarks Changes the panel's colour to conform to the current settings
116 (Windows only). Add an event table entry for your panel
117 class if you wish the behaviour to be different (such
118 as keeping a user-defined background colour). If you do
119 override this function, call wxEvent::Skip() to propagate
120 the notification to child windows and controls.
122 @see wxSysColourChangedEvent
124 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
127 Overrides wxWindow::SetFocus().
129 This method uses the (undocumented) mix-in class wxControlContainer which manages
130 the focus and TAB logic for controls which usually have child controls.
132 In practice, if you call this method and the control has at least
133 one child window, the focus will be given to the child window.
135 @see wxFocusEvent, wxWindow::SetFocus()
137 virtual void SetFocus();
140 In contrast to SetFocus() (see above) this will set the focus to the panel
141 even if there are child windows in the panel. This is only rarely needed.
143 void SetFocusIgnoringChildren();