]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
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 | %addtofunc 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 | void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const; | |
146 | void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const; | |
147 | void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const; | |
148 | ||
149 | wxSize base_DoGetVirtualSize() const; | |
150 | wxSize base_DoGetBestSize() const; | |
151 | ||
152 | void base_InitDialog(); | |
153 | bool base_TransferDataToWindow(); | |
154 | bool base_TransferDataFromWindow(); | |
155 | bool base_Validate(); | |
156 | ||
157 | bool base_AcceptsFocus() const; | |
158 | bool base_AcceptsFocusFromKeyboard() const; | |
159 | wxSize base_GetMaxSize() const; | |
160 | ||
161 | void base_AddChild(wxWindow* child); | |
162 | void base_RemoveChild(wxWindow* child); | |
163 | }; | |
164 | ||
165 | //--------------------------------------------------------------------------- | |
166 | // Do the same thing for wxControl | |
167 | ||
168 | // ** See _pycontrol.i, it was moved there because of dependency on wxControl | |
169 | ||
170 | ||
171 | //--------------------------------------------------------------------------- | |
172 | // and for wxPanel | |
173 | ||
174 | %{ // C++ version of Python aware wxPanel | |
175 | class wxPyPanel : public wxPanel | |
176 | { | |
177 | DECLARE_DYNAMIC_CLASS(wxPyPanel) | |
178 | public: | |
179 | wxPyPanel() : wxPanel() {} | |
180 | wxPyPanel(wxWindow* parent, const wxWindowID id, | |
181 | const wxPoint& pos = wxDefaultPosition, | |
182 | const wxSize& size = wxDefaultSize, | |
183 | long style = 0, | |
184 | const wxString& name = wxPyPanelNameStr) | |
185 | : wxPanel(parent, id, pos, size, style, name) {} | |
186 | ||
187 | ||
188 | DEC_PYCALLBACK_VOID_INT4(DoMoveWindow); | |
189 | DEC_PYCALLBACK_VOID_INT5(DoSetSize); | |
190 | DEC_PYCALLBACK_VOID_INTINT(DoSetClientSize); | |
191 | DEC_PYCALLBACK_VOID_INTINT(DoSetVirtualSize); | |
192 | ||
193 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetSize); | |
194 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetClientSize); | |
195 | DEC_PYCALLBACK_VOID_INTPINTP_const(DoGetPosition); | |
196 | ||
197 | DEC_PYCALLBACK_SIZE_const(DoGetVirtualSize); | |
198 | DEC_PYCALLBACK_SIZE_const(DoGetBestSize); | |
199 | ||
200 | DEC_PYCALLBACK__(InitDialog); | |
201 | DEC_PYCALLBACK_BOOL_(TransferDataFromWindow); | |
202 | DEC_PYCALLBACK_BOOL_(TransferDataToWindow); | |
203 | DEC_PYCALLBACK_BOOL_(Validate); | |
204 | ||
205 | DEC_PYCALLBACK_BOOL_const(AcceptsFocus); | |
206 | DEC_PYCALLBACK_BOOL_const(AcceptsFocusFromKeyboard); | |
207 | DEC_PYCALLBACK_SIZE_const(GetMaxSize); | |
208 | ||
209 | DEC_PYCALLBACK_VOID_WXWINBASE(AddChild); | |
210 | DEC_PYCALLBACK_VOID_WXWINBASE(RemoveChild); | |
211 | ||
212 | PYPRIVATE; | |
213 | }; | |
214 | ||
215 | IMPLEMENT_DYNAMIC_CLASS(wxPyPanel, wxPanel); | |
216 | ||
217 | IMP_PYCALLBACK_VOID_INT4(wxPyPanel, wxPanel, DoMoveWindow); | |
218 | IMP_PYCALLBACK_VOID_INT5(wxPyPanel, wxPanel, DoSetSize); | |
219 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetClientSize); | |
220 | IMP_PYCALLBACK_VOID_INTINT(wxPyPanel, wxPanel, DoSetVirtualSize); | |
221 | ||
222 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetSize); | |
223 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetClientSize); | |
224 | IMP_PYCALLBACK_VOID_INTPINTP_const(wxPyPanel, wxPanel, DoGetPosition); | |
225 | ||
226 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetVirtualSize); | |
227 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, DoGetBestSize); | |
228 | ||
229 | IMP_PYCALLBACK__(wxPyPanel, wxPanel, InitDialog); | |
230 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataFromWindow); | |
231 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, TransferDataToWindow); | |
232 | IMP_PYCALLBACK_BOOL_(wxPyPanel, wxPanel, Validate); | |
233 | ||
234 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocus); | |
235 | IMP_PYCALLBACK_BOOL_const(wxPyPanel, wxPanel, AcceptsFocusFromKeyboard); | |
236 | IMP_PYCALLBACK_SIZE_const(wxPyPanel, wxPanel, GetMaxSize); | |
237 | ||
238 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, AddChild); | |
239 | IMP_PYCALLBACK_VOID_WXWINBASE(wxPyPanel, wxPanel, RemoveChild); | |
240 | ||
241 | %} | |
242 | ||
243 | // And now the one for SWIG to see | |
244 | class wxPyPanel : public wxPanel | |
245 | { | |
246 | public: | |
247 | %addtofunc wxPyPanel "self._setOORInfo(self); self._setCallbackInfo(self, PyPanel)" | |
248 | ||
249 | wxPyPanel(wxWindow* parent, const wxWindowID id, | |
250 | const wxPoint& pos = wxDefaultPosition, | |
251 | const wxSize& size = wxDefaultSize, | |
252 | long style = 0, | |
253 | const wxString& name = wxPyPanelNameStr); | |
254 | ||
255 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
256 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPyPanel)" | |
257 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
258 | ||
259 | ||
260 | void base_DoMoveWindow(int x, int y, int width, int height); | |
261 | void base_DoSetSize(int x, int y, int width, int height, | |
262 | int sizeFlags = wxSIZE_AUTO); | |
263 | void base_DoSetClientSize(int width, int height); | |
264 | void base_DoSetVirtualSize( int x, int y ); | |
265 | ||
266 | void base_DoGetSize( int *OUTPUT, int *OUTPUT ) const; | |
267 | void base_DoGetClientSize( int *OUTPUT, int *OUTPUT ) const; | |
268 | void base_DoGetPosition( int *OUTPUT, int *OUTPUT ) const; | |
269 | ||
270 | wxSize base_DoGetVirtualSize() const; | |
271 | wxSize base_DoGetBestSize() const; | |
272 | ||
273 | void base_InitDialog(); | |
274 | bool base_TransferDataToWindow(); | |
275 | bool base_TransferDataFromWindow(); | |
276 | bool base_Validate(); | |
277 | ||
278 | bool base_AcceptsFocus() const; | |
279 | bool base_AcceptsFocusFromKeyboard() const; | |
280 | wxSize base_GetMaxSize() const; | |
281 | ||
282 | void base_AddChild(wxWindow* child); | |
283 | void base_RemoveChild(wxWindow* child); | |
284 | }; | |
285 | ||
286 | ||
287 | //--------------------------------------------------------------------------- | |
288 | //--------------------------------------------------------------------------- |