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_VIZATTR_(GetDefaultAttributes);
95 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
100 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
102 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
103 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
104 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
105 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
107 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
108 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
109 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
111 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
112 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
114 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
115 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
116 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
117 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
119 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
120 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
121 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
123 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
124 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
126 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, ShouldInheritColours);
127 IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes);
129 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, HasTransparentBackground);
132 // And now the one for SWIG to see
133 MustHaveApp(wxPyWindow);
134 class wxPyWindow : public wxWindow
137 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
138 %pythonAppend wxPyWindow() ""
140 wxPyWindow(wxWindow* parent, const wxWindowID id=-1,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
144 const wxString& name = wxPyPanelNameStr);
146 %RenameCtor(PrePyWindow, wxPyWindow());
148 void _setCallbackInfo(PyObject* self, PyObject* _class);
151 void SetBestSize(const wxSize& size);
153 void base_DoMoveWindow(int x, int y, int width, int height);
154 void base_DoSetSize(int x, int y, int width, int height,
155 int sizeFlags = wxSIZE_AUTO);
156 void base_DoSetClientSize(int width, int height);
157 void base_DoSetVirtualSize( int x, int y );
160 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
161 "base_DoGetSize() -> (width, height)");
163 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
164 "base_DoGetClientSize() -> (width, height)");
166 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
167 "base_DoGetPosition() -> (x,y)");
169 wxSize base_DoGetVirtualSize() const;
170 wxSize base_DoGetBestSize() const;
172 void base_InitDialog();
173 bool base_TransferDataToWindow();
174 bool base_TransferDataFromWindow();
175 bool base_Validate();
177 bool base_AcceptsFocus() const;
178 bool base_AcceptsFocusFromKeyboard() const;
179 wxSize base_GetMaxSize() const;
181 void base_AddChild(wxWindow* child);
182 void base_RemoveChild(wxWindow* child);
184 bool base_ShouldInheritColours() const;
185 wxVisualAttributes base_GetDefaultAttributes();
188 //---------------------------------------------------------------------------
189 // Do the same thing for wxControl
191 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
194 //---------------------------------------------------------------------------
197 %{ // C++ version of Python aware wxPanel
198 class wxPyPanel : public wxPanel
200 DECLARE_DYNAMIC_CLASS(wxPyPanel)
202 wxPyPanel() : wxPanel() {}
203 wxPyPanel(wxWindow* parent, const wxWindowID id,
204 const wxPoint& pos = wxDefaultPosition,
205 const wxSize& size = wxDefaultSize,
207 const wxString& name = wxPyPanelNameStr)
208 : wxPanel(parent, id, pos, size, style, name) {}
210 void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); }
213 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
214 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
215 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
216 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
218 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
219 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
220 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
222 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
223 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
225 DEC_PYCALLBACK__(InitDialog);
226 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
227 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
228 DEC_PYCALLBACK_BOOL_(Validate);
230 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
231 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
232 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
234 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
235 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
237 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
238 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
240 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
245 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
247 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
248 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
249 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
250 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
252 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
253 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
254 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
256 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
257 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
259 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
260 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
261 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
262 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
264 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
265 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
266 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
268 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
269 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
271 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours);
272 IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes);
274 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, HasTransparentBackground);
277 // And now the one for SWIG to see
278 MustHaveApp(wxPyPanel);
279 class wxPyPanel : public wxPanel
282 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
283 %pythonAppend wxPyPanel() ""
285 wxPyPanel(wxWindow* parent, const wxWindowID id=-1,
286 const wxPoint& pos = wxDefaultPosition,
287 const wxSize& size = wxDefaultSize,
289 const wxString& name = wxPyPanelNameStr);
291 %RenameCtor(PrePyPanel, wxPyPanel());
293 void _setCallbackInfo(PyObject* self, PyObject* _class);
295 void SetBestSize(const wxSize& size);
297 void base_DoMoveWindow(int x, int y, int width, int height);
298 void base_DoSetSize(int x, int y, int width, int height,
299 int sizeFlags = wxSIZE_AUTO);
300 void base_DoSetClientSize(int width, int height);
301 void base_DoSetVirtualSize( int x, int y );
304 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
305 "base_DoGetSize() -> (width, height)");
307 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
308 "base_DoGetClientSize() -> (width, height)");
310 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
311 "base_DoGetPosition() -> (x,y)");
313 wxSize base_DoGetVirtualSize() const;
314 wxSize base_DoGetBestSize() const;
316 void base_InitDialog();
317 bool base_TransferDataToWindow();
318 bool base_TransferDataFromWindow();
319 bool base_Validate();
321 bool base_AcceptsFocus() const;
322 bool base_AcceptsFocusFromKeyboard() const;
323 wxSize base_GetMaxSize() const;
325 void base_AddChild(wxWindow* child);
326 void base_RemoveChild(wxWindow* child);
328 bool base_ShouldInheritColours() const ;
329 wxVisualAttributes base_GetDefaultAttributes();
332 //---------------------------------------------------------------------------
333 // and for wxScrolledWindow
335 %{ // C++ version of Python aware wxScrolledWindow
336 class wxPyScrolledWindow : public wxScrolledWindow
338 DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow)
340 wxPyScrolledWindow() : wxScrolledWindow() {}
341 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
342 const wxPoint& pos = wxDefaultPosition,
343 const wxSize& size = wxDefaultSize,
345 const wxString& name = wxPyPanelNameStr)
346 : wxScrolledWindow(parent, id, pos, size, style, name) {}
348 void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); }
350 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
351 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
352 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
353 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
355 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
356 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
357 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
359 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
360 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
362 DEC_PYCALLBACK__(InitDialog);
363 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
364 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
365 DEC_PYCALLBACK_BOOL_(Validate);
367 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
368 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
369 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
371 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
372 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
374 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
375 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
377 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
382 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
384 IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow);
385 IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize);
386 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize);
387 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize);
389 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize);
390 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize);
391 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition);
393 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
394 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
396 IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog);
397 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow);
398 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow);
399 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate);
401 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
402 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
403 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
405 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
406 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
408 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
409 IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes);
411 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, HasTransparentBackground);
414 // And now the one for SWIG to see
415 MustHaveApp(wxPyScrolledWindow);
416 class wxPyScrolledWindow : public wxScrolledWindow
419 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
420 %pythonAppend wxPyScrolledWindow() ""
422 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id=-1,
423 const wxPoint& pos = wxDefaultPosition,
424 const wxSize& size = wxDefaultSize,
426 const wxString& name = wxPyPanelNameStr);
428 %RenameCtor(PrePyScrolledWindow, wxPyScrolledWindow());
430 void _setCallbackInfo(PyObject* self, PyObject* _class);
432 void SetBestSize(const wxSize& size);
434 void base_DoMoveWindow(int x, int y, int width, int height);
435 void base_DoSetSize(int x, int y, int width, int height,
436 int sizeFlags = wxSIZE_AUTO);
437 void base_DoSetClientSize(int width, int height);
438 void base_DoSetVirtualSize( int x, int y );
441 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
442 "base_DoGetSize() -> (width, height)");
444 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
445 "base_DoGetClientSize() -> (width, height)");
447 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
448 "base_DoGetPosition() -> (x,y)");
450 wxSize base_DoGetVirtualSize() const;
451 wxSize base_DoGetBestSize() const;
453 void base_InitDialog();
454 bool base_TransferDataToWindow();
455 bool base_TransferDataFromWindow();
456 bool base_Validate();
458 bool base_AcceptsFocus() const;
459 bool base_AcceptsFocusFromKeyboard() const;
460 wxSize base_GetMaxSize() const;
462 void base_AddChild(wxWindow* child);
463 void base_RemoveChild(wxWindow* child);
465 bool base_ShouldInheritColours() const;
466 wxVisualAttributes base_GetDefaultAttributes();
470 //---------------------------------------------------------------------------
471 //---------------------------------------------------------------------------