]>
git.saurik.com Git - wxWidgets.git/blob - 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
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "panelg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/object.h"
34 #include "wx/colour.h"
35 #include "wx/settings.h"
39 #include "wx/containr.h"
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 IMPLEMENT_DYNAMIC_CLASS(wxPanel
, wxWindow
)
48 BEGIN_EVENT_TABLE(wxPanel
, wxWindow
)
49 EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged
)
51 EVT_SIZE(wxPanel::OnSize
)
53 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel
)
56 // ============================================================================
58 // ============================================================================
60 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel
)
62 // ----------------------------------------------------------------------------
64 // ----------------------------------------------------------------------------
68 m_container
.SetContainerWindow(this);
71 bool wxPanel::Create(wxWindow
*parent
, wxWindowID id
,
77 return wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
84 void wxPanel::InitDialog()
86 wxInitDialogEvent
event(GetId());
87 event
.SetEventObject(this);
88 GetEventHandler()->ProcessEvent(event
);
91 // ----------------------------------------------------------------------------
93 // ----------------------------------------------------------------------------
95 // Responds to colour changes, and passes event on to children.
96 void wxPanel::OnSysColourChanged(wxSysColourChangedEvent
& event
)
98 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
));
101 // Propagate the event to the non-top-level children
102 wxWindow::OnSysColourChanged(event
);
105 void wxPanel::OnSize(wxSizeEvent
& event
)
107 #if wxUSE_CONSTRAINTS
110 #endif // wxUSE_CONSTRAINTS
113 // Need to properly move child windows under OS/2
115 #if defined(__WXPM__)
118 PSWP pWinSwp
= GetSwp();
120 if (pWinSwp
->cx
== 0 && pWinSwp
->cy
== 0 && pWinSwp
->fl
== 0)
124 ::WinQueryWindowPos(GetHWND(), pWinSwp
);
130 ::WinQueryWindowPos(GetHWND(), &vSwp
);
131 nYDiff
= pWinSwp
->cy
- vSwp
.cy
;
132 MoveChildren(nYDiff
);
133 pWinSwp
->cx
= vSwp
.cx
;
134 pWinSwp
->cy
= vSwp
.cy
;