]> git.saurik.com Git - wxWidgets.git/blob - src/generic/panelg.cpp
bug in SetLastFocus corrected
[wxWidgets.git] / src / generic / panelg.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/panelg.cpp
3 // Purpose: wxPanel and the keyboard handling code
4 // Author: Julian Smart, Robert Roebling, Vadim Zeitlin
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 #ifdef __GNUG__
21 #pragma implementation "panelg.h"
22 #endif
23
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
26
27 #ifdef __BORLANDC__
28 #pragma hdrstop
29 #endif
30
31 #ifndef WX_PRECOMP
32 #include "wx/object.h"
33 #include "wx/font.h"
34 #include "wx/colour.h"
35 #include "wx/settings.h"
36 #include "wx/log.h"
37 #endif
38
39 #include "wx/containr.h"
40 #include "wx/panel.h"
41
42 // ----------------------------------------------------------------------------
43 // wxWin macros
44 // ----------------------------------------------------------------------------
45
46 IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
47
48 BEGIN_EVENT_TABLE(wxPanel, wxWindow)
49 EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
50
51 EVT_SIZE(wxPanel::OnSize)
52
53 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel)
54 END_EVENT_TABLE()
55
56 // ============================================================================
57 // implementation
58 // ============================================================================
59
60 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel, m_container)
61
62 // ----------------------------------------------------------------------------
63 // wxPanel creation
64 // ----------------------------------------------------------------------------
65
66 void wxPanel::Init()
67 {
68 m_container = new wxControlContainer(this);
69 }
70
71 bool wxPanel::Create(wxWindow *parent, wxWindowID id,
72 const wxPoint& pos,
73 const wxSize& size,
74 long style,
75 const wxString& name)
76 {
77 return wxWindow::Create(parent, id, pos, size, style, name);
78 }
79
80 wxPanel::~wxPanel()
81 {
82 delete m_container;
83 }
84
85 // ----------------------------------------------------------------------------
86 // misc
87 // ----------------------------------------------------------------------------
88
89 void wxPanel::InitDialog()
90 {
91 wxInitDialogEvent event(GetId());
92 event.SetEventObject(this);
93 GetEventHandler()->ProcessEvent(event);
94 }
95
96 // Responds to colour changes, and passes event on to children.
97 void wxPanel::OnSysColourChanged(wxSysColourChangedEvent& event)
98 {
99 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
100 Refresh();
101
102 // Propagate the event to the non-top-level children
103 wxWindow::OnSysColourChanged(event);
104 }
105
106 void wxPanel::OnSize(wxSizeEvent& WXUNUSED(event))
107 {
108 #if wxUSE_CONSTRAINTS
109 if (GetAutoLayout())
110 Layout();
111 #endif // wxUSE_CONSTRAINTS
112 }
113