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