]> git.saurik.com Git - wxWidgets.git/blame - src/generic/panelg.cpp
Add comments explaining the workaround for mingw 3.2.3
[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 8// Copyright: (c) Julian Smart
65571936 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 46#if wxUSE_EXTENDED_RTTI
73c36334
JS
47WX_DEFINE_FLAGS( wxPanelStyle )
48
3ff066a4 49wxBEGIN_FLAGS( wxPanelStyle )
73c36334
JS
50 // new style border flags, we put them first to
51 // use them for streaming out
3ff066a4
SC
52 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
53 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
54 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
55 wxFLAGS_MEMBER(wxBORDER_RAISED)
56 wxFLAGS_MEMBER(wxBORDER_STATIC)
57 wxFLAGS_MEMBER(wxBORDER_NONE)
ca65c044 58
73c36334 59 // old style border flags
3ff066a4
SC
60 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
61 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
62 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
63 wxFLAGS_MEMBER(wxRAISED_BORDER)
64 wxFLAGS_MEMBER(wxSTATIC_BORDER)
cb0afb26 65 wxFLAGS_MEMBER(wxBORDER)
73c36334
JS
66
67 // standard window styles
3ff066a4
SC
68 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
69 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
70 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
71 wxFLAGS_MEMBER(wxWANTS_CHARS)
cb0afb26 72 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
3ff066a4
SC
73 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
74 wxFLAGS_MEMBER(wxVSCROLL)
75 wxFLAGS_MEMBER(wxHSCROLL)
73c36334 76
3ff066a4 77wxEND_FLAGS( wxPanelStyle )
73c36334 78
51596bcb
SC
79IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow,"wx/panel.h")
80
3ff066a4 81wxBEGIN_PROPERTIES_TABLE(wxPanel)
af498247 82 wxPROPERTY_FLAGS( WindowStyle , wxPanelStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
066f1b7a 83// style wxTAB_TRAVERSAL
3ff066a4 84wxEND_PROPERTIES_TABLE()
51596bcb 85
3ff066a4
SC
86wxBEGIN_HANDLERS_TABLE(wxPanel)
87wxEND_HANDLERS_TABLE()
51596bcb 88
ca65c044 89wxCONSTRUCTOR_5( wxPanel , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
51596bcb
SC
90
91#else
c801d85f 92IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
51596bcb 93#endif
c801d85f
KB
94
95BEGIN_EVENT_TABLE(wxPanel, wxWindow)
456bc6d9
VZ
96 EVT_SIZE(wxPanel::OnSize)
97
98 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel)
c801d85f
KB
99END_EVENT_TABLE()
100
d9506e77
VZ
101// ============================================================================
102// implementation
103// ============================================================================
104
6b55490a 105WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel)
456bc6d9 106
d9506e77
VZ
107// ----------------------------------------------------------------------------
108// wxPanel creation
109// ----------------------------------------------------------------------------
c801d85f 110
edccf428 111void wxPanel::Init()
c801d85f 112{
9948d31f 113 m_container.SetContainerWindow(this);
c801d85f
KB
114}
115
debe6624 116bool wxPanel::Create(wxWindow *parent, wxWindowID id,
90c3bdac
VZ
117 const wxPoint& pos,
118 const wxSize& size,
119 long style,
120 const wxString& name)
c801d85f 121{
e736b21a
VZ
122 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
123 return false;
124
fc55f961
VS
125 // so that non-solid background renders correctly under GTK+:
126 SetThemeEnabled(true);
ca65c044 127
5497e635 128#if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
b554cf63
JS
129 // Required to get solid control backgrounds under WinCE
130 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
95b838be
JS
131#endif
132
e736b21a 133 return true;
c801d85f
KB
134}
135
456bc6d9
VZ
136wxPanel::~wxPanel()
137{
456bc6d9
VZ
138}
139
19193a2c
KB
140void wxPanel::InitDialog()
141{
142 wxInitDialogEvent event(GetId());
143 event.SetEventObject(this);
144 GetEventHandler()->ProcessEvent(event);
145}
146
d9506e77 147// ----------------------------------------------------------------------------
c40ce5ce 148// event handlers
d9506e77
VZ
149// ----------------------------------------------------------------------------
150
28edd9ef 151void wxPanel::OnSize(wxSizeEvent& event)
d9506e77 152{
d9506e77
VZ
153 if (GetAutoLayout())
154 Layout();
987263fe 155#if wxUSE_CONSTRAINTS
879dcac2
DW
156#if defined(__WXPM__)
157 else
158 {
2b5f62a0
VZ
159 // Need to properly move child windows under OS/2
160
879dcac2
DW
161 PSWP pWinSwp = GetSwp();
162
163 if (pWinSwp->cx == 0 && pWinSwp->cy == 0 && pWinSwp->fl == 0)
2b5f62a0 164 {
879dcac2 165 // Uninitialized
2b5f62a0 166
879dcac2 167 ::WinQueryWindowPos(GetHWND(), pWinSwp);
ca65c044
WS
168 }
169 else
879dcac2
DW
170 {
171 SWP vSwp;
172 int nYDiff;
173
174 ::WinQueryWindowPos(GetHWND(), &vSwp);
175 nYDiff = pWinSwp->cy - vSwp.cy;
176 MoveChildren(nYDiff);
177 pWinSwp->cx = vSwp.cx;
178 pWinSwp->cy = vSwp.cy;
179 }
180 }
181#endif
2b5f62a0
VZ
182#endif // wxUSE_CONSTRAINTS
183
28edd9ef 184 event.Skip();
d9506e77
VZ
185}
186