]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_pywindows.i
Added missing CacheBestSize
[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_VIZATTR_(GetDefaultAttributes);
94
95 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
96
97 PYPRIVATE;
98 };
99
100 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
101
102 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
103 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
104 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
105 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
106
107 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
108 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
109 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
110
111 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
112 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
113
114 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
115 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
116 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
117 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
118
119 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
120 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
121 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
122
123 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
124 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
125
126 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, ShouldInheritColours);
127 IMP_PYCALLBACK_VIZATTR_(wxPyWindow, wxWindow, GetDefaultAttributes);
128
129 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, HasTransparentBackground);
130 %}
131
132 // And now the one for SWIG to see
133 MustHaveApp(wxPyWindow);
134 class wxPyWindow : public wxWindow
135 {
136 public:
137 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
138 %pythonAppend wxPyWindow() ""
139
140 wxPyWindow(wxWindow* parent, const wxWindowID id=-1,
141 const wxPoint& pos = wxDefaultPosition,
142 const wxSize& size = wxDefaultSize,
143 long style = 0,
144 const wxString& name = wxPyPanelNameStr);
145
146 %RenameCtor(PrePyWindow, wxPyWindow());
147
148 void _setCallbackInfo(PyObject* self, PyObject* _class);
149
150
151 void SetBestSize(const wxSize& size);
152
153 void base_DoMoveWindow(int x, int y, int width, int height);
154 void base_DoSetSize(int x, int y, int width, int height,
155 int sizeFlags = wxSIZE_AUTO);
156 void base_DoSetClientSize(int width, int height);
157 void base_DoSetVirtualSize( int x, int y );
158
159 DocDeclA(
160 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
161 "base_DoGetSize() -> (width, height)");
162 DocDeclA(
163 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
164 "base_DoGetClientSize() -> (width, height)");
165 DocDeclA(
166 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
167 "base_DoGetPosition() -> (x,y)");
168
169 wxSize base_DoGetVirtualSize() const;
170 wxSize base_DoGetBestSize() const;
171
172 void base_InitDialog();
173 bool base_TransferDataToWindow();
174 bool base_TransferDataFromWindow();
175 bool base_Validate();
176
177 bool base_AcceptsFocus() const;
178 bool base_AcceptsFocusFromKeyboard() const;
179 wxSize base_GetMaxSize() const;
180
181 void base_AddChild(wxWindow* child);
182 void base_RemoveChild(wxWindow* child);
183
184 bool base_ShouldInheritColours() const;
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_VIZATTR_(GetDefaultAttributes);
239
240 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
241
242 PYPRIVATE;
243 };
244
245 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
246
247 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
248 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
249 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
250 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
251
252 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
253 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
254 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
255
256 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
257 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
258
259 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
260 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
261 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
262 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
263
264 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
265 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
266 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
267
268 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
269 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
270
271 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, ShouldInheritColours);
272 IMP_PYCALLBACK_VIZATTR_(wxPyPanel, wxPanel, GetDefaultAttributes);
273
274 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, HasTransparentBackground);
275 %}
276
277 // And now the one for SWIG to see
278 MustHaveApp(wxPyPanel);
279 class wxPyPanel : public wxPanel
280 {
281 public:
282 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
283 %pythonAppend wxPyPanel() ""
284
285 wxPyPanel(wxWindow* parent, const wxWindowID id=-1,
286 const wxPoint& pos = wxDefaultPosition,
287 const wxSize& size = wxDefaultSize,
288 long style = 0,
289 const wxString& name = wxPyPanelNameStr);
290
291 %RenameCtor(PrePyPanel, wxPyPanel());
292
293 void _setCallbackInfo(PyObject* self, PyObject* _class);
294
295 void SetBestSize(const wxSize& size);
296
297 void base_DoMoveWindow(int x, int y, int width, int height);
298 void base_DoSetSize(int x, int y, int width, int height,
299 int sizeFlags = wxSIZE_AUTO);
300 void base_DoSetClientSize(int width, int height);
301 void base_DoSetVirtualSize( int x, int y );
302
303 DocDeclA(
304 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
305 "base_DoGetSize() -> (width, height)");
306 DocDeclA(
307 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
308 "base_DoGetClientSize() -> (width, height)");
309 DocDeclA(
310 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
311 "base_DoGetPosition() -> (x,y)");
312
313 wxSize base_DoGetVirtualSize() const;
314 wxSize base_DoGetBestSize() const;
315
316 void base_InitDialog();
317 bool base_TransferDataToWindow();
318 bool base_TransferDataFromWindow();
319 bool base_Validate();
320
321 bool base_AcceptsFocus() const;
322 bool base_AcceptsFocusFromKeyboard() const;
323 wxSize base_GetMaxSize() const;
324
325 void base_AddChild(wxWindow* child);
326 void base_RemoveChild(wxWindow* child);
327
328 bool base_ShouldInheritColours() const ;
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_VIZATTR_(GetDefaultAttributes);
376
377 DEC_PYCALLBACK_BOOL_(HasTransparentBackground);
378
379 PYPRIVATE;
380 };
381
382 IMPLEMENT_DYNAMIC_CLASS(wxPyScrolledWindow, wxScrolledWindow);
383
384 IMP_PYCALLBACK_VOID_INT4(wxPyScrolledWindow, wxScrolledWindow, DoMoveWindow);
385 IMP_PYCALLBACK_VOID_INT5(wxPyScrolledWindow, wxScrolledWindow, DoSetSize);
386 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetClientSize);
387 IMP_PYCALLBACK_VOID_INTINT(wxPyScrolledWindow, wxScrolledWindow, DoSetVirtualSize);
388
389 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetSize);
390 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetClientSize);
391 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyScrolledWindow, wxScrolledWindow, DoGetPosition);
392
393 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetVirtualSize);
394 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, DoGetBestSize);
395
396 IMP_PYCALLBACK__(wxPyScrolledWindow, wxScrolledWindow, InitDialog);
397 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataFromWindow);
398 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, TransferDataToWindow);
399 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, Validate);
400
401 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocus);
402 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, AcceptsFocusFromKeyboard);
403 IMP_PYCALLBACK_SIZE_const(wxPyScrolledWindow, wxScrolledWindow, GetMaxSize);
404
405 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, AddChild);
406 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyScrolledWindow, wxScrolledWindow, RemoveChild);
407
408 IMP_PYCALLBACK_BOOL_const(wxPyScrolledWindow, wxScrolledWindow, ShouldInheritColours);
409 IMP_PYCALLBACK_VIZATTR_(wxPyScrolledWindow, wxScrolledWindow, GetDefaultAttributes);
410
411 IMP_PYCALLBACK_BOOL_(wxPyScrolledWindow, wxScrolledWindow, HasTransparentBackground);
412 %}
413
414 // And now the one for SWIG to see
415 MustHaveApp(wxPyScrolledWindow);
416 class wxPyScrolledWindow : public wxScrolledWindow
417 {
418 public:
419 %pythonAppend wxPyScrolledWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
420 %pythonAppend wxPyScrolledWindow() ""
421
422 wxPyScrolledWindow(wxWindow* parent, const wxWindowID id=-1,
423 const wxPoint& pos = wxDefaultPosition,
424 const wxSize& size = wxDefaultSize,
425 long style = 0,
426 const wxString& name = wxPyPanelNameStr);
427
428 %RenameCtor(PrePyScrolledWindow, wxPyScrolledWindow());
429
430 void _setCallbackInfo(PyObject* self, PyObject* _class);
431
432 void SetBestSize(const wxSize& size);
433
434 void base_DoMoveWindow(int x, int y, int width, int height);
435 void base_DoSetSize(int x, int y, int width, int height,
436 int sizeFlags = wxSIZE_AUTO);
437 void base_DoSetClientSize(int width, int height);
438 void base_DoSetVirtualSize( int x, int y );
439
440 DocDeclA(
441 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
442 "base_DoGetSize() -> (width, height)");
443 DocDeclA(
444 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
445 "base_DoGetClientSize() -> (width, height)");
446 DocDeclA(
447 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
448 "base_DoGetPosition() -> (x,y)");
449
450 wxSize base_DoGetVirtualSize() const;
451 wxSize base_DoGetBestSize() const;
452
453 void base_InitDialog();
454 bool base_TransferDataToWindow();
455 bool base_TransferDataFromWindow();
456 bool base_Validate();
457
458 bool base_AcceptsFocus() const;
459 bool base_AcceptsFocusFromKeyboard() const;
460 wxSize base_GetMaxSize() const;
461
462 void base_AddChild(wxWindow* child);
463 void base_RemoveChild(wxWindow* child);
464
465 bool base_ShouldInheritColours() const;
466 wxVisualAttributes base_GetDefaultAttributes();
467 };
468
469
470 //---------------------------------------------------------------------------
471 //---------------------------------------------------------------------------