1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface for wxPyWindow, and etc. These classes support
4 // overriding many of wxWindow's virtual methods in Python derived
9 // Created: 2-June-1998
11 // Copyright: (c) 2003 by Total Control Software
12 // Licence: wxWindows license
13 /////////////////////////////////////////////////////////////////////////////
18 //---------------------------------------------------------------------------
21 // TODO: Redo these with SWIG directors?
23 // TODO: Which (if any?) of these should be done also???
37 // GetClientAreaOrigin
40 // SetBackgroundColour
44 // SetForegroundColour
46 // SetVirtualSizeHints
50 //---------------------------------------------------------------------------
53 %{ // C++ version of Python aware wxWindow
54 class wxPyWindow : public wxWindow
56 DECLARE_DYNAMIC_CLASS(wxPyWindow)
58 wxPyWindow() : wxWindow() {}
59 wxPyWindow(wxWindow* parent, const wxWindowID id,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
63 const wxString& name = wxPyPanelNameStr)
64 : wxWindow(parent, id, pos, size, style, name) {}
66 void SetBestSize(const wxSize& size) { wxWindow::SetBestSize(size); }
68 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
69 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
70 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
71 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
73 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
74 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
75 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
77 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
78 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
80 DEC_PYCALLBACK__(InitDialog);
81 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
82 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
83 DEC_PYCALLBACK_BOOL_(Validate);
85 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
86 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
87 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
89 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
90 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
92 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
93 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
94 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
99 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
101 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
102 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
103 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
104 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
106 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
107 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
108 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
110 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
111 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
113 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
114 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
115 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
116 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
118 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
119 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
120 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
122 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
123 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
125 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, ShouldInheritColours);
126 IMP_PYCALLBACK__COLOUR(wxPyWindow, wxWindow, ApplyParentThemeBackground);
127 IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes);
131 // And now the one for SWIG to see
132 class wxPyWindow : public wxWindow
135 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
136 %pythonAppend wxPyWindow() ""
138 wxPyWindow(wxWindow* parent, const wxWindowID id,
139 const wxPoint& pos = wxDefaultPosition,
140 const wxSize& size = wxDefaultSize,
142 const wxString& name = wxPyPanelNameStr);
144 %name(PrePyWindow) wxPyWindow();
146 void _setCallbackInfo(PyObject* self, PyObject* _class);
149 void SetBestSize(const wxSize& size);
151 void base_DoMoveWindow(int x, int y, int width, int height);
152 void base_DoSetSize(int x, int y, int width, int height,
153 int sizeFlags = wxSIZE_AUTO);
154 void base_DoSetClientSize(int width, int height);
155 void base_DoSetVirtualSize( int x, int y );
158 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
159 "base_DoGetSize() -> (width, height)");
161 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
162 "base_DoGetClientSize() -> (width, height)");
164 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
165 "base_DoGetPosition() -> (x,y)");
167 wxSize base_DoGetVirtualSize() const;
168 wxSize base_DoGetBestSize() const;
170 void base_InitDialog();
171 bool base_TransferDataToWindow();
172 bool base_TransferDataFromWindow();
173 bool base_Validate();
175 bool base_AcceptsFocus() const;
176 bool base_AcceptsFocusFromKeyboard() const;
177 wxSize base_GetMaxSize() const;
179 void base_AddChild(wxWindow* child);
180 void base_RemoveChild(wxWindow* child);
182 bool base_ShouldInheritColours() const;
183 void base_ApplyParentThemeBackground(const wxColour& c);
184 wxVisualAttributes base_GetDefaultAttributes();
187 //---------------------------------------------------------------------------
188 // Do the same thing for wxControl
190 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
193 //---------------------------------------------------------------------------
196 %{ // C++ version of Python aware wxPanel
197 class wxPyPanel : public wxPanel
199 DECLARE_DYNAMIC_CLASS(wxPyPanel)
201 wxPyPanel() : wxPanel() {}
202 wxPyPanel(wxWindow* parent, const wxWindowID id,
203 const wxPoint& pos = wxDefaultPosition,
204 const wxSize& size = wxDefaultSize,
206 const wxString& name = wxPyPanelNameStr)
207 : wxPanel(parent, id, pos, size, style, name) {}
209 void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); }
212 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
213 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
214 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
215 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
217 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
218 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
219 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
221 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
222 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
224 DEC_PYCALLBACK__(InitDialog);
225 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
226 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
227 DEC_PYCALLBACK_BOOL_(Validate);
229 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
230 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
231 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
233 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
234 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
236 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
237 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
238 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
243 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
245 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
246 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
247 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
248 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
250 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
251 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
252 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
254 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
255 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
257 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
258 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
259 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
260 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
262 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
263 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
264 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
266 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
267 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
269 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours);
270 IMP_PYCALLBACK__COLOUR(wxPyPanel, wxPanel, ApplyParentThemeBackground);
271 IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes);
275 // And now the one for SWIG to see
276 class wxPyPanel : public wxPanel
279 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
280 %pythonAppend wxPyPanel() ""
282 wxPyPanel(wxWindow* parent, const wxWindowID id,
283 const wxPoint& pos = wxDefaultPosition,
284 const wxSize& size = wxDefaultSize,
286 const wxString& name = wxPyPanelNameStr);
288 %name(PrePyPanel) wxPyPanel();
290 void _setCallbackInfo(PyObject* self, PyObject* _class);
292 void SetBestSize(const wxSize& size);
294 void base_DoMoveWindow(int x, int y, int width, int height);
295 void base_DoSetSize(int x, int y, int width, int height,
296 int sizeFlags = wxSIZE_AUTO);
297 void base_DoSetClientSize(int width, int height);
298 void base_DoSetVirtualSize( int x, int y );
301 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
302 "base_DoGetSize() -> (width, height)");
304 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
305 "base_DoGetClientSize() -> (width, height)");
307 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
308 "base_DoGetPosition() -> (x,y)");
310 wxSize base_DoGetVirtualSize() const;
311 wxSize base_DoGetBestSize() const;
313 void base_InitDialog();
314 bool base_TransferDataToWindow();
315 bool base_TransferDataFromWindow();
316 bool base_Validate();
318 bool base_AcceptsFocus() const;
319 bool base_AcceptsFocusFromKeyboard() const;
320 wxSize base_GetMaxSize() const;
322 void base_AddChild(wxWindow* child);
323 void base_RemoveChild(wxWindow* child);
325 bool base_ShouldInheritColours() const ;
326 void base_ApplyParentThemeBackground(const wxColour& c);
327 wxVisualAttributes base_GetDefaultAttributes();
330 //---------------------------------------------------------------------------
331 // and for wxScrolledWindow
333 %{ // C++ version of Python aware wxScrolledWindow
334 class wxPyScrolledWindow : public wxScrolledWindow
336 DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow)
338 wxPyScrolledWindow() : wxScrolledWindow() {}
339 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
340 const wxPoint& pos = wxDefaultPosition,
341 const wxSize& size = wxDefaultSize,
343 const wxString& name = wxPyPanelNameStr)
344 : wxScrolledWindow(parent, id, pos, size, style, name) {}
346 void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); }
348 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
349 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
350 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
351 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
353 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
354 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
355 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
357 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
358 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
360 DEC_PYCALLBACK__(InitDialog);
361 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
362 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
363 DEC_PYCALLBACK_BOOL_(Validate);
365 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
366 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
367 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
369 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
370 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
372 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
373 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
374 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
379 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
381 IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow);
382 IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize);
383 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize);
384 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize);
386 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize);
387 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize);
388 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition);
390 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
391 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
393 IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog);
394 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow);
395 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow);
396 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate);
398 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
399 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
400 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
402 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
403 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
405 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
406 IMP_PYCALLBACK__COLOUR(wxPyScrolledWindow, wxScrolledWindow, ApplyParentThemeBackground);
407 IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes);
411 // And now the one for SWIG to see
412 class wxPyScrolledWindow : public wxScrolledWindow
415 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
416 %pythonAppend wxPyScrolledWindow() ""
418 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
419 const wxPoint& pos = wxDefaultPosition,
420 const wxSize& size = wxDefaultSize,
422 const wxString& name = wxPyPanelNameStr);
424 %name(PrePyScrolledWindow) wxPyScrolledWindow();
426 void _setCallbackInfo(PyObject* self, PyObject* _class);
428 void SetBestSize(const wxSize& size);
430 void base_DoMoveWindow(int x, int y, int width, int height);
431 void base_DoSetSize(int x, int y, int width, int height,
432 int sizeFlags = wxSIZE_AUTO);
433 void base_DoSetClientSize(int width, int height);
434 void base_DoSetVirtualSize( int x, int y );
437 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
438 "base_DoGetSize() -> (width, height)");
440 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
441 "base_DoGetClientSize() -> (width, height)");
443 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
444 "base_DoGetPosition() -> (x,y)");
446 wxSize base_DoGetVirtualSize() const;
447 wxSize base_DoGetBestSize() const;
449 void base_InitDialog();
450 bool base_TransferDataToWindow();
451 bool base_TransferDataFromWindow();
452 bool base_Validate();
454 bool base_AcceptsFocus() const;
455 bool base_AcceptsFocusFromKeyboard() const;
456 wxSize base_GetMaxSize() const;
458 void base_AddChild(wxWindow* child);
459 void base_RemoveChild(wxWindow* child);
461 bool base_ShouldInheritColours() const;
462 void base_ApplyParentThemeBackground(const wxColour& c);
463 wxVisualAttributes base_GetDefaultAttributes();
467 //---------------------------------------------------------------------------
468 //---------------------------------------------------------------------------