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);
98 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
100 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
101 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
102 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
103 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
105 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
106 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
107 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
109 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
110 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
112 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
113 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
114 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
115 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
117 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
118 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
119 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
121 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
122 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
124 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, ShouldInheritColours);
127 // And now the one for SWIG to see
128 class wxPyWindow : public wxWindow
131 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
133 wxPyWindow(wxWindow* parent, const wxWindowID id,
134 const wxPoint& pos = wxDefaultPosition,
135 const wxSize& size = wxDefaultSize,
137 const wxString& name = wxPyPanelNameStr);
139 void _setCallbackInfo(PyObject* self, PyObject* _class);
142 void base_DoMoveWindow(int x, int y, int width, int height);
143 void base_DoSetSize(int x, int y, int width, int height,
144 int sizeFlags = wxSIZE_AUTO);
145 void base_DoSetClientSize(int width, int height);
146 void base_DoSetVirtualSize( int x, int y );
149 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
150 "base_DoGetSize() -> (width, height)");
152 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
153 "base_DoGetClientSize() -> (width, height)");
155 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
156 "base_DoGetPosition() -> (x,y)");
158 wxSize base_DoGetVirtualSize() const;
159 wxSize base_DoGetBestSize() const;
161 void base_InitDialog();
162 bool base_TransferDataToWindow();
163 bool base_TransferDataFromWindow();
164 bool base_Validate();
166 bool base_AcceptsFocus() const;
167 bool base_AcceptsFocusFromKeyboard() const;
168 wxSize base_GetMaxSize() const;
170 void base_AddChild(wxWindow* child);
171 void base_RemoveChild(wxWindow* child);
174 //---------------------------------------------------------------------------
175 // Do the same thing for wxControl
177 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
180 //---------------------------------------------------------------------------
183 %{ // C++ version of Python aware wxPanel
184 class wxPyPanel : public wxPanel
186 DECLARE_DYNAMIC_CLASS(wxPyPanel)
188 wxPyPanel() : wxPanel() {}
189 wxPyPanel(wxWindow* parent, const wxWindowID id,
190 const wxPoint& pos = wxDefaultPosition,
191 const wxSize& size = wxDefaultSize,
193 const wxString& name = wxPyPanelNameStr)
194 : wxPanel(parent, id, pos, size, style, name) {}
197 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
198 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
199 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
200 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
202 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
203 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
204 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
206 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
207 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
209 DEC_PYCALLBACK__(InitDialog);
210 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
211 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
212 DEC_PYCALLBACK_BOOL_(Validate);
214 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
215 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
216 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
218 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
219 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
221 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
226 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
228 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
229 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
230 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
231 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
233 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
234 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
235 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
237 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
238 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
240 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
241 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
242 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
243 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
245 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
246 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
247 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
249 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
250 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
252 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, ShouldInheritColours);
255 // And now the one for SWIG to see
256 class wxPyPanel : public wxPanel
259 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
261 wxPyPanel(wxWindow* parent, const wxWindowID id,
262 const wxPoint& pos = wxDefaultPosition,
263 const wxSize& size = wxDefaultSize,
265 const wxString& name = wxPyPanelNameStr);
267 void _setCallbackInfo(PyObject* self, PyObject* _class);
268 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)"
269 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
272 void base_DoMoveWindow(int x, int y, int width, int height);
273 void base_DoSetSize(int x, int y, int width, int height,
274 int sizeFlags = wxSIZE_AUTO);
275 void base_DoSetClientSize(int width, int height);
276 void base_DoSetVirtualSize( int x, int y );
279 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
280 "base_DoGetSize() -> (width, height)");
282 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
283 "base_DoGetClientSize() -> (width, height)");
285 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
286 "base_DoGetPosition() -> (x,y)");
288 wxSize base_DoGetVirtualSize() const;
289 wxSize base_DoGetBestSize() const;
291 void base_InitDialog();
292 bool base_TransferDataToWindow();
293 bool base_TransferDataFromWindow();
294 bool base_Validate();
296 bool base_AcceptsFocus() const;
297 bool base_AcceptsFocusFromKeyboard() const;
298 wxSize base_GetMaxSize() const;
300 void base_AddChild(wxWindow* child);
301 void base_RemoveChild(wxWindow* child);
305 //---------------------------------------------------------------------------
306 //---------------------------------------------------------------------------