]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: panel.h | |
e54c96f1 | 3 | // Purpose: interface of wxPanel |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxPanel | |
7c913512 | 11 | |
23324ae1 FM |
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). | |
7c913512 | 17 | |
4d7b68d1 FM |
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. | |
7c913512 | 22 | |
4d7b68d1 FM |
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. | |
26 | ||
27 | @remarks By default, a panel has the same colouring as a dialog. | |
7c913512 | 28 | |
23324ae1 FM |
29 | @library{wxbase} |
30 | @category{miscwnd} | |
7c913512 | 31 | |
e54c96f1 | 32 | @see wxDialog |
23324ae1 FM |
33 | */ |
34 | class wxPanel : public wxWindow | |
35 | { | |
36 | public: | |
74bf4e64 FM |
37 | |
38 | /** | |
39 | Default constructor. | |
40 | */ | |
41 | wxPanel(); | |
4d7b68d1 | 42 | |
23324ae1 FM |
43 | /** |
44 | Constructor. | |
3c4f71cc | 45 | |
7c913512 | 46 | @param parent |
4cc4bfaf | 47 | The parent window. |
7c913512 | 48 | @param id |
74bf4e64 | 49 | An identifier for the panel. @c wxID_ANY is taken to mean a default. |
7c913512 | 50 | @param pos |
74bf4e64 | 51 | The panel position. The value @c wxDefaultPosition indicates a default position, |
4d7b68d1 | 52 | chosen by either the windowing system or wxWidgets, depending on platform. |
7c913512 | 53 | @param size |
74bf4e64 | 54 | The panel size. The value @c wxDefaultSize indicates a default size, chosen by |
4cc4bfaf | 55 | either the windowing system or wxWidgets, depending on platform. |
7c913512 | 56 | @param style |
4cc4bfaf | 57 | The window style. See wxPanel. |
7c913512 | 58 | @param name |
4d7b68d1 | 59 | Window name. |
3c4f71cc | 60 | |
4cc4bfaf | 61 | @see Create() |
23324ae1 | 62 | */ |
7c913512 FM |
63 | wxPanel(wxWindow* parent, wxWindowID id = wxID_ANY, |
64 | const wxPoint& pos = wxDefaultPosition, | |
65 | const wxSize& size = wxDefaultSize, | |
66 | long style = wxTAB_TRAVERSAL, | |
0a98423e | 67 | const wxString& name = wxPanelNameStr); |
23324ae1 FM |
68 | |
69 | /** | |
70 | Destructor. Deletes any child windows before deleting the physical window. | |
71 | */ | |
adaaa686 | 72 | virtual ~wxPanel(); |
23324ae1 FM |
73 | |
74 | /** | |
74bf4e64 | 75 | This method is overridden from wxWindow::AcceptsFocus() |
23324ae1 FM |
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. | |
79 | */ | |
328f5751 | 80 | bool AcceptsFocus() const; |
23324ae1 FM |
81 | |
82 | /** | |
74bf4e64 | 83 | Used for two-step panel construction. See wxPanel() for details. |
23324ae1 FM |
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, | |
43c48e1e | 89 | const wxString& name = wxPanelNameStr); |
23324ae1 FM |
90 | |
91 | /** | |
74bf4e64 FM |
92 | Sends a wxInitDialogEvent, which in turn transfers data to the dialog via |
93 | validators. | |
3c4f71cc | 94 | |
4cc4bfaf | 95 | @see wxInitDialogEvent |
23324ae1 | 96 | */ |
adaaa686 | 97 | virtual void InitDialog(); |
23324ae1 | 98 | |
dcc5fcbf FM |
99 | /** |
100 | See wxWindow::SetAutoLayout(): when auto layout is on, this function gets | |
101 | called automatically when the window is resized. | |
102 | */ | |
103 | virtual bool Layout(); | |
104 | ||
23324ae1 FM |
105 | /** |
106 | The default handler for wxEVT_SYS_COLOUR_CHANGED. | |
3c4f71cc | 107 | |
7c913512 | 108 | @param event |
4cc4bfaf | 109 | The colour change event. |
3c4f71cc | 110 | |
23324ae1 | 111 | @remarks Changes the panel's colour to conform to the current settings |
4cc4bfaf FM |
112 | (Windows only). Add an event table entry for your panel |
113 | class if you wish the behaviour to be different (such | |
114 | as keeping a user-defined background colour). If you do | |
74bf4e64 | 115 | override this function, call wxEvent::Skip() to propagate |
4cc4bfaf | 116 | the notification to child windows and controls. |
3c4f71cc | 117 | |
4cc4bfaf | 118 | @see wxSysColourChangedEvent |
23324ae1 FM |
119 | */ |
120 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
121 | ||
122 | /** | |
4d7b68d1 FM |
123 | Overrides wxWindow::SetFocus(). |
124 | ||
125 | This method uses the (undocumented) mix-in class wxControlContainer which manages | |
23324ae1 | 126 | the focus and TAB logic for controls which usually have child controls. |
4d7b68d1 | 127 | |
23324ae1 FM |
128 | In practice, if you call this method and the control has at least |
129 | one child window, the focus will be given to the child window. | |
3c4f71cc | 130 | |
74bf4e64 | 131 | @see wxFocusEvent, wxWindow::SetFocus() |
23324ae1 FM |
132 | */ |
133 | virtual void SetFocus(); | |
134 | ||
135 | /** | |
4d7b68d1 FM |
136 | In contrast to SetFocus() (see above) this will set the focus to the panel |
137 | even if there are child windows in the panel. This is only rarely needed. | |
23324ae1 | 138 | */ |
adaaa686 | 139 | void SetFocusIgnoringChildren(); |
23324ae1 | 140 | }; |
e54c96f1 | 141 |