]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: panel.h | |
e54c96f1 | 3 | // Purpose: interface of wxPanel |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxPanel | |
7c913512 | 10 | |
23324ae1 FM |
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). | |
7c913512 | 16 | |
4d7b68d1 FM |
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. | |
7c913512 | 21 | |
4d7b68d1 FM |
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. | |
7c913512 | 27 | |
3051a44a FM |
28 | @beginEventEmissionTable{wxNavigationKeyEvent} |
29 | @event{EVT_NAVIGATION_KEY(func)} | |
30 | Process a navigation key event. | |
31 | @endEventTable | |
32 | ||
a24b5254 | 33 | @library{wxcore} |
23324ae1 | 34 | @category{miscwnd} |
7c913512 | 35 | |
e54c96f1 | 36 | @see wxDialog |
23324ae1 FM |
37 | */ |
38 | class wxPanel : public wxWindow | |
39 | { | |
40 | public: | |
74bf4e64 FM |
41 | |
42 | /** | |
43 | Default constructor. | |
44 | */ | |
45 | wxPanel(); | |
4d7b68d1 | 46 | |
23324ae1 FM |
47 | /** |
48 | Constructor. | |
3c4f71cc | 49 | |
7c913512 | 50 | @param parent |
4cc4bfaf | 51 | The parent window. |
7c913512 | 52 | @param id |
74bf4e64 | 53 | An identifier for the panel. @c wxID_ANY is taken to mean a default. |
7c913512 | 54 | @param pos |
76e2b570 | 55 | The panel position. The value ::wxDefaultPosition indicates a default position, |
4d7b68d1 | 56 | chosen by either the windowing system or wxWidgets, depending on platform. |
7c913512 | 57 | @param size |
76e2b570 | 58 | The panel size. The value ::wxDefaultSize indicates a default size, chosen by |
4cc4bfaf | 59 | either the windowing system or wxWidgets, depending on platform. |
7c913512 | 60 | @param style |
4cc4bfaf | 61 | The window style. See wxPanel. |
7c913512 | 62 | @param name |
4d7b68d1 | 63 | Window name. |
3c4f71cc | 64 | |
4cc4bfaf | 65 | @see Create() |
23324ae1 | 66 | */ |
7c913512 FM |
67 | wxPanel(wxWindow* parent, wxWindowID id = wxID_ANY, |
68 | const wxPoint& pos = wxDefaultPosition, | |
69 | const wxSize& size = wxDefaultSize, | |
70 | long style = wxTAB_TRAVERSAL, | |
0a98423e | 71 | const wxString& name = wxPanelNameStr); |
23324ae1 FM |
72 | |
73 | /** | |
74 | Destructor. Deletes any child windows before deleting the physical window. | |
75 | */ | |
adaaa686 | 76 | virtual ~wxPanel(); |
23324ae1 FM |
77 | |
78 | /** | |
74bf4e64 | 79 | This method is overridden from wxWindow::AcceptsFocus() |
23324ae1 FM |
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 | */ | |
328f5751 | 84 | bool AcceptsFocus() const; |
23324ae1 FM |
85 | |
86 | /** | |
74bf4e64 | 87 | Used for two-step panel construction. See wxPanel() for details. |
23324ae1 FM |
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, | |
43c48e1e | 93 | const wxString& name = wxPanelNameStr); |
23324ae1 FM |
94 | |
95 | /** | |
74bf4e64 FM |
96 | Sends a wxInitDialogEvent, which in turn transfers data to the dialog via |
97 | validators. | |
3c4f71cc | 98 | |
4cc4bfaf | 99 | @see wxInitDialogEvent |
23324ae1 | 100 | */ |
adaaa686 | 101 | virtual void InitDialog(); |
23324ae1 | 102 | |
dcc5fcbf FM |
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 | ||
23324ae1 | 109 | /** |
3a194bda | 110 | The default handler for @c wxEVT_SYS_COLOUR_CHANGED. |
3c4f71cc | 111 | |
7c913512 | 112 | @param event |
4cc4bfaf | 113 | The colour change event. |
3c4f71cc | 114 | |
23324ae1 | 115 | @remarks Changes the panel's colour to conform to the current settings |
4cc4bfaf FM |
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 | |
74bf4e64 | 119 | override this function, call wxEvent::Skip() to propagate |
4cc4bfaf | 120 | the notification to child windows and controls. |
3c4f71cc | 121 | |
4cc4bfaf | 122 | @see wxSysColourChangedEvent |
23324ae1 FM |
123 | */ |
124 | void OnSysColourChanged(wxSysColourChangedEvent& event); | |
125 | ||
126 | /** | |
4d7b68d1 FM |
127 | Overrides wxWindow::SetFocus(). |
128 | ||
129 | This method uses the (undocumented) mix-in class wxControlContainer which manages | |
23324ae1 | 130 | the focus and TAB logic for controls which usually have child controls. |
4d7b68d1 | 131 | |
23324ae1 FM |
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. | |
3c4f71cc | 134 | |
74bf4e64 | 135 | @see wxFocusEvent, wxWindow::SetFocus() |
23324ae1 FM |
136 | */ |
137 | virtual void SetFocus(); | |
138 | ||
139 | /** | |
4d7b68d1 FM |
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. | |
23324ae1 | 142 | */ |
adaaa686 | 143 | void SetFocusIgnoringChildren(); |
23324ae1 | 144 | }; |
e54c96f1 | 145 |