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 // TODO: Virtualize ShouldInheritColours
52 //---------------------------------------------------------------------------
55 %{ // C++ version of Python aware wxWindow
56 class wxPyWindow : public wxWindow
58 DECLARE_DYNAMIC_CLASS(wxPyWindow)
60 wxPyWindow() : wxWindow() {}
61 wxPyWindow(wxWindow* parent, const wxWindowID id,
62 const wxPoint& pos = wxDefaultPosition,
63 const wxSize& size = wxDefaultSize,
65 const wxString& name = wxPyPanelNameStr)
66 : wxWindow(parent, id, pos, size, style, name) {}
69 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
70 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
71 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
72 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
74 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
75 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
76 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
78 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
79 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
81 DEC_PYCALLBACK__(InitDialog);
82 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
83 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
84 DEC_PYCALLBACK_BOOL_(Validate);
86 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
87 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
88 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
90 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
91 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
93 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
94 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
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_(wxPyWindow, wxWindow, ShouldInheritColours);
126 IMP_PYCALLBACK__COLOUR(wxPyWindow, wxWindow, ApplyParentThemeBackground);
130 // And now the one for SWIG to see
131 class wxPyWindow : public wxWindow
134 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
135 %pythonAppend wxPyWindow() ""
137 wxPyWindow(wxWindow* parent, const wxWindowID id,
138 const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize,
141 const wxString& name = wxPyPanelNameStr);
143 %name(PrePyWindow) wxPyWindow();
145 void _setCallbackInfo(PyObject* self, PyObject* _class);
148 void base_DoMoveWindow(int x, int y, int width, int height);
149 void base_DoSetSize(int x, int y, int width, int height,
150 int sizeFlags = wxSIZE_AUTO);
151 void base_DoSetClientSize(int width, int height);
152 void base_DoSetVirtualSize( int x, int y );
155 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
156 "base_DoGetSize() -> (width, height)");
158 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
159 "base_DoGetClientSize() -> (width, height)");
161 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
162 "base_DoGetPosition() -> (x,y)");
164 wxSize base_DoGetVirtualSize() const;
165 wxSize base_DoGetBestSize() const;
167 void base_InitDialog();
168 bool base_TransferDataToWindow();
169 bool base_TransferDataFromWindow();
170 bool base_Validate();
172 bool base_AcceptsFocus() const;
173 bool base_AcceptsFocusFromKeyboard() const;
174 wxSize base_GetMaxSize() const;
176 void base_AddChild(wxWindow* child);
177 void base_RemoveChild(wxWindow* child);
179 bool base_ShouldInheritColours();
180 void base_ApplyParentThemeBackground(const wxColour& c);
183 //---------------------------------------------------------------------------
184 // Do the same thing for wxControl
186 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
189 //---------------------------------------------------------------------------
192 %{ // C++ version of Python aware wxPanel
193 class wxPyPanel : public wxPanel
195 DECLARE_DYNAMIC_CLASS(wxPyPanel)
197 wxPyPanel() : wxPanel() {}
198 wxPyPanel(wxWindow* parent, const wxWindowID id,
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
202 const wxString& name = wxPyPanelNameStr)
203 : wxPanel(parent, id, pos, size, style, name) {}
206 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
207 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
208 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
209 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
211 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
212 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
213 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
215 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
216 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
218 DEC_PYCALLBACK__(InitDialog);
219 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
220 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
221 DEC_PYCALLBACK_BOOL_(Validate);
223 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
224 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
225 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
227 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
228 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
230 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
231 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
236 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
238 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
239 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
240 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
241 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
243 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
244 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
245 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
247 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
248 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
250 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
251 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
252 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
253 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
255 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
256 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
257 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
259 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
260 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
262 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, ShouldInheritColours);
263 IMP_PYCALLBACK__COLOUR(wxPyPanel, wxPanel, ApplyParentThemeBackground);
266 // And now the one for SWIG to see
267 class wxPyPanel : public wxPanel
270 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
271 %pythonAppend wxPyPanel() ""
273 wxPyPanel(wxWindow* parent, const wxWindowID id,
274 const wxPoint& pos = wxDefaultPosition,
275 const wxSize& size = wxDefaultSize,
277 const wxString& name = wxPyPanelNameStr);
279 %name(PrePyPanel) wxPyPanel();
281 void _setCallbackInfo(PyObject* self, PyObject* _class);
284 void base_DoMoveWindow(int x, int y, int width, int height);
285 void base_DoSetSize(int x, int y, int width, int height,
286 int sizeFlags = wxSIZE_AUTO);
287 void base_DoSetClientSize(int width, int height);
288 void base_DoSetVirtualSize( int x, int y );
291 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
292 "base_DoGetSize() -> (width, height)");
294 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
295 "base_DoGetClientSize() -> (width, height)");
297 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
298 "base_DoGetPosition() -> (x,y)");
300 wxSize base_DoGetVirtualSize() const;
301 wxSize base_DoGetBestSize() const;
303 void base_InitDialog();
304 bool base_TransferDataToWindow();
305 bool base_TransferDataFromWindow();
306 bool base_Validate();
308 bool base_AcceptsFocus() const;
309 bool base_AcceptsFocusFromKeyboard() const;
310 wxSize base_GetMaxSize() const;
312 void base_AddChild(wxWindow* child);
313 void base_RemoveChild(wxWindow* child);
315 bool base_ShouldInheritColours();
316 void base_ApplyParentThemeBackground(const wxColour& c);
319 //---------------------------------------------------------------------------
320 // and for wxScrolledWindow
322 %{ // C++ version of Python aware wxScrolledWindow
323 class wxPyScrolledWindow : public wxScrolledWindow
325 DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow)
327 wxPyScrolledWindow() : wxScrolledWindow() {}
328 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
329 const wxPoint& pos = wxDefaultPosition,
330 const wxSize& size = wxDefaultSize,
332 const wxString& name = wxPyPanelNameStr)
333 : wxScrolledWindow(parent, id, pos, size, style, name) {}
336 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
337 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
338 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
339 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
341 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
342 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
343 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
345 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
346 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
348 DEC_PYCALLBACK__(InitDialog);
349 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
350 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
351 DEC_PYCALLBACK_BOOL_(Validate);
353 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
354 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
355 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
357 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
358 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
360 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
361 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
366 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
368 IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow);
369 IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize);
370 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize);
371 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize);
373 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize);
374 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize);
375 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition);
377 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
378 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
380 IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog);
381 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow);
382 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow);
383 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate);
385 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
386 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
387 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
389 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
390 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
392 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
393 IMP_PYCALLBACK__COLOUR(wxPyScrolledWindow, wxScrolledWindow, ApplyParentThemeBackground);
396 // And now the one for SWIG to see
397 class wxPyScrolledWindow : public wxScrolledWindow
400 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
401 %pythonAppend wxPyScrolledWindow() ""
403 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
404 const wxPoint& pos = wxDefaultPosition,
405 const wxSize& size = wxDefaultSize,
407 const wxString& name = wxPyPanelNameStr);
409 %name(PrePyScrolledWindow) wxPyScrolledWindow();
411 void _setCallbackInfo(PyObject* self, PyObject* _class);
414 void base_DoMoveWindow(int x, int y, int width, int height);
415 void base_DoSetSize(int x, int y, int width, int height,
416 int sizeFlags = wxSIZE_AUTO);
417 void base_DoSetClientSize(int width, int height);
418 void base_DoSetVirtualSize( int x, int y );
421 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
422 "base_DoGetSize() -> (width, height)");
424 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
425 "base_DoGetClientSize() -> (width, height)");
427 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
428 "base_DoGetPosition() -> (x,y)");
430 wxSize base_DoGetVirtualSize() const;
431 wxSize base_DoGetBestSize() const;
433 void base_InitDialog();
434 bool base_TransferDataToWindow();
435 bool base_TransferDataFromWindow();
436 bool base_Validate();
438 bool base_AcceptsFocus() const;
439 bool base_AcceptsFocusFromKeyboard() const;
440 wxSize base_GetMaxSize() const;
442 void base_AddChild(wxWindow* child);
443 void base_RemoveChild(wxWindow* child);
445 bool base_ShouldInheritColours();
446 void base_ApplyParentThemeBackground(const wxColour& c);
450 //---------------------------------------------------------------------------
451 //---------------------------------------------------------------------------