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