]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_pywindows.i
Some change notes
[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 //---------------------------------------------------------------------------
51
52
53 %{ // C++ version of Python aware wxWindow
54 class wxPyWindow : public wxWindow
55 {
56 DECLARE_DYNAMIC_CLASS(wxPyWindow)
57 public:
58 wxPyWindow() : wxWindow() {}
59 wxPyWindow(wxWindow* parent, const wxWindowID id,
60 const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize,
62 long style = 0,
63 const wxString& name = wxPyPanelNameStr)
64 : wxWindow(parent, id, pos, size, style, name) {}
65
66 void SetBestSize(const wxSize& size) { wxWindow::SetBestSize(size); }
67
68 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
69 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
70 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
71 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
72
73 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
74 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
75 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
76
77 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
78 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
79
80 DEC_PYCALLBACK__(InitDialog);
81 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
82 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
83 DEC_PYCALLBACK_BOOL_(Validate);
84
85 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
86 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
87 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
88
89 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
90 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
91
92 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
93 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
94 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
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_const(wxPyWindow, wxWindow, ShouldInheritColours);
126 IMP_PYCALLBACK__COLOUR(wxPyWindow, wxWindow, ApplyParentThemeBackground);
127 IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes);
128
129 %}
130
131 // And now the one for SWIG to see
132 MustHaveApp(wxPyWindow);
133 class wxPyWindow : public wxWindow
134 {
135 public:
136 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
137 %pythonAppend wxPyWindow() ""
138
139 wxPyWindow(wxWindow* parent, const wxWindowID id=-1,
140 const wxPoint& pos = wxDefaultPosition,
141 const wxSize& size = wxDefaultSize,
142 long style = 0,
143 const wxString& name = wxPyPanelNameStr);
144
145 %name(PrePyWindow) wxPyWindow();
146
147 void _setCallbackInfo(PyObject* self, PyObject* _class);
148
149
150 void SetBestSize(const wxSize& size);
151
152 void base_DoMoveWindow(int x, int y, int width, int height);
153 void base_DoSetSize(int x, int y, int width, int height,
154 int sizeFlags = wxSIZE_AUTO);
155 void base_DoSetClientSize(int width, int height);
156 void base_DoSetVirtualSize( int x, int y );
157
158 DocDeclA(
159 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
160 "base_DoGetSize() -> (width, height)");
161 DocDeclA(
162 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
163 "base_DoGetClientSize() -> (width, height)");
164 DocDeclA(
165 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
166 "base_DoGetPosition() -> (x,y)");
167
168 wxSize base_DoGetVirtualSize() const;
169 wxSize base_DoGetBestSize() const;
170
171 void base_InitDialog();
172 bool base_TransferDataToWindow();
173 bool base_TransferDataFromWindow();
174 bool base_Validate();
175
176 bool base_AcceptsFocus() const;
177 bool base_AcceptsFocusFromKeyboard() const;
178 wxSize base_GetMaxSize() const;
179
180 void base_AddChild(wxWindow* child);
181 void base_RemoveChild(wxWindow* child);
182
183 bool base_ShouldInheritColours() const;
184 void base_ApplyParentThemeBackground(const wxColour& c);
185 wxVisualAttributes base_GetDefaultAttributes();
186 };
187
188 //---------------------------------------------------------------------------
189 // Do the same thing for wxControl
190
191 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
192
193
194 //---------------------------------------------------------------------------
195 // and for wxPanel
196
197 %{ // C++ version of Python aware wxPanel
198 class wxPyPanel : public wxPanel
199 {
200 DECLARE_DYNAMIC_CLASS(wxPyPanel)
201 public:
202 wxPyPanel() : wxPanel() {}
203 wxPyPanel(wxWindow* parent, const wxWindowID id,
204 const wxPoint& pos = wxDefaultPosition,
205 const wxSize& size = wxDefaultSize,
206 long style = 0,
207 const wxString& name = wxPyPanelNameStr)
208 : wxPanel(parent, id, pos, size, style, name) {}
209
210 void SetBestSize(const wxSize& size) { wxPanel::SetBestSize(size); }
211
212
213 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
214 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
215 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
216 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
217
218 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
219 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
220 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
221
222 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
223 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
224
225 DEC_PYCALLBACK__(InitDialog);
226 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
227 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
228 DEC_PYCALLBACK_BOOL_(Validate);
229
230 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
231 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
232 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
233
234 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
235 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
236
237 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
238 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
239 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
240
241 PYPRIVATE;
242 };
243
244 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
245
246 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
247 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
248 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
249 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
250
251 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
252 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
253 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
254
255 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
256 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
257
258 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
259 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
260 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
261 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
262
263 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
264 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
265 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
266
267 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
268 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
269
270 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours);
271 IMP_PYCALLBACK__COLOUR(wxPyPanel, wxPanel, ApplyParentThemeBackground);
272 IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes);
273
274 %}
275
276 // And now the one for SWIG to see
277 MustHaveApp(wxPyPanel);
278 class wxPyPanel : public wxPanel
279 {
280 public:
281 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
282 %pythonAppend wxPyPanel() ""
283
284 wxPyPanel(wxWindow* parent, const wxWindowID id=-1,
285 const wxPoint& pos = wxDefaultPosition,
286 const wxSize& size = wxDefaultSize,
287 long style = 0,
288 const wxString& name = wxPyPanelNameStr);
289
290 %name(PrePyPanel) wxPyPanel();
291
292 void _setCallbackInfo(PyObject* self, PyObject* _class);
293
294 void SetBestSize(const wxSize& size);
295
296 void base_DoMoveWindow(int x, int y, int width, int height);
297 void base_DoSetSize(int x, int y, int width, int height,
298 int sizeFlags = wxSIZE_AUTO);
299 void base_DoSetClientSize(int width, int height);
300 void base_DoSetVirtualSize( int x, int y );
301
302 DocDeclA(
303 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
304 "base_DoGetSize() -> (width, height)");
305 DocDeclA(
306 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
307 "base_DoGetClientSize() -> (width, height)");
308 DocDeclA(
309 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
310 "base_DoGetPosition() -> (x,y)");
311
312 wxSize base_DoGetVirtualSize() const;
313 wxSize base_DoGetBestSize() const;
314
315 void base_InitDialog();
316 bool base_TransferDataToWindow();
317 bool base_TransferDataFromWindow();
318 bool base_Validate();
319
320 bool base_AcceptsFocus() const;
321 bool base_AcceptsFocusFromKeyboard() const;
322 wxSize base_GetMaxSize() const;
323
324 void base_AddChild(wxWindow* child);
325 void base_RemoveChild(wxWindow* child);
326
327 bool base_ShouldInheritColours() const ;
328 void base_ApplyParentThemeBackground(const wxColour& c);
329 wxVisualAttributes base_GetDefaultAttributes();
330 };
331
332 //---------------------------------------------------------------------------
333 // and for wxScrolledWindow
334
335 %{ // C++ version of Python aware wxScrolledWindow
336 class wxPyScrolledWindow : public wxScrolledWindow
337 {
338 DECLARE_DYNAMIC_CLASS(wxPyScrolledWindow)
339 public:
340 wxPyScrolledWindow() : wxScrolledWindow() {}
341 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id,
342 const wxPoint& pos = wxDefaultPosition,
343 const wxSize& size = wxDefaultSize,
344 long style = 0,
345 const wxString& name = wxPyPanelNameStr)
346 : wxScrolledWindow(parent, id, pos, size, style, name) {}
347
348 void SetBestSize(const wxSize& size) { wxScrolledWindow::SetBestSize(size); }
349
350 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
351 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
352 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
353 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
354
355 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
356 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
357 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
358
359 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
360 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
361
362 DEC_PYCALLBACK__(InitDialog);
363 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
364 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
365 DEC_PYCALLBACK_BOOL_(Validate);
366
367 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
368 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
369 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
370
371 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
372 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
373
374 DEC_PYCALLBACK_BOOL_const(ShouldInheritColours);
375 DEC_PYCALLBACK__COLOUR(ApplyParentThemeBackground);
376 DEC_PYCALLBACK_VIZATTR_(GetDefaultAttributes);
377
378 PYPRIVATE;
379 };
380
381 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
382
383 IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow);
384 IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize);
385 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize);
386 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize);
387
388 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize);
389 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize);
390 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition);
391
392 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
393 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
394
395 IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog);
396 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow);
397 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow);
398 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate);
399
400 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
401 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
402 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
403
404 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
405 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
406
407 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
408 IMP_PYCALLBACK__COLOUR(wxPyScrolledWindow, wxScrolledWindow, ApplyParentThemeBackground);
409 IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes);
410
411 %}
412
413 // And now the one for SWIG to see
414 MustHaveApp(wxPyScrolledWindow);
415 class wxPyScrolledWindow : public wxScrolledWindow
416 {
417 public:
418 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
419 %pythonAppend wxPyScrolledWindow() ""
420
421 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id=-1,
422 const wxPoint& pos = wxDefaultPosition,
423 const wxSize& size = wxDefaultSize,
424 long style = 0,
425 const wxString& name = wxPyPanelNameStr);
426
427 %name(PrePyScrolledWindow) wxPyScrolledWindow();
428
429 void _setCallbackInfo(PyObject* self, PyObject* _class);
430
431 void SetBestSize(const wxSize& size);
432
433 void base_DoMoveWindow(int x, int y, int width, int height);
434 void base_DoSetSize(int x, int y, int width, int height,
435 int sizeFlags = wxSIZE_AUTO);
436 void base_DoSetClientSize(int width, int height);
437 void base_DoSetVirtualSize( int x, int y );
438
439 DocDeclA(
440 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
441 "base_DoGetSize() -> (width, height)");
442 DocDeclA(
443 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
444 "base_DoGetClientSize() -> (width, height)");
445 DocDeclA(
446 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
447 "base_DoGetPosition() -> (x,y)");
448
449 wxSize base_DoGetVirtualSize() const;
450 wxSize base_DoGetBestSize() const;
451
452 void base_InitDialog();
453 bool base_TransferDataToWindow();
454 bool base_TransferDataFromWindow();
455 bool base_Validate();
456
457 bool base_AcceptsFocus() const;
458 bool base_AcceptsFocusFromKeyboard() const;
459 wxSize base_GetMaxSize() const;
460
461 void base_AddChild(wxWindow* child);
462 void base_RemoveChild(wxWindow* child);
463
464 bool base_ShouldInheritColours() const;
465 void base_ApplyParentThemeBackground(const wxColour& c);
466 wxVisualAttributes base_GetDefaultAttributes();
467 };
468
469
470 //---------------------------------------------------------------------------
471 //---------------------------------------------------------------------------