]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/panel.h
Implement setFont on the iOS port of wxStaticText.
[wxWidgets.git] / interface / wx / panel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: panel.h
3 // Purpose: interface of wxPanel
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxPanel
10
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).
16
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.
21
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.
25
26 @remarks By default, a panel has the same colouring as a dialog.
27
28 @beginEventEmissionTable{wxNavigationKeyEvent}
29 @event{EVT_NAVIGATION_KEY(func)}
30 Process a navigation key event.
31 @endEventTable
32
33 @library{wxcore}
34 @category{miscwnd}
35
36 @see wxDialog
37 */
38 class wxPanel : public wxWindow
39 {
40 public:
41
42 /**
43 Default constructor.
44 */
45 wxPanel();
46
47 /**
48 Constructor.
49
50 @param parent
51 The parent window.
52 @param id
53 An identifier for the panel. @c wxID_ANY is taken to mean a default.
54 @param pos
55 The panel position. The value ::wxDefaultPosition indicates a default position,
56 chosen by either the windowing system or wxWidgets, depending on platform.
57 @param size
58 The panel size. The value ::wxDefaultSize indicates a default size, chosen by
59 either the windowing system or wxWidgets, depending on platform.
60 @param style
61 The window style. See wxPanel.
62 @param name
63 Window name.
64
65 @see Create()
66 */
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);
72
73 /**
74 Destructor. Deletes any child windows before deleting the physical window.
75 */
76 virtual ~wxPanel();
77
78 /**
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.
83 */
84 bool AcceptsFocus() const;
85
86 /**
87 Used for two-step panel construction. See wxPanel() for details.
88 */
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);
94
95 /**
96 Sends a wxInitDialogEvent, which in turn transfers data to the dialog via
97 validators.
98
99 @see wxInitDialogEvent
100 */
101 virtual void InitDialog();
102
103 /**
104 See wxWindow::SetAutoLayout(): when auto layout is on, this function gets
105 called automatically when the window is resized.
106 */
107 virtual bool Layout();
108
109 /**
110 The default handler for @c wxEVT_SYS_COLOUR_CHANGED.
111
112 @param event
113 The colour change event.
114
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.
121
122 @see wxSysColourChangedEvent
123 */
124 void OnSysColourChanged(wxSysColourChangedEvent& event);
125
126 /**
127 Overrides wxWindow::SetFocus().
128
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.
131
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.
134
135 @see wxFocusEvent, wxWindow::SetFocus()
136 */
137 virtual void SetFocus();
138
139 /**
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.
142 */
143 void SetFocusIgnoringChildren();
144 };
145