]>
Commit | Line | Data |
---|---|---|
b1462dfa | 1 | //////////////////////////////////////////////////////////////////////////// |
7bf85405 | 2 | // Name: helpers.h |
a2426843 | 3 | // Purpose: Helper functions/classes for the wxPython extension module |
7bf85405 RD |
4 | // |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 7/1/97 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 1998 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef __wxp_helpers__ | |
14 | #define __wxp_helpers__ | |
15 | ||
16 | #include <wx/wx.h> | |
17 | ||
cf694132 | 18 | |
efc5f224 RD |
19 | //--------------------------------------------------------------------------- |
20 | ||
2f90df85 RD |
21 | typedef unsigned char byte; |
22 | ||
7bf85405 RD |
23 | |
24 | class wxPyApp: public wxApp | |
25 | { | |
26 | public: | |
cf694132 RD |
27 | wxPyApp(); |
28 | ~wxPyApp(); | |
4268f798 RD |
29 | bool OnInit(); |
30 | int MainLoop(); | |
7bf85405 | 31 | }; |
4268f798 | 32 | |
7bf85405 RD |
33 | extern wxPyApp *wxPythonApp; |
34 | ||
35 | //---------------------------------------------------------------------- | |
36 | ||
0d6f9504 | 37 | void __wxPreStart(); |
7bf85405 | 38 | PyObject* __wxStart(PyObject*, PyObject* args); |
7ff49f0c | 39 | void __wxCleanup(); |
7bf85405 | 40 | |
9416aa89 | 41 | //extern PyObject* wxPython_dict; |
7bf85405 RD |
42 | PyObject* __wxSetDictionary(PyObject*, PyObject* args); |
43 | ||
7bf85405 | 44 | void wxPyEventThunker(wxObject*, wxEvent& event); |
efc5f224 | 45 | |
1e7ecb7b | 46 | PyObject* wxPyConstructObject(void* ptr, |
a541c325 | 47 | const wxString& className, |
1e7ecb7b | 48 | int setThisOwn=0); |
9416aa89 | 49 | PyObject* wxPyConstructObject(void* ptr, |
a541c325 | 50 | const wxString& className, |
9416aa89 RD |
51 | PyObject* klass, |
52 | int setThisOwn=0); | |
a541c325 RD |
53 | |
54 | PyObject* wx2PyString(const wxString& src); | |
55 | wxString Py2wxString(PyObject* source); | |
56 | ||
57 | PyObject* wxPyClassExists(const wxString& className); | |
58 | PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler=TRUE); | |
59 | PyObject* wxPyMake_wxSizer(wxSizer* source); | |
60 | void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName); | |
9416aa89 | 61 | |
1e7ecb7b | 62 | PyObject* wxPy_ConvertList(wxListBase* list, const char* className); |
a541c325 | 63 | long wxPyGetWinHandle(wxWindow* win); |
9b3d3bc4 | 64 | |
19a97bd6 RD |
65 | //---------------------------------------------------------------------- |
66 | ||
4268f798 RD |
67 | // if we want to handle threads and Python threads are available... |
68 | #if defined(WXP_USE_THREAD) && defined(WITH_THREAD) | |
69 | #define WXP_WITH_THREAD | |
70 | #else // no Python threads... | |
71 | #undef WXP_WITH_THREAD | |
72 | #endif | |
19a97bd6 RD |
73 | |
74 | ||
4268f798 RD |
75 | // For Python --> C++ |
76 | PyThreadState* wxPyBeginAllowThreads(); | |
77 | void wxPyEndAllowThreads(PyThreadState* state); | |
9b3d3bc4 | 78 | |
4268f798 RD |
79 | // For C++ --> Python |
80 | void wxPyBeginBlockThreads(); | |
81 | void wxPyEndBlockThreads(); | |
9b3d3bc4 | 82 | |
7bf85405 | 83 | //---------------------------------------------------------------------- |
2f90df85 RD |
84 | // These are helpers used by the typemaps |
85 | ||
c8bc7bb8 RD |
86 | wxString* wxString_in_helper(PyObject* source); |
87 | ||
1e7ecb7b RD |
88 | byte* byte_LIST_helper(PyObject* source); |
89 | int* int_LIST_helper(PyObject* source); | |
90 | long* long_LIST_helper(PyObject* source); | |
91 | char** string_LIST_helper(PyObject* source); | |
e0672e2f | 92 | wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints); |
1e7ecb7b RD |
93 | wxBitmap** wxBitmap_LIST_helper(PyObject* source); |
94 | wxString* wxString_LIST_helper(PyObject* source); | |
95 | wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source); | |
9d37f964 | 96 | wxPen** wxPen_LIST_helper(PyObject* source); |
1e7ecb7b RD |
97 | |
98 | bool wxSize_helper(PyObject* source, wxSize** obj); | |
99 | bool wxPoint_helper(PyObject* source, wxPoint** obj); | |
100 | bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj); | |
101 | bool wxRect_helper(PyObject* source, wxRect** obj); | |
102 | bool wxColour_helper(PyObject* source, wxColour** obj); | |
7bf85405 | 103 | |
4acff284 RD |
104 | //---------------------------------------------------------------------- |
105 | // Other helpful stuff | |
106 | ||
9d37f964 RD |
107 | #if PYTHON_API_VERSION < 1009 |
108 | #define PySequence_Fast_GET_ITEM(o, i) \ | |
109 | (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) | |
110 | #endif | |
111 | ||
112 | bool _2int_seq_helper(PyObject* source, int* i1, int* i2); | |
113 | bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4); | |
114 | ||
115 | ||
7b7ac0ab | 116 | PyObject* wxArrayString2PyList_helper(const wxArrayString& arr); |
293a0a86 | 117 | PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr); |
b37c7e1d | 118 | |
4acff284 RD |
119 | #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; } |
120 | #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name) | |
121 | #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val) | |
b37c7e1d | 122 | |
2f90df85 | 123 | //---------------------------------------------------------------------- |
7bf85405 RD |
124 | |
125 | #ifndef SWIGCODE | |
126 | extern "C" void SWIG_MakePtr(char *, void *, char *); | |
127 | extern "C" char *SWIG_GetPtr(char *, void **, char *); | |
d559219f | 128 | extern "C" char *SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type); |
7bf85405 RD |
129 | #endif |
130 | ||
131 | ||
132 | #ifdef _MSC_VER | |
133 | # pragma warning(disable:4800) | |
f6bcfd97 | 134 | # pragma warning(disable:4190) |
7bf85405 RD |
135 | #endif |
136 | ||
7bf85405 RD |
137 | //---------------------------------------------------------------------- |
138 | ||
139 | class wxPyCallback : public wxObject { | |
2f90df85 | 140 | DECLARE_ABSTRACT_CLASS(wxPyCallback); |
7bf85405 | 141 | public: |
cf694132 | 142 | wxPyCallback(PyObject* func); |
2f90df85 | 143 | wxPyCallback(const wxPyCallback& other); |
cf694132 | 144 | ~wxPyCallback(); |
7bf85405 RD |
145 | |
146 | void EventThunker(wxEvent& event); | |
147 | ||
148 | PyObject* m_func; | |
149 | }; | |
150 | ||
7bf85405 RD |
151 | //--------------------------------------------------------------------------- |
152 | ||
153 | class wxPyTimer : public wxTimer { | |
154 | public: | |
155 | wxPyTimer(PyObject* callback); | |
156 | ~wxPyTimer(); | |
157 | ||
158 | void Notify(); | |
159 | ||
160 | private: | |
161 | PyObject* func; | |
162 | }; | |
163 | ||
cf694132 | 164 | //--------------------------------------------------------------------------- |
65dd82cb | 165 | //--------------------------------------------------------------------------- |
9b3d3bc4 RD |
166 | // These Event classes can be derived from in Python and passed through the |
167 | // event system without loosing anything. They do this by keeping a reference | |
168 | // to themselves and some special case handling in wxPyCallback::EventThunker. | |
65dd82cb RD |
169 | |
170 | ||
e19b7164 | 171 | class wxPyEvtSelfRef { |
65dd82cb | 172 | public: |
e19b7164 RD |
173 | wxPyEvtSelfRef(); |
174 | ~wxPyEvtSelfRef(); | |
65dd82cb RD |
175 | |
176 | void SetSelf(PyObject* self, bool clone=FALSE); | |
177 | PyObject* GetSelf() const; | |
178 | ||
179 | protected: | |
180 | PyObject* m_self; | |
181 | bool m_cloned; | |
182 | }; | |
183 | ||
184 | ||
e19b7164 | 185 | class wxPyEvent : public wxEvent, public wxPyEvtSelfRef { |
07b2e1cd | 186 | DECLARE_ABSTRACT_CLASS(wxPyEvent) |
65dd82cb RD |
187 | public: |
188 | wxPyEvent(int id=0); | |
07b2e1cd | 189 | wxPyEvent(const wxPyEvent& evt); |
65dd82cb RD |
190 | ~wxPyEvent(); |
191 | ||
07b2e1cd | 192 | virtual wxEvent* Clone() const { return new wxPyEvent(*this); } |
65dd82cb RD |
193 | }; |
194 | ||
195 | ||
e19b7164 | 196 | class wxPyCommandEvent : public wxCommandEvent, public wxPyEvtSelfRef { |
07b2e1cd | 197 | DECLARE_ABSTRACT_CLASS(wxPyCommandEvent) |
65dd82cb RD |
198 | public: |
199 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); | |
07b2e1cd | 200 | wxPyCommandEvent(const wxPyCommandEvent& evt); |
65dd82cb RD |
201 | ~wxPyCommandEvent(); |
202 | ||
07b2e1cd | 203 | virtual wxEvent* Clone() const { return new wxPyCommandEvent(*this); } |
65dd82cb RD |
204 | }; |
205 | ||
bb0054cd | 206 | |
4acff284 RD |
207 | |
208 | //---------------------------------------------------------------------- | |
209 | // Forward decalre a few things used in the exported API | |
210 | class wxPyClientData; | |
211 | class wxPyUserData; | |
212 | class wxPyOORClientData; | |
213 | ||
214 | void wxPyClientData_dtor(wxPyClientData* self); | |
215 | void wxPyUserData_dtor(wxPyUserData* self); | |
216 | void wxPyOORClientData_dtor(wxPyOORClientData* self); | |
217 | ||
218 | ||
1e7ecb7b RD |
219 | //--------------------------------------------------------------------------- |
220 | // Export a C API in a struct. Other modules will be able to load this from | |
221 | // the wxc module and will then have safe access to these functions, even if | |
222 | // in another shared library. | |
223 | ||
224 | class wxPyCallbackHelper; | |
225 | ||
226 | struct wxPyCoreAPI { | |
227 | ||
228 | void (*p_SWIG_MakePtr)(char*, void*, char*); | |
229 | char* (*p_SWIG_GetPtr)(char*, void**, char*); | |
230 | char* (*p_SWIG_GetPtrObj)(PyObject*, void**, char*); | |
231 | void (*p_SWIG_RegisterMapping)(char*, char*, void *(*cast)(void *)); | |
232 | void (*p_SWIG_addvarlink)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)); | |
233 | PyObject* (*p_SWIG_newvarlink)(void); | |
234 | ||
4268f798 RD |
235 | PyThreadState* (*p_wxPyBeginAllowThreads)(); |
236 | void (*p_wxPyEndAllowThreads)(PyThreadState* state); | |
237 | void (*p_wxPyBeginBlockThreads)(); | |
238 | void (*p_wxPyEndBlockThreads)(); | |
19a97bd6 | 239 | |
a541c325 | 240 | PyObject* (*p_wxPyConstructObject)(void *, const wxString&, int); |
1e7ecb7b RD |
241 | PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className); |
242 | ||
c8bc7bb8 | 243 | wxString* (*p_wxString_in_helper)(PyObject* source); |
a541c325 RD |
244 | wxString (*p_Py2wxString)(PyObject* source); |
245 | PyObject* (*p_wx2PyString)(const wxString& src); | |
c8bc7bb8 | 246 | |
1e7ecb7b RD |
247 | byte* (*p_byte_LIST_helper)(PyObject* source); |
248 | int* (*p_int_LIST_helper)(PyObject* source); | |
249 | long* (*p_long_LIST_helper)(PyObject* source); | |
250 | char** (*p_string_LIST_helper)(PyObject* source); | |
e0672e2f | 251 | wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source, int* npoints); |
1e7ecb7b RD |
252 | wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source); |
253 | wxString* (*p_wxString_LIST_helper)(PyObject* source); | |
254 | wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source); | |
255 | ||
256 | bool (*p_wxSize_helper)(PyObject* source, wxSize** obj); | |
257 | bool (*p_wxPoint_helper)(PyObject* source, wxPoint** obj); | |
258 | bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj); | |
259 | bool (*p_wxRect_helper)(PyObject* source, wxRect** obj); | |
260 | bool (*p_wxColour_helper)(PyObject* source, wxColour** obj); | |
261 | ||
0122b7e3 | 262 | void (*p_wxPyCBH_setCallbackInfo)(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); |
1e7ecb7b RD |
263 | bool (*p_wxPyCBH_findCallback)(const wxPyCallbackHelper& cbh, const char* name); |
264 | int (*p_wxPyCBH_callCallback)(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
265 | PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
266 | void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); | |
267 | ||
a541c325 | 268 | PyObject* (*p_wxPyClassExists)(const wxString& className); |
2f4e9287 RD |
269 | PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler); |
270 | PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source); | |
9416aa89 | 271 | void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); |
7b7ac0ab | 272 | PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr); |
293a0a86 | 273 | PyObject* (*p_wxArrayInt2PyList_helper)(const wxArrayInt& arr); |
4acff284 RD |
274 | |
275 | void (*p_wxPyClientData_dtor)(wxPyClientData*); | |
276 | void (*p_wxPyUserData_dtor)(wxPyUserData*); | |
277 | void (*p_wxPyOORClientData_dtor)(wxPyOORClientData*); | |
278 | }; | |
279 | ||
280 | #ifdef wxPyUSE_EXPORT | |
a2426843 RD |
281 | // Notice that this is static, not extern. This is by design, each module |
282 | // needs one, but doesn't have to use it. | |
283 | static wxPyCoreAPI* wxPyCoreAPIPtr = NULL; | |
4acff284 RD |
284 | #endif |
285 | ||
286 | ||
287 | //--------------------------------------------------------------------------- | |
288 | ||
289 | ||
290 | class wxPyUserData : public wxObject { | |
291 | public: | |
292 | wxPyUserData(PyObject* obj) { | |
293 | m_obj = obj; | |
294 | Py_INCREF(m_obj); | |
295 | } | |
296 | ||
297 | ~wxPyUserData() { | |
298 | #ifdef wxPyUSE_EXPORT | |
299 | wxPyCoreAPIPtr->p_wxPyUserData_dtor(this); | |
300 | #else | |
301 | wxPyUserData_dtor(this); | |
302 | #endif | |
303 | } | |
304 | PyObject* m_obj; | |
305 | }; | |
306 | ||
307 | ||
308 | class wxPyClientData : public wxClientData { | |
309 | public: | |
310 | wxPyClientData(PyObject* obj) { | |
311 | m_obj = obj; | |
312 | Py_INCREF(m_obj); | |
313 | } | |
314 | ||
315 | ~wxPyClientData() { | |
316 | #ifdef wxPyUSE_EXPORT | |
317 | wxPyCoreAPIPtr->p_wxPyClientData_dtor(this); | |
318 | #else | |
319 | wxPyClientData_dtor(this); | |
320 | #endif | |
321 | } | |
322 | PyObject* m_obj; | |
1e7ecb7b RD |
323 | }; |
324 | ||
4acff284 RD |
325 | |
326 | class wxPyOORClientData : public wxPyClientData { | |
327 | public: | |
328 | wxPyOORClientData(PyObject* obj) | |
329 | : wxPyClientData(obj) {} | |
330 | ||
331 | ~wxPyOORClientData() { | |
1e7ecb7b | 332 | #ifdef wxPyUSE_EXPORT |
4acff284 RD |
333 | wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(this); |
334 | #else | |
335 | wxPyOORClientData_dtor(this); | |
1e7ecb7b | 336 | #endif |
4acff284 RD |
337 | } |
338 | }; | |
1e7ecb7b RD |
339 | |
340 | //--------------------------------------------------------------------------- | |
341 | // This class holds an instance of a Python Shadow Class object and assists | |
342 | // with looking up and invoking Python callback methods from C++ virtual | |
343 | // method redirections. For all classes which have virtuals which should be | |
344 | // overridable in wxPython, a new subclass is created that contains a | |
345 | // wxPyCallbackHelper. | |
346 | // | |
347 | ||
348 | class wxPyCallbackHelper { | |
349 | public: | |
350 | wxPyCallbackHelper(const wxPyCallbackHelper& other); | |
351 | ||
352 | wxPyCallbackHelper() { | |
353 | m_class = NULL; | |
354 | m_self = NULL; | |
355 | m_lastFound = NULL; | |
356 | m_incRef = FALSE; | |
357 | } | |
358 | ||
359 | ~wxPyCallbackHelper() { | |
360 | #ifdef wxPyUSE_EXPORT | |
361 | wxPyCoreAPIPtr->p_wxPyCBH_delete(this); | |
362 | #else | |
363 | wxPyCBH_delete(this); | |
364 | #endif | |
365 | } | |
366 | ||
367 | void setSelf(PyObject* self, PyObject* klass, int incref=TRUE); | |
368 | bool findCallback(const char* name) const; | |
369 | int callCallback(PyObject* argTuple) const; | |
370 | PyObject* callCallbackObj(PyObject* argTuple) const; | |
371 | ||
372 | private: | |
373 | PyObject* m_self; | |
374 | PyObject* m_class; | |
375 | PyObject* m_lastFound; | |
376 | int m_incRef; | |
377 | ||
378 | friend void wxPyCBH_delete(wxPyCallbackHelper* cbh); | |
379 | }; | |
380 | ||
381 | ||
0122b7e3 | 382 | void wxPyCBH_setCallbackInfo(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); |
1e7ecb7b RD |
383 | bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name); |
384 | int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
385 | PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
386 | void wxPyCBH_delete(wxPyCallbackHelper* cbh); | |
387 | ||
388 | ||
389 | ||
900d9886 | 390 | |
bb0054cd RD |
391 | //--------------------------------------------------------------------------- |
392 | // These macros are used to implement the virtual methods that should | |
393 | // redirect to a Python method if one exists. The names designate the | |
b1462dfa | 394 | // return type, if any, as well as any parameter types. |
bb0054cd RD |
395 | //--------------------------------------------------------------------------- |
396 | ||
f6bcfd97 | 397 | #define PYPRIVATE \ |
0122b7e3 RD |
398 | void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \ |
399 | wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \ | |
f6bcfd97 | 400 | } \ |
c368d904 | 401 | private: wxPyCallbackHelper m_myInst |
efc5f224 RD |
402 | |
403 | //--------------------------------------------------------------------------- | |
404 | ||
d559219f RD |
405 | #define DEC_PYCALLBACK__(CBNAME) \ |
406 | void CBNAME(); \ | |
407 | void base_##CBNAME(); | |
408 | ||
409 | ||
19a97bd6 RD |
410 | #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ |
411 | void CLASS::CBNAME() { \ | |
412 | bool found; \ | |
4268f798 | 413 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
414 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
415 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
4268f798 | 416 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
417 | if (! found) \ |
418 | PCLASS::CBNAME(); \ | |
419 | } \ | |
420 | void CLASS::base_##CBNAME() { \ | |
421 | PCLASS::CBNAME(); \ | |
d559219f RD |
422 | } |
423 | ||
424 | //--------------------------------------------------------------------------- | |
425 | ||
426 | #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \ | |
427 | bool CBNAME(int a, int b); \ | |
428 | bool base_##CBNAME(int a, int b); | |
429 | ||
430 | ||
431 | #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \ | |
432 | bool CLASS::CBNAME(int a, int b) { \ | |
059a841c | 433 | bool rval=FALSE, found; \ |
4268f798 | 434 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 435 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1e7ecb7b | 436 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ |
4268f798 | 437 | wxPyEndBlockThreads(); \ |
19a97bd6 | 438 | if (! found) \ |
d559219f | 439 | rval = PCLASS::CBNAME(a,b); \ |
d559219f | 440 | return rval; \ |
bb0054cd | 441 | } \ |
d559219f | 442 | bool CLASS::base_##CBNAME(int a, int b) { \ |
bb0054cd RD |
443 | return PCLASS::CBNAME(a,b); \ |
444 | } | |
445 | ||
446 | //--------------------------------------------------------------------------- | |
447 | ||
c368d904 RD |
448 | #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \ |
449 | void CBNAME(int a, int b); \ | |
450 | void base_##CBNAME(int a, int b); | |
451 | ||
452 | ||
453 | #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ | |
454 | void CLASS::CBNAME(int a, int b) { \ | |
19a97bd6 | 455 | bool found; \ |
b0e5c039 | 456 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
457 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
458 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
b0e5c039 | 459 | wxPyEndBlockThreads(); \ |
19a97bd6 | 460 | if (! found) \ |
c368d904 | 461 | PCLASS::CBNAME(a,b); \ |
c368d904 RD |
462 | } \ |
463 | void CLASS::base_##CBNAME(int a, int b) { \ | |
464 | PCLASS::CBNAME(a,b); \ | |
465 | } | |
466 | ||
467 | //--------------------------------------------------------------------------- | |
468 | ||
b0e5c039 RD |
469 | #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \ |
470 | void CBNAME(int a, int b, int c, int d); \ | |
471 | void base_##CBNAME(int a, int b, int c, int d); | |
472 | ||
473 | ||
474 | #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \ | |
475 | void CLASS::CBNAME(int a, int b, int c, int d) { \ | |
476 | bool found; \ | |
477 | wxPyBeginBlockThreads(); \ | |
478 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
479 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \ | |
480 | wxPyEndBlockThreads(); \ | |
481 | if (! found) \ | |
482 | PCLASS::CBNAME(a,b,c,d); \ | |
483 | } \ | |
484 | void CLASS::base_##CBNAME(int a, int b, int c, int d) { \ | |
485 | PCLASS::CBNAME(a,b,c,d); \ | |
486 | } | |
487 | ||
488 | //--------------------------------------------------------------------------- | |
489 | #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \ | |
490 | void CBNAME(int a, int b, int c, int d, int e); \ | |
491 | void base_##CBNAME(int a, int b, int c, int d, int e); | |
492 | ||
493 | ||
494 | #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \ | |
495 | void CLASS::CBNAME(int a, int b, int c, int d, int e) { \ | |
496 | bool found; \ | |
497 | wxPyBeginBlockThreads(); \ | |
498 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
499 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \ | |
500 | wxPyEndBlockThreads(); \ | |
501 | if (! found) \ | |
502 | PCLASS::CBNAME(a,b,c,d,e); \ | |
503 | } \ | |
504 | void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \ | |
505 | PCLASS::CBNAME(a,b,c,d,e); \ | |
506 | } | |
507 | ||
508 | //--------------------------------------------------------------------------- | |
509 | ||
510 | #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \ | |
511 | void CBNAME(int* a, int* b) const; \ | |
512 | void base_##CBNAME(int* a, int* b) const; | |
513 | ||
514 | ||
515 | #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \ | |
516 | void CLASS::CBNAME(int* a, int* b) const { \ | |
517 | const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ | |
518 | bool found; \ | |
519 | wxPyBeginBlockThreads(); \ | |
520 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
521 | PyObject* ro; \ | |
522 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
523 | if (ro) { \ | |
524 | if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ | |
525 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
526 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
527 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \ | |
528 | *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \ | |
529 | } \ | |
530 | else \ | |
531 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
532 | Py_DECREF(o1); \ | |
533 | Py_DECREF(o2); \ | |
534 | } \ | |
535 | else { \ | |
536 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
537 | } \ | |
538 | Py_DECREF(ro); \ | |
539 | } \ | |
540 | } \ | |
541 | wxPyEndBlockThreads(); \ | |
542 | if (! found) \ | |
543 | PCLASS::CBNAME(a,b); \ | |
544 | } \ | |
545 | void CLASS::base_##CBNAME(int* a, int* b) const { \ | |
546 | PCLASS::CBNAME(a,b); \ | |
547 | } | |
548 | ||
549 | ||
550 | //--------------------------------------------------------------------------- | |
551 | ||
552 | #define DEC_PYCALLBACK_SIZE_const(CBNAME) \ | |
553 | wxSize CBNAME() const; \ | |
554 | wxSize base_##CBNAME() const; | |
555 | ||
556 | ||
557 | #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \ | |
558 | wxSize CLASS::CBNAME() const { \ | |
559 | const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ | |
560 | bool found; wxSize rval(0,0); \ | |
561 | wxPyBeginBlockThreads(); \ | |
562 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
563 | PyObject* ro; \ | |
564 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
565 | if (ro) { \ | |
566 | if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ | |
567 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
568 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
569 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \ | |
570 | rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \ | |
571 | } \ | |
572 | else \ | |
573 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
574 | Py_DECREF(o1); \ | |
575 | Py_DECREF(o2); \ | |
576 | } \ | |
577 | else { \ | |
578 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
579 | } \ | |
580 | Py_DECREF(ro); \ | |
581 | } \ | |
582 | } \ | |
583 | wxPyEndBlockThreads(); \ | |
584 | if (! found) \ | |
585 | return PCLASS::CBNAME(); \ | |
586 | else \ | |
587 | return rval; \ | |
588 | } \ | |
589 | wxSize CLASS::base_##CBNAME() const { \ | |
590 | return PCLASS::CBNAME(); \ | |
591 | } | |
592 | ||
593 | ||
594 | //--------------------------------------------------------------------------- | |
595 | ||
d559219f RD |
596 | #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \ |
597 | bool CBNAME(int a); \ | |
598 | bool base_##CBNAME(int a); | |
599 | ||
600 | ||
601 | #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \ | |
602 | bool CLASS::CBNAME(int a) { \ | |
059a841c | 603 | bool rval=FALSE, found; \ |
b0e5c039 | 604 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 605 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
059a841c | 606 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ |
b0e5c039 | 607 | wxPyEndBlockThreads(); \ |
19a97bd6 | 608 | if (! found) \ |
d559219f | 609 | rval = PCLASS::CBNAME(a); \ |
d559219f | 610 | return rval; \ |
bb0054cd | 611 | } \ |
d559219f | 612 | bool CLASS::base_##CBNAME(int a) { \ |
bb0054cd RD |
613 | return PCLASS::CBNAME(a); \ |
614 | } | |
615 | ||
efc5f224 RD |
616 | //--------------------------------------------------------------------------- |
617 | ||
d559219f RD |
618 | #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \ |
619 | bool CBNAME(int a); | |
620 | ||
621 | ||
622 | #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \ | |
623 | bool CLASS::CBNAME(int a) { \ | |
059a841c | 624 | bool rval=FALSE; \ |
4268f798 | 625 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 626 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1e7ecb7b | 627 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ |
194fa2ac | 628 | else rval = FALSE; \ |
4268f798 | 629 | wxPyEndBlockThreads(); \ |
d559219f | 630 | return rval; \ |
bb0054cd RD |
631 | } |
632 | ||
633 | ||
634 | //--------------------------------------------------------------------------- | |
635 | ||
d559219f RD |
636 | #define DEC_PYCALLBACK__DC(CBNAME) \ |
637 | void CBNAME(wxDC& a); \ | |
638 | void base_##CBNAME(wxDC& a); | |
639 | ||
640 | ||
19a97bd6 RD |
641 | #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ |
642 | void CLASS::CBNAME(wxDC& a) { \ | |
643 | bool found; \ | |
4268f798 | 644 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
645 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
646 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
647 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
648 | Py_DECREF(obj); \ | |
649 | } \ | |
4268f798 | 650 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
651 | if (! found) \ |
652 | PCLASS::CBNAME(a); \ | |
653 | } \ | |
654 | void CLASS::base_##CBNAME(wxDC& a) { \ | |
655 | PCLASS::CBNAME(a); \ | |
bb0054cd RD |
656 | } |
657 | ||
efc5f224 RD |
658 | |
659 | ||
bb0054cd RD |
660 | //--------------------------------------------------------------------------- |
661 | ||
d559219f RD |
662 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
663 | void CBNAME(wxDC& a, bool b); \ | |
664 | void base_##CBNAME(wxDC& a, bool b); | |
665 | ||
666 | ||
667 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ | |
668 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
19a97bd6 | 669 | bool found; \ |
4268f798 | 670 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
671 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
672 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 673 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ |
de20db99 RD |
674 | Py_DECREF(obj); \ |
675 | } \ | |
4268f798 | 676 | wxPyEndBlockThreads(); \ |
19a97bd6 | 677 | if (! found) \ |
efc5f224 RD |
678 | PCLASS::CBNAME(a, b); \ |
679 | } \ | |
d559219f | 680 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ |
efc5f224 RD |
681 | PCLASS::CBNAME(a, b); \ |
682 | } | |
683 | ||
684 | //--------------------------------------------------------------------------- | |
685 | ||
d559219f RD |
686 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
687 | void CBNAME(wxDC& a, bool b); \ | |
688 | void base_##CBNAME(wxDC& a, bool b); | |
689 | ||
690 | ||
691 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ | |
692 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
19a97bd6 | 693 | bool found; \ |
4268f798 | 694 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
695 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
696 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 697 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ |
de20db99 RD |
698 | Py_DECREF(obj); \ |
699 | } \ | |
4268f798 | 700 | wxPyEndBlockThreads(); \ |
19a97bd6 | 701 | if (! found) \ |
efc5f224 RD |
702 | PCLASS::CBNAME(a, b); \ |
703 | } \ | |
d559219f | 704 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ |
efc5f224 RD |
705 | PCLASS::CBNAME(a, b); \ |
706 | } | |
707 | ||
708 | //--------------------------------------------------------------------------- | |
709 | ||
d559219f RD |
710 | #define DEC_PYCALLBACK__2DBL(CBNAME) \ |
711 | void CBNAME(double a, double b); \ | |
712 | void base_##CBNAME(double a, double b); | |
713 | ||
714 | ||
19a97bd6 RD |
715 | #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ |
716 | void CLASS::CBNAME(double a, double b) { \ | |
717 | bool found; \ | |
4268f798 | 718 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
719 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
720 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \ | |
4268f798 | 721 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
722 | if (! found) \ |
723 | PCLASS::CBNAME(a, b); \ | |
724 | } \ | |
725 | void CLASS::base_##CBNAME(double a, double b) { \ | |
726 | PCLASS::CBNAME(a, b); \ | |
efc5f224 RD |
727 | } |
728 | ||
729 | //--------------------------------------------------------------------------- | |
730 | ||
d559219f RD |
731 | #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \ |
732 | void CBNAME(double a, double b, int c, int d); \ | |
733 | void base_##CBNAME(double a, double b, int c, int d); | |
734 | ||
735 | ||
736 | #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
737 | void CLASS::CBNAME(double a, double b, int c, int d) { \ | |
19a97bd6 | 738 | bool found; \ |
4268f798 | 739 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
740 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
741 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \ | |
efc5f224 | 742 | a,b,c,d)); \ |
4268f798 | 743 | wxPyEndBlockThreads(); \ |
19a97bd6 | 744 | if (! found) \ |
efc5f224 RD |
745 | PCLASS::CBNAME(a, b, c, d); \ |
746 | } \ | |
d559219f | 747 | void CLASS::base_##CBNAME(double a, double b, int c, int d) { \ |
efc5f224 RD |
748 | PCLASS::CBNAME(a, b, c, d); \ |
749 | } | |
750 | ||
751 | //--------------------------------------------------------------------------- | |
752 | ||
19a97bd6 | 753 | #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \ |
d559219f RD |
754 | void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ |
755 | void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f); | |
756 | ||
757 | ||
758 | #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ | |
759 | void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ | |
19a97bd6 | 760 | bool found; \ |
4268f798 | 761 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
762 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
763 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 764 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ |
de20db99 RD |
765 | Py_DECREF(obj); \ |
766 | } \ | |
4268f798 | 767 | wxPyEndBlockThreads(); \ |
19a97bd6 | 768 | if (! found) \ |
d559219f | 769 | PCLASS::CBNAME(a, b, c, d, e, f); \ |
d559219f RD |
770 | } \ |
771 | void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ | |
772 | PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
773 | } |
774 | ||
775 | //--------------------------------------------------------------------------- | |
776 | ||
d559219f RD |
777 | #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \ |
778 | bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ | |
779 | bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f); | |
780 | ||
781 | ||
782 | #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ | |
783 | bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ | |
19a97bd6 | 784 | bool found; \ |
4268f798 | 785 | wxPyBeginBlockThreads(); \ |
059a841c | 786 | bool rval=FALSE; \ |
19a97bd6 RD |
787 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
788 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 789 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ |
de20db99 RD |
790 | Py_DECREF(obj); \ |
791 | } \ | |
4268f798 | 792 | wxPyEndBlockThreads(); \ |
19a97bd6 | 793 | if (! found) \ |
99a49d3e | 794 | rval = PCLASS::CBNAME(a, b, c, d, e, f); \ |
99a49d3e | 795 | return rval; \ |
d559219f RD |
796 | } \ |
797 | bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ | |
798 | return PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
799 | } |
800 | ||
801 | //--------------------------------------------------------------------------- | |
802 | ||
d559219f RD |
803 | #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \ |
804 | void CBNAME(bool a, double b, double c, int d, int e); \ | |
805 | void base_##CBNAME(bool a, double b, double c, int d, int e); | |
806 | ||
807 | ||
808 | #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
809 | void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ | |
19a97bd6 | 810 | bool found; \ |
4268f798 | 811 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 812 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
f2e1c18a | 813 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \ |
d559219f | 814 | (int)a,b,c,d,e)); \ |
4268f798 | 815 | wxPyEndBlockThreads(); \ |
19a97bd6 | 816 | if (! found) \ |
d559219f | 817 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
818 | } \ |
819 | void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \ | |
820 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
821 | } |
822 | ||
823 | //--------------------------------------------------------------------------- | |
824 | ||
19a97bd6 | 825 | #define DEC_PYCALLBACK__DC4DBL(CBNAME) \ |
d559219f RD |
826 | void CBNAME(wxDC& a, double b, double c, double d, double e); \ |
827 | void base_##CBNAME(wxDC& a, double b, double c, double d, double e); | |
828 | ||
829 | ||
830 | #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ | |
831 | void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ | |
19a97bd6 | 832 | bool found; \ |
4268f798 | 833 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
834 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
835 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 836 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ |
de20db99 RD |
837 | Py_DECREF(obj); \ |
838 | } \ | |
4268f798 | 839 | wxPyEndBlockThreads(); \ |
19a97bd6 | 840 | if (! found) \ |
d559219f | 841 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
842 | } \ |
843 | void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\ | |
844 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
845 | } |
846 | ||
847 | //--------------------------------------------------------------------------- | |
848 | ||
d559219f RD |
849 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
850 | void CBNAME(wxDC& a, bool b); \ | |
851 | void base_##CBNAME(wxDC& a, bool b); | |
852 | ||
853 | ||
19a97bd6 RD |
854 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ |
855 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
856 | bool found; \ | |
4268f798 | 857 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
858 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
859 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
860 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ | |
861 | Py_DECREF(obj); \ | |
862 | } \ | |
4268f798 | 863 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
864 | if (! found) \ |
865 | PCLASS::CBNAME(a, b); \ | |
866 | } \ | |
867 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ | |
868 | PCLASS::CBNAME(a, b); \ | |
efc5f224 | 869 | } |
bb0054cd | 870 | |
7bf85405 | 871 | //--------------------------------------------------------------------------- |
7bf85405 | 872 | |
d559219f RD |
873 | #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \ |
874 | void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \ | |
875 | void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); | |
876 | ||
877 | ||
878 | #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
879 | void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \ | |
880 | int e, int f) { \ | |
19a97bd6 | 881 | bool found; \ |
4268f798 | 882 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
883 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
884 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1e7ecb7b | 885 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ |
de20db99 RD |
886 | Py_DECREF(obj); \ |
887 | } \ | |
4268f798 | 888 | wxPyEndBlockThreads(); \ |
19a97bd6 | 889 | if (! found) \ |
d559219f | 890 | PCLASS::CBNAME(a, b, c, d, e, f); \ |
d559219f RD |
891 | } \ |
892 | void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \ | |
893 | int e, int f) { \ | |
894 | PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
895 | } |
896 | ||
897 | //--------------------------------------------------------------------------- | |
898 | ||
d559219f RD |
899 | #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \ |
900 | void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \ | |
901 | void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e); | |
902 | ||
903 | ||
904 | #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
905 | void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ | |
19a97bd6 | 906 | bool found; \ |
4268f798 | 907 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
908 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
909 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1e7ecb7b | 910 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ |
de20db99 RD |
911 | Py_DECREF(obj); \ |
912 | } \ | |
4268f798 | 913 | wxPyEndBlockThreads(); \ |
19a97bd6 | 914 | if (! found) \ |
d559219f | 915 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
916 | } \ |
917 | void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \ | |
918 | int d, int e) { \ | |
919 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
920 | } |
921 | ||
922 | //--------------------------------------------------------------------------- | |
923 | ||
d559219f RD |
924 | #define DEC_PYCALLBACK__2DBLINT(CBNAME) \ |
925 | void CBNAME(double a, double b, int c); \ | |
926 | void base_##CBNAME(double a, double b, int c); | |
927 | ||
928 | ||
19a97bd6 RD |
929 | #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ |
930 | void CLASS::CBNAME(double a, double b, int c) { \ | |
931 | bool found; \ | |
4268f798 | 932 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
933 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
934 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \ | |
4268f798 | 935 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
936 | if (! found) \ |
937 | PCLASS::CBNAME(a, b, c); \ | |
938 | } \ | |
939 | void CLASS::base_##CBNAME(double a, double b, int c) { \ | |
940 | PCLASS::CBNAME(a, b, c); \ | |
efc5f224 RD |
941 | } |
942 | ||
943 | //--------------------------------------------------------------------------- | |
944 | ||
d559219f RD |
945 | #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \ |
946 | void CBNAME(bool a, double b, double c, int d); \ | |
947 | void base_##CBNAME(bool a, double b, double c, int d); | |
948 | ||
949 | ||
950 | #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ | |
951 | void CLASS::CBNAME(bool a, double b, double c, int d) { \ | |
19a97bd6 | 952 | bool found; \ |
a66212dc | 953 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
954 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
955 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\ | |
a66212dc | 956 | wxPyEndBlockThreads(); \ |
19a97bd6 | 957 | if (! found) \ |
d559219f | 958 | PCLASS::CBNAME(a, b, c, d); \ |
d559219f RD |
959 | } \ |
960 | void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \ | |
961 | PCLASS::CBNAME(a, b, c, d); \ | |
efc5f224 RD |
962 | } |
963 | ||
964 | //--------------------------------------------------------------------------- | |
965 | //--------------------------------------------------------------------------- | |
389c5527 RD |
966 | |
967 | #define DEC_PYCALLBACK__STRING(CBNAME) \ | |
968 | void CBNAME(const wxString& a); \ | |
969 | void base_##CBNAME(const wxString& a); | |
970 | ||
19a97bd6 RD |
971 | #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ |
972 | void CLASS::CBNAME(const wxString& a) { \ | |
973 | bool found; \ | |
a66212dc RD |
974 | wxPyBeginBlockThreads(); \ |
975 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
976 | PyObject* s = wx2PyString(a); \ | |
977 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
978 | Py_DECREF(s); \ | |
979 | } \ | |
980 | wxPyEndBlockThreads(); \ | |
19a97bd6 RD |
981 | if (! found) \ |
982 | PCLASS::CBNAME(a); \ | |
983 | } \ | |
984 | void CLASS::base_##CBNAME(const wxString& a) { \ | |
985 | PCLASS::CBNAME(a); \ | |
389c5527 RD |
986 | } |
987 | ||
988 | //--------------------------------------------------------------------------- | |
989 | ||
990 | #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \ | |
991 | bool CBNAME(const wxString& a); \ | |
992 | bool base_##CBNAME(const wxString& a); | |
993 | ||
389c5527 RD |
994 | #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \ |
995 | bool CLASS::CBNAME(const wxString& a) { \ | |
059a841c | 996 | bool rval=FALSE; \ |
19a97bd6 | 997 | bool found; \ |
a66212dc RD |
998 | wxPyBeginBlockThreads(); \ |
999 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1000 | PyObject* s = wx2PyString(a); \ | |
1001 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
1002 | Py_DECREF(s); \ | |
1003 | } \ | |
1004 | wxPyEndBlockThreads(); \ | |
19a97bd6 | 1005 | if (! found) \ |
389c5527 | 1006 | rval = PCLASS::CBNAME(a); \ |
389c5527 RD |
1007 | return rval; \ |
1008 | } \ | |
1009 | bool CLASS::base_##CBNAME(const wxString& a) { \ | |
1010 | return PCLASS::CBNAME(a); \ | |
1011 | } | |
1012 | ||
1013 | //--------------------------------------------------------------------------- | |
1014 | ||
c368d904 RD |
1015 | #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \ |
1016 | bool CBNAME(const wxString& a); | |
c8bc7bb8 | 1017 | |
a66212dc RD |
1018 | #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \ |
1019 | bool CLASS::CBNAME(const wxString& a) { \ | |
1020 | bool rval=FALSE; \ | |
1021 | wxPyBeginBlockThreads(); \ | |
1022 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
1023 | PyObject* s = wx2PyString(a); \ | |
1024 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
1025 | Py_DECREF(s); \ | |
1026 | } \ | |
1027 | wxPyEndBlockThreads(); \ | |
1028 | return rval; \ | |
1029 | } \ | |
c368d904 RD |
1030 | |
1031 | //--------------------------------------------------------------------------- | |
1032 | ||
1033 | #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \ | |
1034 | wxString CBNAME(const wxString& a); \ | |
1035 | ||
1036 | #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \ | |
1037 | wxString CLASS::CBNAME(const wxString& a) { \ | |
1038 | wxString rval; \ | |
a541c325 | 1039 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1040 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1041 | PyObject* ro; \ |
a66212dc RD |
1042 | PyObject* s = wx2PyString(a); \ |
1043 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \ | |
1044 | Py_DECREF(s); \ | |
c368d904 | 1045 | if (ro) { \ |
a541c325 RD |
1046 | rval = Py2wxString(ro); \ |
1047 | Py_DECREF(ro); \ | |
c368d904 RD |
1048 | } \ |
1049 | } \ | |
a541c325 | 1050 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1051 | return rval; \ |
1052 | } \ | |
1053 | ||
1054 | //--------------------------------------------------------------------------- | |
1055 | ||
1056 | #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \ | |
1057 | wxString CBNAME(const wxString& a,int b); \ | |
1058 | ||
1059 | #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \ | |
1060 | wxString CLASS::CBNAME(const wxString& a,int b) { \ | |
1061 | wxString rval; \ | |
a66212dc | 1062 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1063 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1064 | PyObject* ro; \ |
a66212dc RD |
1065 | PyObject* s = wx2PyString(a); \ |
1066 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \ | |
1067 | Py_DECREF(s); \ | |
c368d904 | 1068 | if (ro) { \ |
a541c325 RD |
1069 | rval = Py2wxString(ro); \ |
1070 | Py_DECREF(ro); \ | |
c368d904 RD |
1071 | } \ |
1072 | } \ | |
a541c325 | 1073 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1074 | return rval; \ |
1075 | } \ | |
1076 | ||
1077 | //--------------------------------------------------------------------------- | |
1078 | ||
f0261a72 RD |
1079 | #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \ |
1080 | bool CBNAME(const wxString& a, const wxString& b); \ | |
1081 | bool base_##CBNAME(const wxString& a, const wxString& b); | |
1082 | ||
f0261a72 RD |
1083 | #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \ |
1084 | bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ | |
059a841c | 1085 | bool rval=FALSE; \ |
19a97bd6 | 1086 | bool found; \ |
a66212dc RD |
1087 | wxPyBeginBlockThreads(); \ |
1088 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1089 | PyObject* s1 = wx2PyString(a); \ | |
1090 | PyObject* s2 = wx2PyString(b); \ | |
1091 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \ | |
1092 | Py_DECREF(s1); \ | |
1093 | Py_DECREF(s2); \ | |
1094 | } \ | |
a541c325 | 1095 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1096 | if (! found) \ |
f0261a72 | 1097 | rval = PCLASS::CBNAME(a, b); \ |
f0261a72 RD |
1098 | return rval; \ |
1099 | } \ | |
1100 | bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \ | |
1101 | return PCLASS::CBNAME(a, b); \ | |
1102 | } | |
1103 | ||
1104 | //--------------------------------------------------------------------------- | |
1105 | ||
389c5527 RD |
1106 | #define DEC_PYCALLBACK_STRING_(CBNAME) \ |
1107 | wxString CBNAME(); \ | |
1108 | wxString base_##CBNAME(); | |
1109 | ||
389c5527 RD |
1110 | #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \ |
1111 | wxString CLASS::CBNAME() { \ | |
1112 | wxString rval; \ | |
19a97bd6 | 1113 | bool found; \ |
4268f798 | 1114 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1115 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
389c5527 | 1116 | PyObject* ro; \ |
19a97bd6 | 1117 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 | 1118 | if (ro) { \ |
a541c325 RD |
1119 | rval = Py2wxString(ro); \ |
1120 | Py_DECREF(ro); \ | |
f6bcfd97 | 1121 | } \ |
389c5527 | 1122 | } \ |
a541c325 | 1123 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1124 | if (! found) \ |
b1462dfa | 1125 | rval = PCLASS::CBNAME(); \ |
389c5527 RD |
1126 | return rval; \ |
1127 | } \ | |
b1462dfa RD |
1128 | wxString CLASS::base_##CBNAME() { \ |
1129 | return PCLASS::CBNAME(); \ | |
389c5527 RD |
1130 | } |
1131 | ||
1132 | //--------------------------------------------------------------------------- | |
1133 | ||
1134 | #define DEC_PYCALLBACK_STRING__pure(CBNAME) \ | |
1135 | wxString CBNAME(); | |
1136 | ||
389c5527 RD |
1137 | #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \ |
1138 | wxString CLASS::CBNAME() { \ | |
1139 | wxString rval; \ | |
4268f798 | 1140 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1141 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
389c5527 | 1142 | PyObject* ro; \ |
19a97bd6 | 1143 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 | 1144 | if (ro) { \ |
a541c325 RD |
1145 | rval = Py2wxString(ro); \ |
1146 | Py_DECREF(ro); \ | |
f6bcfd97 | 1147 | } \ |
389c5527 | 1148 | } \ |
a541c325 | 1149 | wxPyEndBlockThreads(); \ |
389c5527 RD |
1150 | return rval; \ |
1151 | } | |
1152 | ||
1153 | //--------------------------------------------------------------------------- | |
1154 | ||
1155 | #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \ | |
1156 | bool CBNAME(const wxHtmlTag& a); \ | |
1157 | ||
1158 | ||
1159 | #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \ | |
1160 | bool CLASS::CBNAME(const wxHtmlTag& a) { \ | |
059a841c | 1161 | bool rval=FALSE; \ |
a66212dc | 1162 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1163 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
1164 | PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \ | |
1165 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
de20db99 RD |
1166 | Py_DECREF(obj); \ |
1167 | } \ | |
a66212dc | 1168 | wxPyEndBlockThreads(); \ |
389c5527 RD |
1169 | return rval; \ |
1170 | } | |
1171 | ||
0122b7e3 RD |
1172 | //--------------------------------------------------------------------------- |
1173 | ||
1174 | #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \ | |
1175 | void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \ | |
1176 | void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); | |
1177 | ||
1178 | #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \ | |
1179 | void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ | |
0122b7e3 | 1180 | bool found; \ |
a66212dc | 1181 | wxPyBeginBlockThreads(); \ |
0122b7e3 RD |
1182 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1183 | PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ | |
1184 | wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \ | |
1185 | Py_DECREF(obj); \ | |
1186 | } \ | |
a66212dc | 1187 | wxPyEndBlockThreads(); \ |
0122b7e3 RD |
1188 | if (! found) \ |
1189 | PCLASS::CBNAME(cell, x, y); \ | |
1190 | } \ | |
1191 | void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ | |
1192 | PCLASS::CBNAME(cell, x, y); \ | |
1193 | } | |
1194 | ||
1195 | ||
1196 | //--------------------------------------------------------------------------- | |
1197 | ||
1198 | #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \ | |
1199 | void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \ | |
1200 | void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); | |
1201 | ||
1202 | #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \ | |
1203 | void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ | |
1204 | bool found; \ | |
a66212dc | 1205 | wxPyBeginBlockThreads(); \ |
0122b7e3 RD |
1206 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1207 | PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ | |
1208 | PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ | |
1209 | wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \ | |
1210 | Py_DECREF(obj); \ | |
1211 | Py_DECREF(o2); \ | |
1212 | } \ | |
a66212dc | 1213 | wxPyEndBlockThreads(); \ |
0122b7e3 | 1214 | if (! found) \ |
a66212dc | 1215 | PCLASS::CBNAME(cell, x, y, e); \ |
0122b7e3 RD |
1216 | } \ |
1217 | void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ | |
a66212dc | 1218 | PCLASS::CBNAME(cell, x, y, e); \ |
0122b7e3 RD |
1219 | } |
1220 | ||
1221 | ||
1222 | ||
389c5527 | 1223 | //--------------------------------------------------------------------------- |
2f90df85 RD |
1224 | |
1225 | #define DEC_PYCALLBACK___pure(CBNAME) \ | |
1226 | void CBNAME(); \ | |
1227 | ||
1228 | ||
1229 | #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \ | |
1230 | void CLASS::CBNAME() { \ | |
a66212dc | 1231 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1232 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1233 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
a66212dc | 1234 | wxPyEndBlockThreads(); \ |
2f90df85 RD |
1235 | } |
1236 | ||
1237 | //--------------------------------------------------------------------------- | |
1238 | ||
1239 | #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \ | |
1240 | wxSize CBNAME(); \ | |
1241 | ||
1242 | ||
1243 | #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \ | |
1244 | wxSize CLASS::CBNAME() { \ | |
db0ff83e | 1245 | const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \ |
2f90df85 | 1246 | wxSize rval(0,0); \ |
db0ff83e | 1247 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1248 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
2f90df85 RD |
1249 | PyObject* ro; \ |
1250 | wxSize* ptr; \ | |
19a97bd6 | 1251 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 BP |
1252 | if (ro) { \ |
1253 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \ | |
1254 | rval = *ptr; \ | |
db0ff83e RD |
1255 | else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ |
1256 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
1257 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
1258 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) \ | |
1259 | rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \ | |
1260 | else \ | |
1261 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
1262 | Py_DECREF(o1); \ | |
1263 | Py_DECREF(o2); \ | |
1264 | } \ | |
1265 | else { \ | |
1266 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
1267 | } \ | |
f6bcfd97 BP |
1268 | Py_DECREF(ro); \ |
1269 | } \ | |
2f90df85 | 1270 | } \ |
db0ff83e | 1271 | wxPyEndBlockThreads(); \ |
2f90df85 RD |
1272 | return rval; \ |
1273 | } | |
1274 | ||
1275 | //--------------------------------------------------------------------------- | |
1276 | ||
1277 | #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \ | |
1278 | bool CBNAME(wxWindow* a); \ | |
1279 | bool base_##CBNAME(wxWindow* a); | |
1280 | ||
1281 | ||
19a97bd6 RD |
1282 | #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \ |
1283 | bool CLASS::CBNAME(wxWindow* a) { \ | |
059a841c | 1284 | bool rval=FALSE; \ |
19a97bd6 | 1285 | bool found; \ |
a66212dc | 1286 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1287 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1288 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1289 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1290 | Py_DECREF(obj); \ | |
1291 | } \ | |
a66212dc | 1292 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1293 | if (! found) \ |
1294 | rval = PCLASS::CBNAME(a); \ | |
1295 | return rval; \ | |
1296 | } \ | |
1297 | bool CLASS::base_##CBNAME(wxWindow* a) { \ | |
1298 | return PCLASS::CBNAME(a); \ | |
2f90df85 RD |
1299 | } |
1300 | ||
389c5527 | 1301 | //--------------------------------------------------------------------------- |
2f90df85 RD |
1302 | |
1303 | #define DEC_PYCALLBACK_BOOL_(CBNAME) \ | |
1304 | bool CBNAME(); \ | |
1305 | bool base_##CBNAME(); | |
1306 | ||
1307 | ||
19a97bd6 RD |
1308 | #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \ |
1309 | bool CLASS::CBNAME() { \ | |
059a841c | 1310 | bool rval=FALSE; \ |
19a97bd6 | 1311 | bool found; \ |
b0e5c039 | 1312 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1313 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1314 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
b0e5c039 | 1315 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1316 | if (! found) \ |
1317 | rval = PCLASS::CBNAME(); \ | |
1318 | return rval; \ | |
1319 | } \ | |
1320 | bool CLASS::base_##CBNAME() { \ | |
1321 | return PCLASS::CBNAME(); \ | |
2f90df85 RD |
1322 | } |
1323 | ||
b1462dfa RD |
1324 | //--------------------------------------------------------------------------- |
1325 | ||
b0e5c039 RD |
1326 | #define DEC_PYCALLBACK_BOOL_const(CBNAME) \ |
1327 | bool CBNAME() const; \ | |
1328 | bool base_##CBNAME() const; | |
1329 | ||
1330 | ||
1331 | #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \ | |
1332 | bool CLASS::CBNAME() const { \ | |
1333 | bool rval=FALSE; \ | |
1334 | bool found; \ | |
1335 | wxPyBeginBlockThreads(); \ | |
1336 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
1337 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
1338 | wxPyEndBlockThreads(); \ | |
1339 | if (! found) \ | |
1340 | rval = PCLASS::CBNAME(); \ | |
1341 | return rval; \ | |
1342 | } \ | |
1343 | bool CLASS::base_##CBNAME() const { \ | |
1344 | return PCLASS::CBNAME(); \ | |
1345 | } | |
1346 | ||
1347 | //--------------------------------------------------------------------------- | |
1348 | ||
19a97bd6 RD |
1349 | #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \ |
1350 | wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \ | |
b1462dfa RD |
1351 | wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def); |
1352 | ||
1353 | ||
19a97bd6 RD |
1354 | #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \ |
1355 | wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
059a841c | 1356 | int rval=0; \ |
19a97bd6 | 1357 | bool found; \ |
cac344f6 | 1358 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1359 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1e7ecb7b | 1360 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ |
cac344f6 | 1361 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1362 | if (! found) \ |
1363 | rval = PCLASS::CBNAME(a, b, c); \ | |
1364 | return (wxDragResult)rval; \ | |
1365 | } \ | |
1366 | wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
1367 | return PCLASS::CBNAME(a, b, c); \ | |
b1462dfa RD |
1368 | } |
1369 | ||
1370 | //--------------------------------------------------------------------------- | |
1371 | ||
c368d904 RD |
1372 | #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \ |
1373 | wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \ | |
1374 | ||
1375 | #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \ | |
1376 | wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \ | |
cac344f6 | 1377 | wxPyBeginBlockThreads(); \ |
c368d904 | 1378 | wxFSFile* rval=0; \ |
19a97bd6 | 1379 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1380 | PyObject* ro; \ |
19a97bd6 | 1381 | PyObject* obj = wxPyMake_wxObject(&a); \ |
a66212dc | 1382 | PyObject* s = wx2PyString(b); \ |
a541c325 | 1383 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\ |
a66212dc | 1384 | obj, s)); \ |
c368d904 RD |
1385 | if (ro) { \ |
1386 | SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \ | |
1387 | Py_DECREF(ro); \ | |
1388 | } \ | |
de20db99 | 1389 | Py_DECREF(obj); \ |
a66212dc | 1390 | Py_DECREF(s); \ |
de20db99 | 1391 | } \ |
cac344f6 | 1392 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1393 | return rval; \ |
1394 | }; | |
1395 | ||
1396 | //--------------------------------------------------------------------------- | |
1397 | ||
b1462dfa RD |
1398 | #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \ |
1399 | bool CBNAME(wxDragResult a); \ | |
1400 | bool base_##CBNAME(wxDragResult a); | |
1401 | ||
1402 | ||
1403 | #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \ | |
1404 | bool CLASS::CBNAME(wxDragResult a) { \ | |
059a841c | 1405 | bool rval=FALSE; \ |
19a97bd6 | 1406 | bool found; \ |
a541c325 | 1407 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1408 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1409 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\ | |
a541c325 | 1410 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1411 | if (! found) \ |
b1462dfa | 1412 | rval = PCLASS::CBNAME(a); \ |
b1462dfa RD |
1413 | return rval; \ |
1414 | } \ | |
1415 | bool CLASS::base_##CBNAME(wxDragResult a) { \ | |
1416 | return PCLASS::CBNAME(a); \ | |
1417 | } | |
1418 | ||
1419 | //--------------------------------------------------------------------------- | |
1420 | ||
1421 | #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \ | |
1422 | wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); | |
1423 | ||
1424 | ||
1425 | #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \ | |
1426 | wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
a541c325 | 1427 | wxPyBeginBlockThreads(); \ |
059a841c | 1428 | int rval=0; \ |
19a97bd6 | 1429 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1e7ecb7b | 1430 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ |
a541c325 | 1431 | wxPyEndBlockThreads(); \ |
b1462dfa RD |
1432 | return (wxDragResult)rval; \ |
1433 | } \ | |
1434 | ||
1435 | //--------------------------------------------------------------------------- | |
1436 | ||
1437 | #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \ | |
1438 | bool CBNAME(int a, int b, const wxString& c); | |
1439 | ||
b1462dfa RD |
1440 | #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \ |
1441 | bool CLASS::CBNAME(int a, int b, const wxString& c) { \ | |
059a841c | 1442 | bool rval=FALSE; \ |
a541c325 | 1443 | wxPyBeginBlockThreads(); \ |
a66212dc RD |
1444 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
1445 | PyObject* s = wx2PyString(c); \ | |
1446 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ | |
1447 | Py_DECREF(s); \ | |
1448 | } \ | |
a541c325 | 1449 | wxPyEndBlockThreads(); \ |
b1462dfa RD |
1450 | return rval; \ |
1451 | } \ | |
1452 | ||
1453 | //--------------------------------------------------------------------------- | |
1454 | ||
1455 | #define DEC_PYCALLBACK_SIZET_(CBNAME) \ | |
1456 | size_t CBNAME(); \ | |
1457 | size_t base_##CBNAME(); | |
1458 | ||
1459 | ||
1460 | #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \ | |
1461 | size_t CLASS::CBNAME() { \ | |
059a841c | 1462 | size_t rval=0; \ |
19a97bd6 | 1463 | bool found; \ |
a541c325 | 1464 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1465 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1466 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
a541c325 | 1467 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1468 | if (! found) \ |
b1462dfa | 1469 | rval = PCLASS::CBNAME(); \ |
b1462dfa RD |
1470 | return rval; \ |
1471 | } \ | |
1472 | size_t CLASS::base_##CBNAME() { \ | |
1473 | return PCLASS::CBNAME(); \ | |
1474 | } | |
1475 | ||
1476 | //--------------------------------------------------------------------------- | |
1477 | ||
c7e7022c RD |
1478 | #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \ |
1479 | wxDataFormat CBNAME(size_t a); \ | |
1480 | wxDataFormat base_##CBNAME(size_t a); | |
b1462dfa RD |
1481 | |
1482 | ||
1483 | #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \ | |
1484 | wxDataFormat CLASS::CBNAME(size_t a) { \ | |
059a841c | 1485 | wxDataFormat rval=0; \ |
19a97bd6 | 1486 | bool found; \ |
a541c325 | 1487 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1488 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
b1462dfa RD |
1489 | PyObject* ro; \ |
1490 | wxDataFormat* ptr; \ | |
c7e7022c | 1491 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \ |
f6bcfd97 BP |
1492 | if (ro) { \ |
1493 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \ | |
1494 | rval = *ptr; \ | |
1495 | Py_DECREF(ro); \ | |
1496 | } \ | |
b1462dfa | 1497 | } \ |
a541c325 | 1498 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1499 | if (! found) \ |
b1462dfa | 1500 | rval = PCLASS::CBNAME(a); \ |
b1462dfa RD |
1501 | return rval; \ |
1502 | } \ | |
1503 | wxDataFormat CLASS::base_##CBNAME(size_t a) { \ | |
1504 | return PCLASS::CBNAME(a); \ | |
1505 | } | |
1506 | ||
389c5527 | 1507 | //--------------------------------------------------------------------------- |
f6bcfd97 BP |
1508 | |
1509 | #define DEC_PYCALLBACK__constany(CBNAME, Type) \ | |
1510 | void CBNAME(const Type& a); \ | |
1511 | void base_##CBNAME(const Type& a); | |
1512 | ||
1513 | ||
19a97bd6 RD |
1514 | #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ |
1515 | void CLASS::CBNAME(const Type& a) { \ | |
1516 | bool found; \ | |
a541c325 | 1517 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1518 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1519 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1520 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1521 | Py_DECREF(obj); \ | |
1522 | } \ | |
a541c325 | 1523 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1524 | if (! found) \ |
1525 | PCLASS::CBNAME(a); \ | |
1526 | } \ | |
1527 | void CLASS::base_##CBNAME(const Type& a) { \ | |
1528 | PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1529 | } |
1530 | ||
1531 | ||
1532 | //--------------------------------------------------------------------------- | |
1533 | ||
1534 | #define DEC_PYCALLBACK__any(CBNAME, Type) \ | |
1535 | void CBNAME(Type& a); \ | |
1536 | void base_##CBNAME(Type& a); | |
1537 | ||
1538 | ||
19a97bd6 RD |
1539 | #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ |
1540 | void CLASS::CBNAME(Type& a) { \ | |
1541 | bool found; \ | |
a541c325 | 1542 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1543 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1544 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1545 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1546 | Py_DECREF(obj); \ | |
1547 | } \ | |
a541c325 | 1548 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1549 | if (! found) \ |
1550 | PCLASS::CBNAME(a); \ | |
1551 | } \ | |
1552 | void CLASS::base_##CBNAME(Type& a) { \ | |
1553 | PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1554 | } |
1555 | ||
efc5f224 | 1556 | //--------------------------------------------------------------------------- |
f6bcfd97 BP |
1557 | |
1558 | #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \ | |
1559 | bool CBNAME(Type& a); \ | |
1560 | bool base_##CBNAME(Type& a); | |
1561 | ||
1562 | ||
19a97bd6 RD |
1563 | #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \ |
1564 | bool CLASS::CBNAME(Type& a) { \ | |
36fd8ec3 | 1565 | bool rv=FALSE; \ |
19a97bd6 | 1566 | bool found; \ |
a541c325 | 1567 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1568 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1569 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1570 | rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1571 | Py_DECREF(obj); \ | |
1572 | } \ | |
a541c325 | 1573 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1574 | if (! found) \ |
1575 | rv = PCLASS::CBNAME(a); \ | |
1576 | return rv; \ | |
1577 | } \ | |
1578 | bool CLASS::base_##CBNAME(Type& a) { \ | |
1579 | return PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1580 | } |
1581 | ||
efc5f224 RD |
1582 | //--------------------------------------------------------------------------- |
1583 | ||
c7e7022c RD |
1584 | #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \ |
1585 | wxString CBNAME(long a, long b) const; \ | |
1586 | wxString base_##CBNAME(long a, long b)const ; | |
1587 | ||
c7e7022c RD |
1588 | #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \ |
1589 | wxString CLASS::CBNAME(long a, long b) const { \ | |
1590 | wxString rval; \ | |
19a97bd6 | 1591 | bool found; \ |
a541c325 | 1592 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1593 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1594 | PyObject* ro; \ |
1595 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \ | |
1596 | if (ro) { \ | |
a541c325 RD |
1597 | rval = Py2wxString(ro); \ |
1598 | Py_DECREF(ro); \ | |
c7e7022c RD |
1599 | } \ |
1600 | } \ | |
a541c325 | 1601 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1602 | if (! found) \ |
c7e7022c | 1603 | rval = PCLASS::CBNAME(a,b); \ |
c7e7022c RD |
1604 | return rval; \ |
1605 | } \ | |
1606 | wxString CLASS::base_##CBNAME(long a, long b) const { \ | |
1607 | return PCLASS::CBNAME(a,b); \ | |
1608 | } | |
1609 | ||
1610 | //--------------------------------------------------------------------------- | |
1611 | ||
1612 | #define DEC_PYCALLBACK_INT_LONG(CBNAME) \ | |
1613 | int CBNAME(long a) const; \ | |
1614 | int base_##CBNAME(long a)const ; | |
1615 | ||
1616 | ||
1617 | #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \ | |
1618 | int CLASS::CBNAME(long a) const { \ | |
1619 | int rval=-1; \ | |
19a97bd6 | 1620 | bool found; \ |
a541c325 | 1621 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1622 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1623 | PyObject* ro; \ |
1624 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ | |
1625 | if (ro) { \ | |
1626 | rval = PyInt_AsLong(ro); \ | |
1627 | Py_DECREF(ro); \ | |
1628 | } \ | |
1629 | } \ | |
a541c325 | 1630 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1631 | if (! found) \ |
c7e7022c | 1632 | rval = PCLASS::CBNAME(a); \ |
c7e7022c RD |
1633 | return rval; \ |
1634 | } \ | |
1635 | int CLASS::base_##CBNAME(long a) const { \ | |
1636 | return PCLASS::CBNAME(a); \ | |
1637 | } | |
1638 | ||
1639 | ||
1640 | //--------------------------------------------------------------------------- | |
1641 | ||
1642 | #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \ | |
00b6c4e3 | 1643 | wxListItemAttr* CBNAME(long a) const; \ |
c7e7022c RD |
1644 | wxListItemAttr* base_##CBNAME(long a); |
1645 | ||
1646 | ||
1647 | #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \ | |
00b6c4e3 | 1648 | wxListItemAttr *CLASS::CBNAME(long a) const { \ |
c7e7022c | 1649 | wxListItemAttr *rval = NULL; \ |
19a97bd6 | 1650 | bool found; \ |
a541c325 | 1651 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1652 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1653 | PyObject* ro; \ |
1654 | wxListItemAttr* ptr; \ | |
1655 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \ | |
1656 | if (ro) { \ | |
1657 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \ | |
1658 | rval = ptr; \ | |
1659 | Py_DECREF(ro); \ | |
1660 | } \ | |
1661 | } \ | |
a541c325 | 1662 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1663 | if (! found) \ |
c7e7022c | 1664 | rval = PCLASS::CBNAME(a); \ |
c7e7022c RD |
1665 | return rval; \ |
1666 | } \ | |
1667 | wxListItemAttr *CLASS::base_##CBNAME(long a) { \ | |
1668 | return PCLASS::CBNAME(a); \ | |
1669 | } | |
1670 | ||
1671 | //--------------------------------------------------------------------------- | |
1672 | ||
a541c325 RD |
1673 | #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \ |
1674 | bool CBNAME(wxMouseEvent& e); \ | |
0122b7e3 RD |
1675 | bool base_##CBNAME(wxMouseEvent& e); |
1676 | ||
a541c325 RD |
1677 | #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \ |
1678 | bool CLASS::CBNAME(wxMouseEvent& e) { \ | |
1679 | bool rval=FALSE; \ | |
1680 | bool found; \ | |
1681 | wxPyBeginBlockThreads(); \ | |
1682 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1683 | PyObject* ro; \ | |
1684 | PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ | |
1685 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \ | |
1686 | if (ro) { \ | |
1687 | rval = PyInt_AsLong(ro); \ | |
1688 | Py_DECREF(ro); \ | |
1689 | } \ | |
1690 | Py_DECREF(obj); \ | |
1691 | } \ | |
1692 | wxPyEndBlockThreads(); \ | |
1693 | if (! found) \ | |
1694 | return PCLASS::CBNAME(e); \ | |
1695 | return rval; \ | |
1696 | } \ | |
1697 | bool CLASS::base_##CBNAME(wxMouseEvent& e) { \ | |
1698 | return PCLASS::CBNAME(e); \ | |
0122b7e3 RD |
1699 | } |
1700 | ||
1701 | ||
1702 | //--------------------------------------------------------------------------- | |
1703 | ||
7bf85405 | 1704 | #endif |