]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/_pywindows.i
Reverted wxBufferedDC changes
[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 PYPRIVATE;
94 };
95
96 IMPLEMENT_DYNAMIC_CLASS(wxPyWindow, wxWindow);
97
98 IMP_PYCALLBACK_VOID_INT4(wxPyWindow, wxWindow, DoMoveWindow);
99 IMP_PYCALLBACK_VOID_INT5(wxPyWindow, wxWindow, DoSetSize);
100 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetClientSize);
101 IMP_PYCALLBACK_VOID_INTINT(wxPyWindow, wxWindow, DoSetVirtualSize);
102
103 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetSize);
104 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetClientSize);
105 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyWindow, wxWindow, DoGetPosition);
106
107 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetVirtualSize);
108 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, DoGetBestSize);
109
110 IMP_PYCALLBACK__(wxPyWindow, wxWindow, InitDialog);
111 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataFromWindow);
112 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, TransferDataToWindow);
113 IMP_PYCALLBACK_BOOL_(wxPyWindow, wxWindow, Validate);
114
115 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocus);
116 IMP_PYCALLBACK_BOOL_const(wxPyWindow, wxWindow, AcceptsFocusFromKeyboard);
117 IMP_PYCALLBACK_SIZE_const(wxPyWindow, wxWindow, GetMaxSize);
118
119 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, AddChild);
120 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyWindow, wxWindow, RemoveChild);
121
122 %}
123
124 // And now the one for SWIG to see
125 class wxPyWindow : public wxWindow
126 {
127 public:
128 %pythonAppend wxPyWindow "self._setOORInfo(self); self._setCallbackInfo(self, PyWindow)"
129
130 wxPyWindow(wxWindow* parent, const wxWindowID id,
131 const wxPoint& pos = wxDefaultPosition,
132 const wxSize& size = wxDefaultSize,
133 long style = 0,
134 const wxString& name = wxPyPanelNameStr);
135
136 void _setCallbackInfo(PyObject* self, PyObject* _class);
137
138
139 void base_DoMoveWindow(int x, int y, int width, int height);
140 void base_DoSetSize(int x, int y, int width, int height,
141 int sizeFlags = wxSIZE_AUTO);
142 void base_DoSetClientSize(int width, int height);
143 void base_DoSetVirtualSize( int x, int y );
144
145 DocDeclA(
146 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
147 "base_DoGetSize() -> (width, height)");
148 DocDeclA(
149 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
150 "base_DoGetClientSize() -> (width, height)");
151 DocDeclA(
152 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
153 "base_DoGetPosition() -> (x,y)");
154
155 wxSize base_DoGetVirtualSize() const;
156 wxSize base_DoGetBestSize() const;
157
158 void base_InitDialog();
159 bool base_TransferDataToWindow();
160 bool base_TransferDataFromWindow();
161 bool base_Validate();
162
163 bool base_AcceptsFocus() const;
164 bool base_AcceptsFocusFromKeyboard() const;
165 wxSize base_GetMaxSize() const;
166
167 void base_AddChild(wxWindow* child);
168 void base_RemoveChild(wxWindow* child);
169 };
170
171 //---------------------------------------------------------------------------
172 // Do the same thing for wxControl
173
174 // ** See _pycontrol.i, it was moved there because of dependency on wxControl
175
176
177 //---------------------------------------------------------------------------
178 // and for wxPanel
179
180 %{ // C++ version of Python aware wxPanel
181 class wxPyPanel : public wxPanel
182 {
183 DECLARE_DYNAMIC_CLASS(wxPyPanel)
184 public:
185 wxPyPanel() : wxPanel() {}
186 wxPyPanel(wxWindow* parent, const wxWindowID id,
187 const wxPoint& pos = wxDefaultPosition,
188 const wxSize& size = wxDefaultSize,
189 long style = 0,
190 const wxString& name = wxPyPanelNameStr)
191 : wxPanel(parent, id, pos, size, style, name) {}
192
193
194 DEC_PYCALLBACK_VOID_INT4(DoMoveWindow);
195 DEC_PYCALLBACK_VOID_INT5(DoSetSize);
196 DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize);
197 DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize);
198
199 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize);
200 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize);
201 DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition);
202
203 DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize);
204 DEC_PYCALLBACK_SIZE_const(DoGetBestSize);
205
206 DEC_PYCALLBACK__(InitDialog);
207 DEC_PYCALLBACK_BOOL_(TransferDataFromWindow);
208 DEC_PYCALLBACK_BOOL_(TransferDataToWindow);
209 DEC_PYCALLBACK_BOOL_(Validate);
210
211 DEC_PYCALLBACK_BOOL_const(AcceptsFocus);
212 DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard);
213 DEC_PYCALLBACK_SIZE_const(GetMaxSize);
214
215 DEC_PYCALLBACK_VOID_WXWINBASE(AddChild);
216 DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild);
217
218 PYPRIVATE;
219 };
220
221 IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel);
222
223 IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow);
224 IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize);
225 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize);
226 IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize);
227
228 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize);
229 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize);
230 IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition);
231
232 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize);
233 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize);
234
235 IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog);
236 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow);
237 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow);
238 IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate);
239
240 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus);
241 IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard);
242 IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize);
243
244 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild);
245 IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild);
246
247 %}
248
249 // And now the one for SWIG to see
250 class wxPyPanel : public wxPanel
251 {
252 public:
253 %pythonAppend wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)"
254
255 wxPyPanel(wxWindow* parent, const wxWindowID id,
256 const wxPoint& pos = wxDefaultPosition,
257 const wxSize& size = wxDefaultSize,
258 long style = 0,
259 const wxString& name = wxPyPanelNameStr);
260
261 void _setCallbackInfo(PyObject* self, PyObject* _class);
262 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)"
263 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
264
265
266 void base_DoMoveWindow(int x, int y, int width, int height);
267 void base_DoSetSize(int x, int y, int width, int height,
268 int sizeFlags = wxSIZE_AUTO);
269 void base_DoSetClientSize(int width, int height);
270 void base_DoSetVirtualSize( int x, int y );
271
272 DocDeclA(
273 void, base_DoGetSize( int *OUTPUT, int *OUTPUT ) const,
274 "base_DoGetSize() -> (width, height)");
275 DocDeclA(
276 void, base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const,
277 "base_DoGetClientSize() -> (width, height)");
278 DocDeclA(
279 void, base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const,
280 "base_DoGetPosition() -> (x,y)");
281
282 wxSize base_DoGetVirtualSize() const;
283 wxSize base_DoGetBestSize() const;
284
285 void base_InitDialog();
286 bool base_TransferDataToWindow();
287 bool base_TransferDataFromWindow();
288 bool base_Validate();
289
290 bool base_AcceptsFocus() const;
291 bool base_AcceptsFocusFromKeyboard() const;
292 wxSize base_GetMaxSize() const;
293
294 void base_AddChild(wxWindow* child);
295 void base_RemoveChild(wxWindow* child);
296 };
297
298
299 //---------------------------------------------------------------------------
300 //---------------------------------------------------------------------------