]>
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 | |
11 | @wxheader{panel.h} | |
7c913512 | 12 | |
23324ae1 FM |
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). | |
7c913512 | 18 | |
4d7b68d1 FM |
19 | @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 @c wx/containr.h | |
22 | and @c wx/panel.h to find out how this is achieved. | |
7c913512 | 23 | |
4d7b68d1 FM |
24 | @note if not all characters are being intercepted by your OnKeyDown or |
25 | OnChar handler, it may be because you are using the @c wxTAB_TRAVERSAL style, | |
26 | which grabs some keypresses for use by child controls. | |
27 | ||
28 | @remarks By default, a panel has the same colouring as a dialog. | |
7c913512 | 29 | |
23324ae1 FM |
30 | @library{wxbase} |
31 | @category{miscwnd} | |
7c913512 | 32 | |
e54c96f1 | 33 | @see wxDialog |
23324ae1 FM |
34 | */ |
35 | class wxPanel : public wxWindow | |
36 | { | |
37 | public: | |
74bf4e64 FM |
38 | |
39 | /** | |
40 | Default constructor. | |
41 | */ | |
42 | wxPanel(); | |
4d7b68d1 | 43 | |
23324ae1 FM |
44 | /** |
45 | Constructor. | |
3c4f71cc | 46 | |
7c913512 | 47 | @param parent |
4cc4bfaf | 48 | The parent window. |
7c913512 | 49 | @param id |
74bf4e64 | 50 | An identifier for the panel. @c wxID_ANY is taken to mean a default. |
7c913512 | 51 | @param pos |
74bf4e64 | 52 | The panel position. The value @c wxDefaultPosition indicates a default position, |
4d7b68d1 | 53 | chosen by either the windowing system or wxWidgets, depending on platform. |
7c913512 | 54 | @param size |
74bf4e64 | 55 | The panel size. The value @c wxDefaultSize indicates a default size, chosen by |
4cc4bfaf | 56 | either the windowing system or wxWidgets, depending on platform. |
7c913512 | 57 | @param style |
4cc4bfaf | 58 | The window style. See wxPanel. |
7c913512 | 59 | @param name |
4d7b68d1 | 60 | Window name. |
3c4f71cc | 61 | |
4cc4bfaf | 62 | @see Create() |
23324ae1 | 63 | */ |
7c913512 FM |
64 | wxPanel(wxWindow* parent, wxWindowID id = wxID_ANY, |
65 | const wxPoint& pos = wxDefaultPosition, | |
66 | const wxSize& size = wxDefaultSize, | |
67 | long style = wxTAB_TRAVERSAL, | |
68 | const wxString& name = "panel"); | |
23324ae1 FM |
69 | |
70 | /** | |
71 | Destructor. Deletes any child windows before deleting the physical window. | |
72 | */ | |
73 | ~wxPanel(); | |
74 | ||
75 | /** | |
74bf4e64 | 76 | This method is overridden from wxWindow::AcceptsFocus() |
23324ae1 FM |
77 | and returns @true only if there is no child window in the panel which |
78 | can accept the focus. This is reevaluated each time a child | |
79 | window is added or removed from the panel. | |
80 | */ | |
328f5751 | 81 | bool AcceptsFocus() const; |
23324ae1 FM |
82 | |
83 | /** | |
74bf4e64 | 84 | Used for two-step panel construction. See wxPanel() for details. |
23324ae1 FM |
85 | */ |
86 | bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, | |
87 | const wxPoint& pos = wxDefaultPosition, | |
88 | const wxSize& size = wxDefaultSize, | |
89 | long style = wxTAB_TRAVERSAL, | |
90 | const wxString& name = "panel"); | |
91 | ||
92 | /** | |
74bf4e64 FM |
93 | Sends a wxInitDialogEvent, which in turn transfers data to the dialog via |
94 | validators. | |
3c4f71cc | 95 | |
4cc4bfaf | 96 | @see wxInitDialogEvent |
23324ae1 FM |
97 | */ |
98 | void InitDialog(); | |
99 | ||
100 | /** | |
101 | The default handler for wxEVT_SYS_COLOUR_CHANGED. | |
3c4f71cc | 102 | |
7c913512 | 103 | @param event |
4cc4bfaf | 104 | The colour change event. |
3c4f71cc | 105 | |
23324ae1 | 106 | @remarks Changes the panel's colour to conform to the current settings |
4cc4bfaf FM |
107 | (Windows only). Add an event table entry for your panel |
108 | class if you wish the behaviour to be different (such | |
109 | as keeping a user-defined background colour). If you do | |
74bf4e64 | 110 | override this function, call wxEvent::Skip() to propagate |
4cc4bfaf | 111 | the notification to child windows and controls. |
3c4f71cc | 112 | |
4cc4bfaf | 113 | @see wxSysColourChangedEvent |
23324ae1 FM |
114 | */ |
115 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
116 | ||
117 | /** | |
4d7b68d1 FM |
118 | Overrides wxWindow::SetFocus(). |
119 | ||
120 | This method uses the (undocumented) mix-in class wxControlContainer which manages | |
23324ae1 | 121 | the focus and TAB logic for controls which usually have child controls. |
4d7b68d1 | 122 | |
23324ae1 FM |
123 | In practice, if you call this method and the control has at least |
124 | one child window, the focus will be given to the child window. | |
3c4f71cc | 125 | |
74bf4e64 | 126 | @see wxFocusEvent, wxWindow::SetFocus() |
23324ae1 FM |
127 | */ |
128 | virtual void SetFocus(); | |
129 | ||
130 | /** | |
4d7b68d1 FM |
131 | In contrast to SetFocus() (see above) this will set the focus to the panel |
132 | even if there are child windows in the panel. This is only rarely needed. | |
23324ae1 FM |
133 | */ |
134 | virtual void SetFocusIgnoringChildren(); | |
135 | }; | |
e54c96f1 | 136 |