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