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