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