]> git.saurik.com Git - wxWidgets.git/blame - src/generic/panelg.cpp
unicode for mac fixes
[wxWidgets.git] / src / generic / panelg.cpp
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
d9506e77
VZ
2// Name: src/generic/panelg.cpp
3// Purpose: wxPanel and the keyboard handling code
4// Author: Julian Smart, Robert Roebling, Vadim Zeitlin
c801d85f
KB
5// Modified by:
6// Created: 04/01/98
7// RCS-ID: $Id$
6aa89a22
JS
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
c801d85f
KB
10/////////////////////////////////////////////////////////////////////////////
11
d9506e77
VZ
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
14f355c2 20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
d9506e77 21 #pragma implementation "panelg.h"
c801d85f
KB
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
d9506e77 28 #pragma hdrstop
c801d85f
KB
29#endif
30
31#ifndef WX_PRECOMP
d9506e77
VZ
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"
c801d85f
KB
37#endif
38
456bc6d9
VZ
39#include "wx/containr.h"
40#include "wx/panel.h"
c801d85f 41
d9506e77
VZ
42// ----------------------------------------------------------------------------
43// wxWin macros
44// ----------------------------------------------------------------------------
45
51596bcb
SC
46#if wxUSE_EXTENDED_RTTI
47IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow,"wx/panel.h")
48
49WX_BEGIN_PROPERTIES_TABLE(wxPanel)
066f1b7a 50// style wxTAB_TRAVERSAL
51596bcb
SC
51WX_END_PROPERTIES_TABLE()
52
53WX_BEGIN_HANDLERS_TABLE(wxPanel)
54WX_END_HANDLERS_TABLE()
55
56WX_CONSTRUCTOR_4( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
57
58#else
c801d85f 59IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
51596bcb 60#endif
c801d85f
KB
61
62BEGIN_EVENT_TABLE(wxPanel, wxWindow)
456bc6d9
VZ
63 EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
64
65 EVT_SIZE(wxPanel::OnSize)
66
67 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel)
c801d85f
KB
68END_EVENT_TABLE()
69
d9506e77
VZ
70// ============================================================================
71// implementation
72// ============================================================================
73
6b55490a 74WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel)
456bc6d9 75
d9506e77
VZ
76// ----------------------------------------------------------------------------
77// wxPanel creation
78// ----------------------------------------------------------------------------
c801d85f 79
edccf428 80void wxPanel::Init()
c801d85f 81{
9948d31f 82 m_container.SetContainerWindow(this);
c801d85f
KB
83}
84
debe6624 85bool wxPanel::Create(wxWindow *parent, wxWindowID id,
90c3bdac
VZ
86 const wxPoint& pos,
87 const wxSize& size,
88 long style,
89 const wxString& name)
c801d85f 90{
8bf30fe9 91 return wxWindow::Create(parent, id, pos, size, style, name);
c801d85f
KB
92}
93
456bc6d9
VZ
94wxPanel::~wxPanel()
95{
456bc6d9
VZ
96}
97
19193a2c
KB
98void wxPanel::InitDialog()
99{
100 wxInitDialogEvent event(GetId());
101 event.SetEventObject(this);
102 GetEventHandler()->ProcessEvent(event);
103}
104
d9506e77 105// ----------------------------------------------------------------------------
c40ce5ce 106// event handlers
d9506e77
VZ
107// ----------------------------------------------------------------------------
108
c801d85f
KB
109// Responds to colour changes, and passes event on to children.
110void wxPanel::OnSysColourChanged(wxSysColourChangedEvent& event)
111{
a756f210 112 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
c801d85f
KB
113 Refresh();
114
115 // Propagate the event to the non-top-level children
116 wxWindow::OnSysColourChanged(event);
117}
118
28edd9ef 119void wxPanel::OnSize(wxSizeEvent& event)
d9506e77
VZ
120{
121#if wxUSE_CONSTRAINTS
122 if (GetAutoLayout())
123 Layout();
879dcac2
DW
124#if defined(__WXPM__)
125 else
126 {
2b5f62a0
VZ
127 // Need to properly move child windows under OS/2
128
879dcac2
DW
129 PSWP pWinSwp = GetSwp();
130
131 if (pWinSwp->cx == 0 && pWinSwp->cy == 0 && pWinSwp->fl == 0)
2b5f62a0 132 {
879dcac2 133 // Uninitialized
2b5f62a0 134
879dcac2 135 ::WinQueryWindowPos(GetHWND(), pWinSwp);
2b5f62a0
VZ
136 }
137 else
879dcac2
DW
138 {
139 SWP vSwp;
140 int nYDiff;
141
142 ::WinQueryWindowPos(GetHWND(), &vSwp);
143 nYDiff = pWinSwp->cy - vSwp.cy;
144 MoveChildren(nYDiff);
145 pWinSwp->cx = vSwp.cx;
146 pWinSwp->cy = vSwp.cy;
147 }
148 }
149#endif
2b5f62a0
VZ
150#endif // wxUSE_CONSTRAINTS
151
28edd9ef 152 event.Skip();
d9506e77
VZ
153}
154