]> git.saurik.com Git - wxWidgets.git/blame - src/generic/panelg.cpp
No changes, just refactor wxMSW background brush methods.
[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
c801d85f
KB
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
d9506e77 24 #pragma hdrstop
c801d85f
KB
25#endif
26
27#ifndef WX_PRECOMP
d9506e77
VZ
28 #include "wx/object.h"
29 #include "wx/font.h"
30 #include "wx/colour.h"
31 #include "wx/settings.h"
32 #include "wx/log.h"
8e609c82 33 #include "wx/panel.h"
841f23e1 34 #include "wx/containr.h"
c801d85f
KB
35#endif
36
d9506e77
VZ
37// ----------------------------------------------------------------------------
38// wxWin macros
39// ----------------------------------------------------------------------------
40
c801d85f 41BEGIN_EVENT_TABLE(wxPanel, wxWindow)
456bc6d9 42 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel)
c801d85f
KB
43END_EVENT_TABLE()
44
d9506e77
VZ
45// ============================================================================
46// implementation
47// ============================================================================
48
6c20e8f8 49WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel, wxWindow)
456bc6d9 50
d9506e77
VZ
51// ----------------------------------------------------------------------------
52// wxPanel creation
53// ----------------------------------------------------------------------------
c801d85f 54
edccf428 55void wxPanel::Init()
c801d85f 56{
de160b06 57 WX_INIT_CONTROL_CONTAINER();
c801d85f
KB
58}
59
debe6624 60bool wxPanel::Create(wxWindow *parent, wxWindowID id,
90c3bdac
VZ
61 const wxPoint& pos,
62 const wxSize& size,
63 long style,
64 const wxString& name)
c801d85f 65{
e736b21a
VZ
66 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
67 return false;
68
fc55f961
VS
69 // so that non-solid background renders correctly under GTK+:
70 SetThemeEnabled(true);
ca65c044 71
5497e635 72#if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
b554cf63
JS
73 // Required to get solid control backgrounds under WinCE
74 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
95b838be
JS
75#endif
76
e736b21a 77 return true;
c801d85f
KB
78}
79
456bc6d9
VZ
80wxPanel::~wxPanel()
81{
456bc6d9
VZ
82}
83
19193a2c
KB
84void wxPanel::InitDialog()
85{
86 wxInitDialogEvent event(GetId());
87 event.SetEventObject(this);
88 GetEventHandler()->ProcessEvent(event);
89}
90
d9317033
VZ
91#ifdef __WXMSW__
92
93bool wxPanel::HasTransparentBackground()
94{
95 for ( wxWindow *win = GetParent(); win; win = win->GetParent() )
96 {
97 if ( win->MSWHasInheritableBackground() )
98 return true;
99
100 if ( win->IsTopLevel() )
101 break;
102 }
103
104 return false;
105}
106
107#endif // __WXMSW__