]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/panelg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/panelg.h
3 // Purpose: wxPanel: a container for child controls
4 // Author: Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GENERIC_PANEL_H_
13 #define _WX_GENERIC_PANEL_H_
16 #pragma interface "panelg.h"
19 // ----------------------------------------------------------------------------
20 // headers and forward declarations
21 // ----------------------------------------------------------------------------
23 #include "wx/window.h"
25 class WXDLLEXPORT wxButton
;
27 WXDLLEXPORT_DATA(extern const wxChar
*) wxPanelNameStr
;
29 // ----------------------------------------------------------------------------
30 // wxPanel contains other controls and implements TAB traversal between them
31 // ----------------------------------------------------------------------------
33 class WXDLLEXPORT wxPanel
: public wxWindow
38 // Old-style constructor (no default values for coordinates to avoid
39 // ambiguity with the new one)
40 wxPanel(wxWindow
*parent
,
41 int x
, int y
, int width
, int height
,
42 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
43 const wxString
& name
= wxPanelNameStr
)
47 Create(parent
, -1, wxPoint(x
, y
), wxSize(width
, height
), style
, name
);
51 wxPanel(wxWindow
*parent
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
55 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
56 const wxString
& name
= wxPanelNameStr
)
60 Create(parent
, id
, pos
, size
, style
, name
);
64 bool Create(wxWindow
*parent
, wxWindowID id
,
65 const wxPoint
& pos
= wxDefaultPosition
,
66 const wxSize
& size
= wxDefaultSize
,
67 long style
= wxTAB_TRAVERSAL
| wxNO_BORDER
,
68 const wxString
& name
= wxPanelNameStr
);
70 // Sends an OnInitDialog event, which in turns transfers data to
71 // to the dialog via validators.
72 virtual void InitDialog();
75 // a default button is activated when Enter is pressed
76 wxButton
*GetDefaultItem() const { return m_btnDefault
; }
77 void SetDefaultItem(wxButton
*btn
) { m_btnDefault
= btn
; }
78 #endif // wxUSE_BUTTON
80 // implementation from now on
81 // --------------------------
83 // responds to colour changes
84 void OnSysColourChanged(wxSysColourChangedEvent
& event
);
86 // process a keyboard navigation message (Tab traversal)
87 void OnNavigationKey(wxNavigationKeyEvent
& event
);
89 // set the focus to the first child if we get it
90 void OnFocus(wxFocusEvent
& event
);
92 // calls layout for layout constraints and sizers
93 void OnSize(wxSizeEvent
& event
);
95 // overridden to tab move focus into first focusable child
96 virtual void SetFocus();
98 // called by wxWindow whenever it gets focus
99 void SetLastFocus(wxWindow
*win
) { m_winLastFocused
= win
; }
100 wxWindow
*GetLastFocus() const { return m_winLastFocused
; }
102 virtual void RemoveChild(wxWindowBase
*child
);
105 // common part of all ctors
108 // set the focus to the child which had it the last time
109 bool SetFocusToChild();
111 // the child which had the focus last time this panel was activated
112 wxWindow
*m_winLastFocused
;
115 // a default button or NULL
116 wxButton
*m_btnDefault
;
117 #endif // wxUSE_BUTTON
120 DECLARE_DYNAMIC_CLASS(wxPanel
)
121 DECLARE_EVENT_TABLE()
124 // this function is for wxWindows use only
125 extern bool wxSetFocusToChild(wxWindow
*win
, wxWindow
**child
);
128 // _WX_GENERIC_PANEL_H_