]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_pywindows.i
Updated layout test
[wxWidgets.git] / wxPython / src / _pywindows.i
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
93 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
94 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
95
96 PYPRIVATE;
97 };
98
99 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
100
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);
105
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);
109
110 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
111 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
112
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);
117
118 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
119 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
120 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
121
122 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
123 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
124
125 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, ShouldInheritColours);
126 IMP_PYCALLBACK__COLOUR(wxPyWindow, wxWindow, ApplyParentThemeBackground);
127
128 %}
129
130 // And now the one for SWIG to see
131 class wxPyWindow : public wxWindow
132 {
133 public:
134 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
135 %pythonAppend wxPyWindow() ""
136
137 wxPyWindow(wxWindow* parent, const wxWindowID id,
138 const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize,
140 long style = 0,
141 const wxString& name = wxPyPanelNameStr);
142
143 %name(PrePyWindow) wxPyWindow();
144
145 void _setCallbackInfo(PyObject* self, PyObject* _class);
146
147
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 );
153
154 DocDeclA(
155 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
156 "base_DoGetSize() -> (width, height)");
157 DocDeclA(
158 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
159 "base_DoGetClientSize() -> (width, height)");
160 DocDeclA(
161 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
162 "base_DoGetPosition() -> (x,y)");
163
164 wxSize base_DoGetVirtualSize() const;
165 wxSize base_DoGetBestSize() const;
166
167 void base_InitDialog();
168 bool base_TransferDataToWindow();
169 bool base_TransferDataFromWindow();
170 bool base_Validate();
171
172 bool base_AcceptsFocus() const;
173 bool base_AcceptsFocusFromKeyboard() const;
174 wxSize base_GetMaxSize() const;
175
176 void base_AddChild(wxWindow* child);
177 void base_RemoveChild(wxWindow* child);
178
179 bool base_ShouldInheritColours();
180 void base_ApplyParentThemeBackground(const wxColour& c);
181 };
182
183 //---------------------------------------------------------------------------
184 // Do the same thing for wxControl
185
186 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
187
188
189 //---------------------------------------------------------------------------
190 // and for wxPanel
191
192 %{ // C++ version of Python aware wxPanel
193 class wxPyPanel : public wxPanel
194 {
195 DECLARE_DYNAMIC_CLASS(wxPyPanel)
196 public:
197 wxPyPanel() : wxPanel() {}
198 wxPyPanel(wxWindow* parent, const wxWindowID id,
199 const wxPoint& pos = wxDefaultPosition,
200 const wxSize& size = wxDefaultSize,
201 long style = 0,
202 const wxString& name = wxPyPanelNameStr)
203 : wxPanel(parent, id, pos, size, style, name) {}
204
205
206 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
207 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
208 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
209 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
210
211 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
212 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
213 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
214
215 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
216 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
217
218 DEC_PYCALLBACK__(InitDialog);
219 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
220 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
221 DEC_PYCALLBACK_BOOL_(Validate);
222
223 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
224 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
225 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
226
227 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
228 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
229
230 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
231 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
232
233 PYPRIVATE;
234 };
235
236 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
237
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);
242
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);
246
247 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
248 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
249
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);
254
255 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
256 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
257 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
258
259 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
260 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
261
262 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, ShouldInheritColours);
263 IMP_PYCALLBACK__COLOUR(wxPyPanel, wxPanel, ApplyParentThemeBackground);
264 %}
265
266 // And now the one for SWIG to see
267 class wxPyPanel : public wxPanel
268 {
269 public:
270 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
271 %pythonAppend wxPyPanel() ""
272
273 wxPyPanel(wxWindow* parent, const wxWindowID id,
274 const wxPoint& pos = wxDefaultPosition,
275 const wxSize& size = wxDefaultSize,
276 long style = 0,
277 const wxString& name = wxPyPanelNameStr);
278
279 %name(PrePyPanel) wxPyPanel();
280
281 void _setCallbackInfo(PyObject* self, PyObject* _class);
282
283
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 );
289
290 DocDeclA(
291 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
292 "base_DoGetSize() -> (width, height)");
293 DocDeclA(
294 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
295 "base_DoGetClientSize() -> (width, height)");
296 DocDeclA(
297 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
298 "base_DoGetPosition() -> (x,y)");
299
300 wxSize base_DoGetVirtualSize() const;
301 wxSize base_DoGetBestSize() const;
302
303 void base_InitDialog();
304 bool base_TransferDataToWindow();
305 bool base_TransferDataFromWindow();
306 bool base_Validate();
307
308 bool base_AcceptsFocus() const;
309 bool base_AcceptsFocusFromKeyboard() const;
310 wxSize base_GetMaxSize() const;
311
312 void base_AddChild(wxWindow* child);
313 void base_RemoveChild(wxWindow* child);
314
315 bool base_ShouldInheritColours();
316 void base_ApplyParentThemeBackground(const wxColour& c);
317 };
318
319 //---------------------------------------------------------------------------
320 // and for wxScrolledWindow
321
322 %{ // C++ version of Python aware wxScrolledWindow
323 class wxPyScrolledWindow : public wxScrolledWindow
324 {
325 DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow)
326 public:
327 wxPyScrolledWindow() : wxScrolledWindow() {}
328 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
329 const wxPoint& pos = wxDefaultPosition,
330 const wxSize& size = wxDefaultSize,
331 long style = 0,
332 const wxString& name = wxPyPanelNameStr)
333 : wxScrolledWindow(parent, id, pos, size, style, name) {}
334
335
336 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
337 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
338 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
339 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
340
341 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
342 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
343 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
344
345 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
346 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
347
348 DEC_PYCALLBACK__(InitDialog);
349 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
350 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
351 DEC_PYCALLBACK_BOOL_(Validate);
352
353 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
354 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
355 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
356
357 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
358 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
359
360 DEC_PYCALLBACK_BOOL_(ShouldInheritColours);
361 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
362
363 PYPRIVATE;
364 };
365
366 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
367
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);
372
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);
376
377 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
378 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
379
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);
384
385 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
386 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
387 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
388
389 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
390 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
391
392 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
393 IMP_PYCALLBACK__COLOUR(wxPyScrolledWindow, wxScrolledWindow, ApplyParentThemeBackground);
394 %}
395
396 // And now the one for SWIG to see
397 class wxPyScrolledWindow : public wxScrolledWindow
398 {
399 public:
400 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
401 %pythonAppend wxPyScrolledWindow() ""
402
403 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
404 const wxPoint& pos = wxDefaultPosition,
405 const wxSize& size = wxDefaultSize,
406 long style = 0,
407 const wxString& name = wxPyPanelNameStr);
408
409 %name(PrePyScrolledWindow) wxPyScrolledWindow();
410
411 void _setCallbackInfo(PyObject* self, PyObject* _class);
412
413
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 );
419
420 DocDeclA(
421 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
422 "base_DoGetSize() -> (width, height)");
423 DocDeclA(
424 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
425 "base_DoGetClientSize() -> (width, height)");
426 DocDeclA(
427 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
428 "base_DoGetPosition() -> (x,y)");
429
430 wxSize base_DoGetVirtualSize() const;
431 wxSize base_DoGetBestSize() const;
432
433 void base_InitDialog();
434 bool base_TransferDataToWindow();
435 bool base_TransferDataFromWindow();
436 bool base_Validate();
437
438 bool base_AcceptsFocus() const;
439 bool base_AcceptsFocusFromKeyboard() const;
440 wxSize base_GetMaxSize() const;
441
442 void base_AddChild(wxWindow* child);
443 void base_RemoveChild(wxWindow* child);
444
445 bool base_ShouldInheritColours();
446 void base_ApplyParentThemeBackground(const wxColour& c);
447 };
448
449
450 //---------------------------------------------------------------------------
451 //---------------------------------------------------------------------------