]>
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
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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 #if wxUSE_EXTENDED_RTTI
47 IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel
, wxWindow
,"wx/panel.h")
49 WX_BEGIN_PROPERTIES_TABLE(wxPanel
)
50 // style wxTAB_TRAVERSAL
51 WX_END_PROPERTIES_TABLE()
53 WX_BEGIN_HANDLERS_TABLE(wxPanel
)
54 WX_END_HANDLERS_TABLE()
56 WX_CONSTRUCTOR_4( wxPanel
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
)
59 IMPLEMENT_DYNAMIC_CLASS(wxPanel
, wxWindow
)
62 BEGIN_EVENT_TABLE(wxPanel
, wxWindow
)
63 EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged
)
65 EVT_SIZE(wxPanel::OnSize
)
67 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel
)
70 // ============================================================================
72 // ============================================================================
74 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel
)
76 // ----------------------------------------------------------------------------
78 // ----------------------------------------------------------------------------
82 m_container
.SetContainerWindow(this);
85 bool wxPanel::Create(wxWindow
*parent
, wxWindowID id
,
91 return wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
98 void wxPanel::InitDialog()
100 wxInitDialogEvent
event(GetId());
101 event
.SetEventObject(this);
102 GetEventHandler()->ProcessEvent(event
);
105 // ----------------------------------------------------------------------------
107 // ----------------------------------------------------------------------------
109 // Responds to colour changes, and passes event on to children.
110 void wxPanel::OnSysColourChanged(wxSysColourChangedEvent
& event
)
112 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
));
115 // Propagate the event to the non-top-level children
116 wxWindow::OnSysColourChanged(event
);
119 void wxPanel::OnSize(wxSizeEvent
& event
)
121 #if wxUSE_CONSTRAINTS
124 #if defined(__WXPM__)
127 // Need to properly move child windows under OS/2
129 PSWP pWinSwp
= GetSwp();
131 if (pWinSwp
->cx
== 0 && pWinSwp
->cy
== 0 && pWinSwp
->fl
== 0)
135 ::WinQueryWindowPos(GetHWND(), pWinSwp
);
142 ::WinQueryWindowPos(GetHWND(), &vSwp
);
143 nYDiff
= pWinSwp
->cy
- vSwp
.cy
;
144 MoveChildren(nYDiff
);
145 pWinSwp
->cx
= vSwp
.cx
;
146 pWinSwp
->cy
= vSwp
.cy
;
150 #endif // wxUSE_CONSTRAINTS