]>
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 | ||
50 | // TODO: Virtualize ShouldInheritColours | |
51 | ||
52 | //--------------------------------------------------------------------------- | |
53 | ||
54 | ||
55 | %{ // C++ version of Python aware wxWindow | |
56 | class wxPyWindow : public wxWindow | |
57 | { | |
58 | DECLARE_DYNAMIC_CLASS(wxPyWindow) | |
59 | public: | |
60 | wxPyWindow() : wxWindow() {} | |
61 | wxPyWindow(wxWindow* parent, const wxWindowID id, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | long style = 0, | |
65 | const wxString& name = wxPyPanelNameStr) | |
66 | : wxWindow(parent, id, pos, size, style, name) {} | |
67 | ||
68 | ||
69 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); | |
70 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
71 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
72 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
73 | ||
74 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
75 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
76 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
77 | ||
78 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
79 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
80 | ||
81 | DEC_PYCALLBACK__(InitDialog); | |
82 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
83 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
84 | DEC_PYCALLBACK_BOOL_(Validate); | |
85 | ||
86 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
87 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
88 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
89 | ||
90 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
91 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
92 | ||
4d2962b1 RD |
93 | DEC_PYCALLBACK_BOOL_(ShouldInheritColours); |
94 | ||
d14a1e28 RD |
95 | PYPRIVATE; |
96 | }; | |
97 | ||
98 | IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow); | |
99 | ||
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); | |
104 | ||
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); | |
108 | ||
109 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize); | |
110 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize); | |
111 | ||
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); | |
116 | ||
117 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus); | |
118 | IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard); | |
119 | IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize); | |
120 | ||
121 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild); | |
122 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild); | |
123 | ||
4d2962b1 | 124 | IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, ShouldInheritColours); |
d14a1e28 RD |
125 | %} |
126 | ||
127 | // And now the one for SWIG to see | |
128 | class wxPyWindow : public wxWindow | |
129 | { | |
130 | public: | |
2b9048c5 | 131 | %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)" |
d14a1e28 RD |
132 | |
133 | wxPyWindow(wxWindow* parent, const wxWindowID id, | |
134 | const wxPoint& pos = wxDefaultPosition, | |
135 | const wxSize& size = wxDefaultSize, | |
136 | long style = 0, | |
137 | const wxString& name = wxPyPanelNameStr); | |
138 | ||
139 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
140 | ||
141 | ||
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 ); | |
147 | ||
322913ce RD |
148 | DocDeclA( |
149 | void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, | |
150 | "base_DoGetSize() -> (width, height)"); | |
151 | DocDeclA( | |
152 | void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, | |
153 | "base_DoGetClientSize() -> (width, height)"); | |
154 | DocDeclA( | |
155 | void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, | |
156 | "base_DoGetPosition() -> (x,y)"); | |
d14a1e28 RD |
157 | |
158 | wxSize base_DoGetVirtualSize() const; | |
159 | wxSize base_DoGetBestSize() const; | |
160 | ||
161 | void base_InitDialog(); | |
162 | bool base_TransferDataToWindow(); | |
163 | bool base_TransferDataFromWindow(); | |
164 | bool base_Validate(); | |
165 | ||
166 | bool base_AcceptsFocus() const; | |
167 | bool base_AcceptsFocusFromKeyboard() const; | |
168 | wxSize base_GetMaxSize() const; | |
169 | ||
170 | void base_AddChild(wxWindow* child); | |
171 | void base_RemoveChild(wxWindow* child); | |
172 | }; | |
173 | ||
174 | //--------------------------------------------------------------------------- | |
175 | // Do the same thing for wxControl | |
176 | ||
177 | // ** See _pycontrol.i, it was moved there because of dependency on wxControl | |
178 | ||
179 | ||
180 | //--------------------------------------------------------------------------- | |
181 | // and for wxPanel | |
182 | ||
183 | %{ // C++ version of Python aware wxPanel | |
184 | class wxPyPanel : public wxPanel | |
185 | { | |
186 | DECLARE_DYNAMIC_CLASS(wxPyPanel) | |
187 | public: | |
188 | wxPyPanel() : wxPanel() {} | |
189 | wxPyPanel(wxWindow* parent, const wxWindowID id, | |
190 | const wxPoint& pos = wxDefaultPosition, | |
191 | const wxSize& size = wxDefaultSize, | |
192 | long style = 0, | |
193 | const wxString& name = wxPyPanelNameStr) | |
194 | : wxPanel(parent, id, pos, size, style, name) {} | |
195 | ||
196 | ||
197 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); | |
198 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
199 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
200 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
201 | ||
202 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
203 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
204 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
205 | ||
206 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
207 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
208 | ||
209 | DEC_PYCALLBACK__(InitDialog); | |
210 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
211 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
212 | DEC_PYCALLBACK_BOOL_(Validate); | |
213 | ||
214 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
215 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
216 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
217 | ||
218 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
219 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
220 | ||
4d2962b1 RD |
221 | DEC_PYCALLBACK_BOOL_(ShouldInheritColours); |
222 | ||
d14a1e28 RD |
223 | PYPRIVATE; |
224 | }; | |
225 | ||
226 | IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel); | |
227 | ||
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); | |
232 | ||
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); | |
236 | ||
237 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize); | |
238 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize); | |
239 | ||
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); | |
244 | ||
245 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus); | |
246 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard); | |
247 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize); | |
248 | ||
249 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild); | |
250 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild); | |
251 | ||
4d2962b1 | 252 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, ShouldInheritColours); |
d14a1e28 RD |
253 | %} |
254 | ||
255 | // And now the one for SWIG to see | |
256 | class wxPyPanel : public wxPanel | |
257 | { | |
258 | public: | |
2b9048c5 | 259 | %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)" |
d14a1e28 RD |
260 | |
261 | wxPyPanel(wxWindow* parent, const wxWindowID id, | |
262 | const wxPoint& pos = wxDefaultPosition, | |
263 | const wxSize& size = wxDefaultSize, | |
264 | long style = 0, | |
265 | const wxString& name = wxPyPanelNameStr); | |
266 | ||
267 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
268 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)" | |
269 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
270 | ||
271 | ||
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 ); | |
277 | ||
322913ce RD |
278 | DocDeclA( |
279 | void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const, | |
280 | "base_DoGetSize() -> (width, height)"); | |
281 | DocDeclA( | |
282 | void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const, | |
283 | "base_DoGetClientSize() -> (width, height)"); | |
284 | DocDeclA( | |
285 | void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const, | |
286 | "base_DoGetPosition() -> (x,y)"); | |
d14a1e28 RD |
287 | |
288 | wxSize base_DoGetVirtualSize() const; | |
289 | wxSize base_DoGetBestSize() const; | |
290 | ||
291 | void base_InitDialog(); | |
292 | bool base_TransferDataToWindow(); | |
293 | bool base_TransferDataFromWindow(); | |
294 | bool base_Validate(); | |
295 | ||
296 | bool base_AcceptsFocus() const; | |
297 | bool base_AcceptsFocusFromKeyboard() const; | |
298 | wxSize base_GetMaxSize() const; | |
299 | ||
300 | void base_AddChild(wxWindow* child); | |
301 | void base_RemoveChild(wxWindow* child); | |
302 | }; | |
303 | ||
304 | ||
305 | //--------------------------------------------------------------------------- | |
306 | //--------------------------------------------------------------------------- |