]> git.saurik.com Git - wxWidgets.git/blob - interface/panel.h
Switch on build breakage email notifications.
[wxWidgets.git] / interface / panel.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: panel.h
3 // Purpose: interface of wxPanel
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxPanel
11 @wxheader{panel.h}
12
13 A panel is a window on which controls are placed. It is usually placed within
14 a frame. Its main feature over its parent class wxWindow is code for handling
15 child windows and TAB traversal. Since wxWidgets 2.9, there is support both
16 for TAB traversal implemented by wxWidgets itself as well as native TAB
17 traversal (such as for GTK 2.0).
18
19 @e Note: Tab traversal is implemented through an otherwise undocumented
20 intermediate wxControlContainer class from which any class can derive
21 in addition to the normal wxWindow base class. Please see wx/containr.h
22 and wx/panel.h to find out how this is achieved.
23
24 @e Note: if not all characters are being intercepted by your OnKeyDown or
25 OnChar handler, it may be because you are using the wxTAB_TRAVERSAL style,
26 which grabs some keypresses for use by child controls.
27
28 @library{wxbase}
29 @category{miscwnd}
30
31 @see wxDialog
32 */
33 class wxPanel : public wxWindow
34 {
35 public:
36 //@{
37 /**
38 Constructor.
39
40 @param parent
41 The parent window.
42 @param id
43 An identifier for the panel. A value of -1 is taken to mean a default.
44 @param pos
45 The panel position. The value wxDefaultPosition indicates a default position,
46 chosen by
47 either the windowing system or wxWidgets, depending on platform.
48 @param size
49 The panel size. The value wxDefaultSize indicates a default size, chosen by
50 either the windowing system or wxWidgets, depending on platform.
51 @param style
52 The window style. See wxPanel.
53 @param name
54 Used to associate a name with the window,
55 allowing the application user to set Motif resource values for
56 individual dialog boxes.
57
58 @see Create()
59 */
60 wxPanel();
61 wxPanel(wxWindow* parent, wxWindowID id = wxID_ANY,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
64 long style = wxTAB_TRAVERSAL,
65 const wxString& name = "panel");
66 //@}
67
68 /**
69 Destructor. Deletes any child windows before deleting the physical window.
70 */
71 ~wxPanel();
72
73 /**
74 This method is overridden from wxWindow::AcceptsFocus
75 and returns @true only if there is no child window in the panel which
76 can accept the focus. This is reevaluated each time a child
77 window is added or removed from the panel.
78 */
79 bool AcceptsFocus() const;
80
81 /**
82 Used for two-step panel construction. See wxPanel()
83 for details.
84 */
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 = "panel");
90
91 /**
92 Sends a wxInitDialogEvent, which
93 in turn transfers data to the dialog via validators.
94
95 @see wxInitDialogEvent
96 */
97 void InitDialog();
98
99 /**
100 The default handler for wxEVT_SYS_COLOUR_CHANGED.
101
102 @param event
103 The colour change event.
104
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.
111
112 @see wxSysColourChangedEvent
113 */
114 void OnSysColourChanged(wxSysColourChangedEvent& event);
115
116 /**
117 Overrides wxWindow::SetFocus. This method
118 uses the (undocumented) mix-in class wxControlContainer which manages
119 the focus and TAB logic for controls which usually have child controls.
120 In practice, if you call this method and the control has at least
121 one child window, the focus will be given to the child window.
122
123 @see wxFocusEvent, wxWindow::SetFocus
124 */
125 virtual void SetFocus();
126
127 /**
128 In contrast to SetFocus() (see above)
129 this will set the focus to the panel even if there are child windows
130 in the panel. This is only rarely needed.
131 */
132 virtual void SetFocusIgnoringChildren();
133 };
134