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