1 \section{\class{wxPanel
}}\label{wxpanel
}
3 A panel is a window on which controls are placed. It is usually placed within
4 a frame. Its main feature over its parent class wxWindow is code for handling
5 child windows and TAB traversal. Since wxWidgets
2.9, there is support both
6 for TAB traversal implemented by wxWidgets itself as well as native TAB
7 traversal (such as for GTK
2.0).
9 {\it Note:
} Tab traversal is implemented through an otherwise undocumented
10 intermediate wxControlContainer class from which any class can derive
11 in addition to the normal wxWindow base class. Please see <wx/containr.h>
12 and <wx/panel.h> to find out how this is achieved.
14 {\it Note:
} if not all characters are being intercepted by your OnKeyDown or
15 OnChar handler, it may be because you are using the wxTAB
\_TRAVERSAL style,
16 which grabs some keypresses for use by child controls.
18 \wxheading{Derived from
}
20 \helpref{wxWindow
}{wxwindow
}\\
21 \helpref{wxEvtHandler
}{wxevthandler
}\\
22 \helpref{wxObject
}{wxobject
}
24 \wxheading{Include files
}
28 \wxheading{Window styles
}
30 There are no specific styles for this window.
32 See also
\helpref{window styles overview
}{windowstyles
}.
36 By default, a panel has the same colouring as a dialog.
40 \helpref{wxDialog
}{wxdialog
}
42 \latexignore{\rtfignore{\wxheading{Members
}}}
44 \membersection{wxPanel::wxPanel
}\label{wxpanelctor
}
46 \func{}{wxPanel
}{\void}
50 \func{}{wxPanel
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id =
\texttt{wxID
\_ANY}},
\rtfsp
51 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
52 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
53 \param{long
}{ style = wxTAB
\_TRAVERSAL},
\rtfsp
54 \param{const wxString\&
}{name = ``panel"
}}
58 \wxheading{Parameters
}
60 \docparam{parent
}{The parent window.
}
62 \docparam{id
}{An identifier for the panel. A value of -
1 is taken to mean a default.
}
64 \docparam{pos
}{The panel position. A value of (-
1, -
1) indicates a default position, chosen by
65 either the windowing system or wxWidgets, depending on platform.
}
67 \docparam{size
}{The panel size. A value of (-
1, -
1) indicates a default size, chosen by
68 either the windowing system or wxWidgets, depending on platform.
}
70 \docparam{style
}{The window style. See
\helpref{wxPanel
}{wxpanel
}.
}
72 \docparam{name
}{Used to associate a name with the window,
73 allowing the application user to set Motif resource values for
74 individual dialog boxes.
}
78 \helpref{wxPanel::Create
}{wxpanelcreate
}
80 \membersection{wxPanel::
\destruct{wxPanel
}}\label{wxpaneldtor
}
82 \func{}{\destruct{wxPanel
}}{\void}
84 Destructor. Deletes any child windows before deleting the physical window.
86 \membersection{wxPanel::Create
}\label{wxpanelcreate
}
88 \func{bool
}{Create
}{\param{wxWindow*
}{parent
},
\param{wxWindowID
}{id =
\texttt{wxID
\_ANY}},
\rtfsp
89 \param{const wxPoint\&
}{pos = wxDefaultPosition
},
\rtfsp
90 \param{const wxSize\&
}{size = wxDefaultSize
},
\rtfsp
91 \param{long
}{ style = wxTAB
\_TRAVERSAL},
\rtfsp
92 \param{const wxString\&
}{name = ``panel"
}}
94 Used for two-step panel construction. See
\helpref{wxPanel::wxPanel
}{wxpanelctor
}\rtfsp
98 \membersection{wxPanel::AcceptsFocus
}\label{wxpanelacceptsfocus
}
100 \constfunc{bool
}{AcceptsFocus
}{\void}
102 This method is overridden from
\helpref{wxWindow::AcceptsFocus
}{wxwindowacceptsfocus
}
103 and returns true only if there is no child window in the panel which
104 can accept the focus. This is reevaluated each time a child
105 window is added or removed from the panel.
108 \membersection{wxPanel::InitDialog
}\label{wxpanelinitdialog
}
110 \func{void
}{InitDialog
}{\void}
112 Sends a
\helpref{wxInitDialogEvent
}{wxinitdialogevent
}, which
113 in turn transfers data to the dialog via validators.
117 \helpref{wxInitDialogEvent
}{wxinitdialogevent
}
119 \membersection{wxPanel::OnSysColourChanged
}\label{wxpanelonsyscolourchanged
}
121 \func{void
}{OnSysColourChanged
}{\param{wxSysColourChangedEvent\&
}{event
}}
123 The default handler for wxEVT
\_SYS\_COLOUR\_CHANGED.
125 \wxheading{Parameters
}
127 \docparam{event
}{The colour change event.
}
131 Changes the panel's colour to conform to the current settings (Windows only).
132 Add an event table entry for your panel class if you wish the behaviour
133 to be different (such as keeping a user-defined
134 background colour). If you do override this function, call wxEvent::Skip to
135 propagate the notification to child windows and controls.
139 \helpref{wxSysColourChangedEvent
}{wxsyscolourchangedevent
}
142 \membersection{wxPanel::SetFocus
}\label{wxpanelsetfocus
}
144 \func{virtual void
}{SetFocus
}{\void}
146 Overrides
\helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}. This method
147 uses the (undocumented) mix-in class wxControlContainer which manages
148 the focus and TAB logic for controls which usually have child controls.
149 In practice, if you call this method and the control has at least
150 one child window, the focus will be given to the child window.
154 \helpref{wxFocusEvent
}{wxfocusevent
}
155 \helpref{wxWindow::SetFocus
}{wxwindowsetfocus
}
158 \membersection{wxPanel::SetFocusIgnoringChildren
}\label{wxpanelsetfocusignoringchildren
}
160 \func{virtual void
}{SetFocusIgnoringChildren
}{\void}
162 In contrast to
\helpref{wxPanel::SetFocus
}{wxpanelsetfocus
} (see above)
163 this will set the focus to the panel even of there are child windows
164 in the panel. This is only rarely needed.
168 \helpref{wxFocusEvent
}{wxfocusevent
}
169 \helpref{wxPanel::SetFocus
}{wxpanelsetfocus
}