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