]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/generic/panelg.cpp | |
3 | // Purpose: wxPanel and the keyboard handling code | |
4 | // Author: Julian Smart, Robert Roebling, Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | // For compilers that support precompilation, includes "wx.h". | |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #ifndef WX_PRECOMP | |
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" | |
33 | #include "wx/panel.h" | |
34 | #include "wx/containr.h" | |
35 | #endif | |
36 | ||
37 | // ---------------------------------------------------------------------------- | |
38 | // wxWin macros | |
39 | // ---------------------------------------------------------------------------- | |
40 | ||
41 | BEGIN_EVENT_TABLE(wxPanel, wxWindow) | |
42 | WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel) | |
43 | END_EVENT_TABLE() | |
44 | ||
45 | // ============================================================================ | |
46 | // implementation | |
47 | // ============================================================================ | |
48 | ||
49 | WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel, wxWindow) | |
50 | ||
51 | // ---------------------------------------------------------------------------- | |
52 | // wxPanel creation | |
53 | // ---------------------------------------------------------------------------- | |
54 | ||
55 | void wxPanel::Init() | |
56 | { | |
57 | WX_INIT_CONTROL_CONTAINER(); | |
58 | } | |
59 | ||
60 | bool wxPanel::Create(wxWindow *parent, wxWindowID id, | |
61 | const wxPoint& pos, | |
62 | const wxSize& size, | |
63 | long style, | |
64 | const wxString& name) | |
65 | { | |
66 | if ( !wxWindow::Create(parent, id, pos, size, style, name) ) | |
67 | return false; | |
68 | ||
69 | // so that non-solid background renders correctly under GTK+: | |
70 | SetThemeEnabled(true); | |
71 | ||
72 | #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__)) | |
73 | // Required to get solid control backgrounds under WinCE | |
74 | SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); | |
75 | #endif | |
76 | ||
77 | return true; | |
78 | } | |
79 | ||
80 | wxPanel::~wxPanel() | |
81 | { | |
82 | } | |
83 | ||
84 | void wxPanel::InitDialog() | |
85 | { | |
86 | wxInitDialogEvent event(GetId()); | |
87 | event.SetEventObject(this); | |
88 | GetEventHandler()->ProcessEvent(event); | |
89 | } | |
90 | ||
91 | #ifdef __WXMSW__ | |
92 | ||
93 | bool 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__ |