]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _pywindows.i | |
3 | // Purpose: SWIG interface for wxPyWindow, and etc. These classes support | |
4 | // overriding many of wxWindow's virtual methods in Python derived | |
5 | // classes. | |
6 | // | |
7 | // Author: Robin Dunn | |
8 | // | |
9 | // Created: 2-June-1998 | |
10 | // RCS-ID: $Id$ | |
11 | // Copyright: (c) 2003 by Total Control Software | |
12 | // Licence: wxWindows license | |
13 | ///////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | // Not a %module | |
16 | ||
17 | ||
18 | //--------------------------------------------------------------------------- | |
19 | %newgroup | |
20 | ||
21 | // TODO: Redo these with SWIG directors? | |
22 | ||
23 | // TODO: Which (if any?) of these should be done also??? | |
24 | // Destroy | |
25 | // DoCaptureMouse | |
26 | // DoClientToScreen | |
27 | // DoHitTest | |
28 | // DoMoveWindow | |
29 | // DoPopupMenu | |
30 | // DoReleaseMouse | |
31 | // DoScreenToClient | |
32 | // DoSetToolTip | |
33 | // Enable | |
34 | // Fit | |
35 | // GetCharHeight | |
36 | // GetCharWidth | |
37 | // GetClientAreaOrigin | |
38 | // GetDefaultItem | |
39 | // IsTopLevel | |
40 | // SetBackgroundColour | |
41 | // SetDefaultItem | |
42 | // SetFocus | |
43 | // SetFocusFromKbd | |
44 | // SetForegroundColour | |
45 | // SetSizeHints | |
46 | // SetVirtualSizeHints | |
47 | // Show | |
48 | ||
49 | ||
d14a1e28 RD |
50 | //--------------------------------------------------------------------------- |
51 | ||
d14a1e28 RD |
52 | %{ // C++ version of Python aware wxWindow |
53 | class wxPyWindow : public wxWindow | |
54 | { | |
55 | DECLARE_DYNAMIC_CLASS(wxPyWindow) | |
56 | public: | |
57 | wxPyWindow() : wxWindow() {} | |
58 | wxPyWindow(wxWindow* parent, const wxWindowID id, | |
59 | const wxPoint& pos = wxDefaultPosition, | |
60 | const wxSize& size = wxDefaultSize, | |
61 | long style = 0, | |
62 | const wxString& name = wxPyPanelNameStr) | |
63 | : wxWindow(parent, id, pos, size, style, name) {} | |
64 | ||
1a10485f | 65 | void SetBestSize(const wxSize& size) { wxWindow::SetBestSize(size); } |
d14a1e28 | 66 | |
0ef14ca5 RD |
67 | bool DoEraseBackground(wxDC* dc) { |
68 | #ifdef __WXMSW__ | |
69 | return wxWindow::DoEraseBackground(dc->GetHDC()); | |
70 | #else | |
71 | dc->SetBackground(wxBrush(GetBackgroundColour())); | |
72 | dc->Clear(); | |
73 | return true; | |
74 | #endif | |
75 | } | |
76 | ||
d14a1e28 RD |
77 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); |
78 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
79 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
80 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
81 | ||
82 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
83 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
84 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
85 | ||
86 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
87 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
88 | ||
89 | DEC_PYCALLBACK__(InitDialog); | |
90 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
91 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
92 | DEC_PYCALLBACK_BOOL_(Validate); | |
93 | ||
94 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
95 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
96 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
97 | ||
98 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
99 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
100 | ||
1a10485f | 101 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
1a10485f | 102 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
4d2962b1 | 103 | |
b035e80b RD |
104 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
105 | ||
37617433 RD |
106 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
107 | ||
d14a1e28 RD |
108 | PYPRIVATE; |
109 | }; | |
110 | ||
111 | IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow); | |
112 | ||
113 | IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow); | |
114 | IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize); | |
115 | IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize); | |
116 | IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize); | |
117 | ||
118 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize); | |
119 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize); | |
120 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition); | |
121 | ||
122 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize); | |
123 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize); | |
124 | ||
125 | IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog); | |
126 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow); | |
127 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow); | |
128 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate); | |
129 | ||
130 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus); | |
131 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard); | |
132 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize); | |
133 | ||
134 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild); | |
135 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild); | |
136 | ||
1a10485f | 137 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, ShouldInheritColours); |
1a10485f | 138 | IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes); |
b035e80b RD |
139 | |
140 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, HasTransparentBackground); | |
37617433 RD |
141 | |
142 | IMP_PYCALLBACK_VOID_(wxPyWindow, wxWindow, OnInternalIdle); | |
d14a1e28 RD |
143 | %} |
144 | ||
145 | // And now the one for SWIG to see | |
ab1f7d2a | 146 | MustHaveApp(wxPyWindow); |
d14a1e28 RD |
147 | class wxPyWindow : public wxWindow |
148 | { | |
149 | public: | |
2b9048c5 | 150 | %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)" |
d43da706 | 151 | %pythonAppend wxPyWindow() "" |
d14a1e28 | 152 | |
d5573410 | 153 | wxPyWindow(wxWindow* parent, const wxWindowID id=-1, |
d14a1e28 RD |
154 | const wxPoint& pos = wxDefaultPosition, |
155 | const wxSize& size = wxDefaultSize, | |
156 | long style = 0, | |
157 | const wxString& name = wxPyPanelNameStr); | |
158 | ||
1b8c7ba6 | 159 | %RenameCtor(PrePyWindow, wxPyWindow()); |
d43da706 | 160 | |
d14a1e28 RD |
161 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
162 | ||
1a10485f | 163 | void SetBestSize(const wxSize& size); |
0ef14ca5 RD |
164 | bool DoEraseBackground(wxDC* dc); |
165 | ||
a7a01418 RD |
166 | void DoMoveWindow(int x, int y, int width, int height); |
167 | void DoSetSize(int x, int y, int width, int height, | |
168 | int sizeFlags = wxSIZE_AUTO); | |
169 | void DoSetClientSize(int width, int height); | |
170 | void DoSetVirtualSize( int x, int y ); | |
d14a1e28 | 171 | |
322913ce | 172 | DocDeclA( |
a7a01418 RD |
173 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
174 | "DoGetSize() -> (width, height)"); | |
322913ce | 175 | DocDeclA( |
a7a01418 RD |
176 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
177 | "DoGetClientSize() -> (width, height)"); | |
322913ce | 178 | DocDeclA( |
a7a01418 RD |
179 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
180 | "DoGetPosition() -> (x,y)"); | |
181 | ||
182 | wxSize DoGetVirtualSize() const; | |
183 | wxSize DoGetBestSize() const; | |
184 | ||
185 | void InitDialog(); | |
186 | bool TransferDataToWindow(); | |
187 | bool TransferDataFromWindow(); | |
188 | bool Validate(); | |
189 | ||
190 | bool AcceptsFocus() const; | |
191 | bool AcceptsFocusFromKeyboard() const; | |
192 | wxSize GetMaxSize() const; | |
193 | ||
194 | void AddChild(wxWindow* child); | |
195 | void RemoveChild(wxWindow* child); | |
196 | ||
197 | bool ShouldInheritColours() const; | |
198 | wxVisualAttributes GetDefaultAttributes(); | |
199 | ||
200 | void OnInternalIdle(); | |
201 | ||
202 | %MAKE_BASE_FUNC(PyWindow, DoMoveWindow); | |
203 | %MAKE_BASE_FUNC(PyWindow, DoSetSize); | |
204 | %MAKE_BASE_FUNC(PyWindow, DoSetClientSize); | |
205 | %MAKE_BASE_FUNC(PyWindow, DoSetVirtualSize); | |
206 | %MAKE_BASE_FUNC(PyWindow, DoGetSize); | |
207 | %MAKE_BASE_FUNC(PyWindow, DoGetClientSize); | |
208 | %MAKE_BASE_FUNC(PyWindow, DoGetPosition); | |
209 | %MAKE_BASE_FUNC(PyWindow, DoGetVirtualSize); | |
210 | %MAKE_BASE_FUNC(PyWindow, DoGetBestSize); | |
211 | %MAKE_BASE_FUNC(PyWindow, InitDialog); | |
212 | %MAKE_BASE_FUNC(PyWindow, TransferDataToWindow); | |
213 | %MAKE_BASE_FUNC(PyWindow, TransferDataFromWindow); | |
214 | %MAKE_BASE_FUNC(PyWindow, Validate); | |
215 | %MAKE_BASE_FUNC(PyWindow, AcceptsFocus); | |
216 | %MAKE_BASE_FUNC(PyWindow, AcceptsFocusFromKeyboard); | |
217 | %MAKE_BASE_FUNC(PyWindow, GetMaxSize); | |
218 | %MAKE_BASE_FUNC(PyWindow, AddChild); | |
219 | %MAKE_BASE_FUNC(PyWindow, RemoveChild); | |
220 | %MAKE_BASE_FUNC(PyWindow, ShouldInheritColours); | |
221 | %MAKE_BASE_FUNC(PyWindow, GetDefaultAttributes); | |
222 | %MAKE_BASE_FUNC(PyWindow, OnInternalIdle); | |
223 | ||
d14a1e28 RD |
224 | }; |
225 | ||
226 | //--------------------------------------------------------------------------- | |
227 | // Do the same thing for wxControl | |
228 | ||
229 | // ** See _pycontrol.i, it was moved there because of dependency on wxControl | |
230 | ||
231 | ||
232 | //--------------------------------------------------------------------------- | |
233 | // and for wxPanel | |
234 | ||
235 | %{ // C++ version of Python aware wxPanel | |
236 | class wxPyPanel : public wxPanel | |
237 | { | |
238 | DECLARE_DYNAMIC_CLASS(wxPyPanel) | |
239 | public: | |
240 | wxPyPanel() : wxPanel() {} | |
241 | wxPyPanel(wxWindow* parent, const wxWindowID id, | |
242 | const wxPoint& pos = wxDefaultPosition, | |
243 | const wxSize& size = wxDefaultSize, | |
244 | long style = 0, | |
245 | const wxString& name = wxPyPanelNameStr) | |
246 | : wxPanel(parent, id, pos, size, style, name) {} | |
247 | ||
1a10485f | 248 | void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); } |
0ef14ca5 RD |
249 | bool DoEraseBackground(wxDC* dc) { |
250 | #ifdef __WXMSW__ | |
251 | return wxWindow::DoEraseBackground(dc->GetHDC()); | |
252 | #else | |
253 | dc->SetBackground(wxBrush(GetBackgroundColour())); | |
254 | dc->Clear(); | |
255 | return true; | |
256 | #endif | |
257 | } | |
1a10485f | 258 | |
d14a1e28 RD |
259 | |
260 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); | |
261 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
262 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
263 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
264 | ||
265 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
266 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
267 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
268 | ||
269 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
270 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
271 | ||
272 | DEC_PYCALLBACK__(InitDialog); | |
273 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
274 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
275 | DEC_PYCALLBACK_BOOL_(Validate); | |
276 | ||
277 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
278 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
279 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
280 | ||
281 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
282 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
283 | ||
1a10485f | 284 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
1a10485f | 285 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
4d2962b1 | 286 | |
b035e80b RD |
287 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
288 | ||
37617433 RD |
289 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
290 | ||
d14a1e28 RD |
291 | PYPRIVATE; |
292 | }; | |
293 | ||
294 | IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel); | |
295 | ||
296 | IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow); | |
297 | IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize); | |
298 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize); | |
299 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize); | |
300 | ||
301 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize); | |
302 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize); | |
303 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition); | |
304 | ||
305 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize); | |
306 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize); | |
307 | ||
308 | IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog); | |
309 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow); | |
310 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow); | |
311 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate); | |
312 | ||
313 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus); | |
314 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard); | |
315 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize); | |
316 | ||
317 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild); | |
318 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild); | |
319 | ||
1a10485f | 320 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours); |
1a10485f RD |
321 | IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes); |
322 | ||
b035e80b | 323 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, HasTransparentBackground); |
37617433 RD |
324 | |
325 | IMP_PYCALLBACK_VOID_(wxPyPanel, wxPanel, OnInternalIdle); | |
b035e80b | 326 | %} |
d14a1e28 RD |
327 | |
328 | // And now the one for SWIG to see | |
ab1f7d2a | 329 | MustHaveApp(wxPyPanel); |
d14a1e28 RD |
330 | class wxPyPanel : public wxPanel |
331 | { | |
332 | public: | |
2b9048c5 | 333 | %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)" |
d43da706 | 334 | %pythonAppend wxPyPanel() "" |
d14a1e28 | 335 | |
d5573410 | 336 | wxPyPanel(wxWindow* parent, const wxWindowID id=-1, |
d14a1e28 RD |
337 | const wxPoint& pos = wxDefaultPosition, |
338 | const wxSize& size = wxDefaultSize, | |
339 | long style = 0, | |
340 | const wxString& name = wxPyPanelNameStr); | |
341 | ||
1b8c7ba6 | 342 | %RenameCtor(PrePyPanel, wxPyPanel()); |
d43da706 RD |
343 | |
344 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
345 | ||
1a10485f | 346 | void SetBestSize(const wxSize& size); |
0ef14ca5 RD |
347 | bool DoEraseBackground(wxDC* dc); |
348 | ||
a7a01418 RD |
349 | void DoMoveWindow(int x, int y, int width, int height); |
350 | void DoSetSize(int x, int y, int width, int height, | |
d43da706 | 351 | int sizeFlags = wxSIZE_AUTO); |
a7a01418 RD |
352 | void DoSetClientSize(int width, int height); |
353 | void DoSetVirtualSize( int x, int y ); | |
d43da706 RD |
354 | |
355 | DocDeclA( | |
a7a01418 RD |
356 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
357 | "DoGetSize() -> (width, height)"); | |
d43da706 | 358 | DocDeclA( |
a7a01418 RD |
359 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
360 | "DoGetClientSize() -> (width, height)"); | |
d43da706 | 361 | DocDeclA( |
a7a01418 RD |
362 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
363 | "DoGetPosition() -> (x,y)"); | |
364 | ||
365 | wxSize DoGetVirtualSize() const; | |
366 | wxSize DoGetBestSize() const; | |
367 | ||
368 | void InitDialog(); | |
369 | bool TransferDataToWindow(); | |
370 | bool TransferDataFromWindow(); | |
371 | bool Validate(); | |
372 | ||
373 | bool AcceptsFocus() const; | |
374 | bool AcceptsFocusFromKeyboard() const; | |
375 | wxSize GetMaxSize() const; | |
376 | ||
377 | void AddChild(wxWindow* child); | |
378 | void RemoveChild(wxWindow* child); | |
379 | ||
380 | bool ShouldInheritColours() const ; | |
381 | wxVisualAttributes GetDefaultAttributes(); | |
382 | ||
383 | void OnInternalIdle(); | |
384 | ||
385 | %MAKE_BASE_FUNC(PyPanel, DoMoveWindow); | |
386 | %MAKE_BASE_FUNC(PyPanel, DoSetSize); | |
387 | %MAKE_BASE_FUNC(PyPanel, DoSetClientSize); | |
388 | %MAKE_BASE_FUNC(PyPanel, DoSetVirtualSize); | |
389 | %MAKE_BASE_FUNC(PyPanel, DoGetSize); | |
390 | %MAKE_BASE_FUNC(PyPanel, DoGetClientSize); | |
391 | %MAKE_BASE_FUNC(PyPanel, DoGetPosition); | |
392 | %MAKE_BASE_FUNC(PyPanel, DoGetVirtualSize); | |
393 | %MAKE_BASE_FUNC(PyPanel, DoGetBestSize); | |
394 | %MAKE_BASE_FUNC(PyPanel, InitDialog); | |
395 | %MAKE_BASE_FUNC(PyPanel, TransferDataToWindow); | |
396 | %MAKE_BASE_FUNC(PyPanel, TransferDataFromWindow); | |
397 | %MAKE_BASE_FUNC(PyPanel, Validate); | |
398 | %MAKE_BASE_FUNC(PyPanel, AcceptsFocus); | |
399 | %MAKE_BASE_FUNC(PyPanel, AcceptsFocusFromKeyboard); | |
400 | %MAKE_BASE_FUNC(PyPanel, GetMaxSize); | |
401 | %MAKE_BASE_FUNC(PyPanel, AddChild); | |
402 | %MAKE_BASE_FUNC(PyPanel, RemoveChild); | |
403 | %MAKE_BASE_FUNC(PyPanel, ShouldInheritColours); | |
404 | %MAKE_BASE_FUNC(PyPanel, GetDefaultAttributes); | |
405 | %MAKE_BASE_FUNC(PyPanel, OnInternalIdle); | |
d43da706 RD |
406 | }; |
407 | ||
408 | //--------------------------------------------------------------------------- | |
409 | // and for wxScrolledWindow | |
410 | ||
411 | %{ // C++ version of Python aware wxScrolledWindow | |
412 | class wxPyScrolledWindow : public wxScrolledWindow | |
413 | { | |
414 | DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow) | |
415 | public: | |
416 | wxPyScrolledWindow() : wxScrolledWindow() {} | |
417 | wxPyScrolledWindow(wxWindow* parent, const wxWindowID id, | |
418 | const wxPoint& pos = wxDefaultPosition, | |
419 | const wxSize& size = wxDefaultSize, | |
420 | long style = 0, | |
421 | const wxString& name = wxPyPanelNameStr) | |
422 | : wxScrolledWindow(parent, id, pos, size, style, name) {} | |
423 | ||
1a10485f | 424 | void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); } |
0ef14ca5 RD |
425 | bool DoEraseBackground(wxDC* dc) { |
426 | #ifdef __WXMSW__ | |
427 | return wxWindow::DoEraseBackground(dc->GetHDC()); | |
428 | #else | |
429 | dc->SetBackground(wxBrush(GetBackgroundColour())); | |
430 | dc->Clear(); | |
431 | return true; | |
432 | #endif | |
433 | } | |
d43da706 RD |
434 | |
435 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); | |
436 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
437 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
438 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
439 | ||
440 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
441 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
442 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
443 | ||
444 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
445 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
446 | ||
447 | DEC_PYCALLBACK__(InitDialog); | |
448 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
449 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
450 | DEC_PYCALLBACK_BOOL_(Validate); | |
451 | ||
452 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
453 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
454 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
455 | ||
456 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
457 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
458 | ||
1a10485f | 459 | DEC_PYCALLBACK_BOOL_const(ShouldInheritColours); |
1a10485f | 460 | DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes); |
d43da706 | 461 | |
b035e80b RD |
462 | DEC_PYCALLBACK_BOOL_(HasTransparentBackground); |
463 | ||
37617433 RD |
464 | DEC_PYCALLBACK_VOID_(OnInternalIdle); |
465 | ||
d43da706 RD |
466 | PYPRIVATE; |
467 | }; | |
468 | ||
469 | IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow); | |
470 | ||
471 | IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow); | |
472 | IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize); | |
473 | IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize); | |
474 | IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize); | |
475 | ||
476 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize); | |
477 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize); | |
478 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition); | |
479 | ||
480 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize); | |
481 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize); | |
482 | ||
483 | IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog); | |
484 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow); | |
485 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow); | |
486 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate); | |
487 | ||
488 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus); | |
489 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard); | |
490 | IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize); | |
491 | ||
492 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild); | |
493 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild); | |
494 | ||
1a10485f | 495 | IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours); |
1a10485f RD |
496 | IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes); |
497 | ||
b035e80b | 498 | IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, HasTransparentBackground); |
37617433 RD |
499 | |
500 | IMP_PYCALLBACK_VOID_(wxPyScrolledWindow, wxScrolledWindow, OnInternalIdle); | |
d43da706 RD |
501 | %} |
502 | ||
503 | // And now the one for SWIG to see | |
ab1f7d2a | 504 | MustHaveApp(wxPyScrolledWindow); |
d43da706 RD |
505 | class wxPyScrolledWindow : public wxScrolledWindow |
506 | { | |
507 | public: | |
cccb455e | 508 | %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyScrolledWindow)" |
d43da706 RD |
509 | %pythonAppend wxPyScrolledWindow() "" |
510 | ||
d5573410 | 511 | wxPyScrolledWindow(wxWindow* parent, const wxWindowID id=-1, |
d43da706 RD |
512 | const wxPoint& pos = wxDefaultPosition, |
513 | const wxSize& size = wxDefaultSize, | |
514 | long style = 0, | |
515 | const wxString& name = wxPyPanelNameStr); | |
516 | ||
1b8c7ba6 | 517 | %RenameCtor(PrePyScrolledWindow, wxPyScrolledWindow()); |
d43da706 | 518 | |
d14a1e28 | 519 | void _setCallbackInfo(PyObject* self, PyObject* _class); |
d14a1e28 | 520 | |
1a10485f | 521 | void SetBestSize(const wxSize& size); |
0ef14ca5 RD |
522 | bool DoEraseBackground(wxDC* dc); |
523 | ||
a7a01418 RD |
524 | void DoMoveWindow(int x, int y, int width, int height); |
525 | void DoSetSize(int x, int y, int width, int height, | |
d14a1e28 | 526 | int sizeFlags = wxSIZE_AUTO); |
a7a01418 RD |
527 | void DoSetClientSize(int width, int height); |
528 | void DoSetVirtualSize( int x, int y ); | |
d14a1e28 | 529 | |
322913ce | 530 | DocDeclA( |
a7a01418 RD |
531 | void, DoGetSize( int *OUTPUT, int *OUTPUT ) const, |
532 | "DoGetSize() -> (width, height)"); | |
322913ce | 533 | DocDeclA( |
a7a01418 RD |
534 | void, DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, |
535 | "DoGetClientSize() -> (width, height)"); | |
322913ce | 536 | DocDeclA( |
a7a01418 RD |
537 | void, DoGetPosition( int *OUTPUT, int *OUTPUT ) const, |
538 | "DoGetPosition() -> (x,y)"); | |
539 | ||
540 | wxSize DoGetVirtualSize() const; | |
541 | wxSize DoGetBestSize() const; | |
542 | ||
543 | void InitDialog(); | |
544 | bool TransferDataToWindow(); | |
545 | bool TransferDataFromWindow(); | |
546 | bool Validate(); | |
547 | ||
548 | bool AcceptsFocus() const; | |
549 | bool AcceptsFocusFromKeyboard() const; | |
550 | wxSize GetMaxSize() const; | |
551 | ||
552 | void AddChild(wxWindow* child); | |
553 | void RemoveChild(wxWindow* child); | |
554 | ||
555 | bool ShouldInheritColours() const; | |
556 | wxVisualAttributes GetDefaultAttributes(); | |
557 | ||
558 | void OnInternalIdle(); | |
559 | ||
560 | %MAKE_BASE_FUNC(PyScrolledWindow, DoMoveWindow); | |
561 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetSize); | |
562 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetClientSize); | |
563 | %MAKE_BASE_FUNC(PyScrolledWindow, DoSetVirtualSize); | |
564 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetSize); | |
565 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetClientSize); | |
566 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetPosition); | |
567 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetVirtualSize); | |
568 | %MAKE_BASE_FUNC(PyScrolledWindow, DoGetBestSize); | |
569 | %MAKE_BASE_FUNC(PyScrolledWindow, InitDialog); | |
570 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataToWindow); | |
571 | %MAKE_BASE_FUNC(PyScrolledWindow, TransferDataFromWindow); | |
572 | %MAKE_BASE_FUNC(PyScrolledWindow, Validate); | |
573 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocus); | |
574 | %MAKE_BASE_FUNC(PyScrolledWindow, AcceptsFocusFromKeyboard); | |
575 | %MAKE_BASE_FUNC(PyScrolledWindow, GetMaxSize); | |
576 | %MAKE_BASE_FUNC(PyScrolledWindow, AddChild); | |
577 | %MAKE_BASE_FUNC(PyScrolledWindow, RemoveChild); | |
578 | %MAKE_BASE_FUNC(PyScrolledWindow, ShouldInheritColours); | |
579 | %MAKE_BASE_FUNC(PyScrolledWindow, GetDefaultAttributes); | |
580 | %MAKE_BASE_FUNC(PyScrolledWindow, OnInternalIdle); | |
37617433 | 581 | |
d14a1e28 RD |
582 | }; |
583 | ||
584 | ||
585 | //--------------------------------------------------------------------------- | |
586 | //--------------------------------------------------------------------------- |