1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: Helper functions/classes for the wxPython extenaion module
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __wxp_helpers__
14 #define __wxp_helpers__
19 //---------------------------------------------------------------------------
21 typedef unsigned char byte
;
24 class wxPyApp
: public wxApp
33 extern wxPyApp
*wxPythonApp
;
35 //----------------------------------------------------------------------
38 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
41 //extern PyObject* wxPython_dict;
42 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
44 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
46 PyObject
* wxPyConstructObject(void* ptr
,
47 const wxString
& className
,
49 PyObject
* wxPyConstructObject(void* ptr
,
50 const wxString
& className
,
54 PyObject
* wx2PyString(const wxString
& src
);
55 wxString
Py2wxString(PyObject
* source
);
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
);
62 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
63 long wxPyGetWinHandle(wxWindow
* win
);
65 //----------------------------------------------------------------------
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
76 PyThreadState
* wxPyBeginAllowThreads();
77 void wxPyEndAllowThreads(PyThreadState
* state
);
80 void wxPyBeginBlockThreads();
81 void wxPyEndBlockThreads();
83 //----------------------------------------------------------------------
84 // These are helpers used by the typemaps
86 wxString
* wxString_in_helper(PyObject
* source
);
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
);
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
);
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))
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
);
113 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
114 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
117 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
119 //----------------------------------------------------------------------
122 extern "C" void SWIG_MakePtr(char *, void *, char *);
123 extern "C" char *SWIG_GetPtr(char *, void **, char *);
124 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
129 # pragma warning(disable:4800)
130 # pragma warning(disable:4190)
133 //----------------------------------------------------------------------
135 class wxPyCallback
: public wxObject
{
136 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
138 wxPyCallback(PyObject
* func
);
139 wxPyCallback(const wxPyCallback
& other
);
142 void EventThunker(wxEvent
& event
);
147 //---------------------------------------------------------------------------
149 class wxPyTimer
: public wxTimer
{
151 wxPyTimer(PyObject
* callback
);
160 //---------------------------------------------------------------------------
161 //---------------------------------------------------------------------------
162 // These Event classes can be derived from in Python and passed through the
163 // event system without loosing anything. They do this by keeping a reference
164 // to themselves and some special case handling in wxPyCallback::EventThunker.
167 class wxPyEvtSelfRef
{
172 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
173 PyObject
* GetSelf() const;
181 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
182 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
185 wxPyEvent(const wxPyEvent
& evt
);
188 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
192 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
193 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
195 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
196 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
199 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
203 //---------------------------------------------------------------------------
204 // Export a C API in a struct. Other modules will be able to load this from
205 // the wxc module and will then have safe access to these functions, even if
206 // in another shared library.
208 class wxPyCallbackHelper
;
212 void (*p_SWIG_MakePtr
)(char*, void*, char*);
213 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
214 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
215 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
216 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
217 PyObject
* (*p_SWIG_newvarlink
)(void);
219 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
220 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
221 void (*p_wxPyBeginBlockThreads
)();
222 void (*p_wxPyEndBlockThreads
)();
224 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
225 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
227 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
228 wxString (*p_Py2wxString
)(PyObject
* source
);
229 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
231 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
232 int* (*p_int_LIST_helper
)(PyObject
* source
);
233 long* (*p_long_LIST_helper
)(PyObject
* source
);
234 char** (*p_string_LIST_helper
)(PyObject
* source
);
235 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
236 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
237 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
238 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
240 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
241 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
242 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
243 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
244 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
246 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
247 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
248 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
249 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
250 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
252 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
253 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
254 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
255 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
256 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
257 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
260 #ifdef wxPyUSE_EXPORT
261 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
264 //---------------------------------------------------------------------------
265 // This class holds an instance of a Python Shadow Class object and assists
266 // with looking up and invoking Python callback methods from C++ virtual
267 // method redirections. For all classes which have virtuals which should be
268 // overridable in wxPython, a new subclass is created that contains a
269 // wxPyCallbackHelper.
272 class wxPyCallbackHelper
{
274 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
276 wxPyCallbackHelper() {
283 ~wxPyCallbackHelper() {
284 #ifdef wxPyUSE_EXPORT
285 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
287 wxPyCBH_delete(this);
291 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
292 bool findCallback(const char* name
) const;
293 int callCallback(PyObject
* argTuple
) const;
294 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
299 PyObject
* m_lastFound
;
302 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
306 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
307 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
308 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
309 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
310 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
314 //----------------------------------------------------------------------
316 class wxPyUserData
: public wxObject
{
318 wxPyUserData(PyObject
* obj
) {
324 #ifdef wxPyUSE_EXPORT
325 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
327 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
329 wxPyBeginBlockThreads();
331 wxPyEndBlockThreads();
339 class wxPyClientData
: public wxClientData
{
341 wxPyClientData(PyObject
* obj
) {
347 #ifdef wxPyUSE_EXPORT
348 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
350 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
352 wxPyBeginBlockThreads();
354 wxPyEndBlockThreads();
362 //---------------------------------------------------------------------------
363 // These macros are used to implement the virtual methods that should
364 // redirect to a Python method if one exists. The names designate the
365 // return type, if any, as well as any parameter types.
366 //---------------------------------------------------------------------------
369 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
370 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
372 private: wxPyCallbackHelper m_myInst
374 //---------------------------------------------------------------------------
376 #define DEC_PYCALLBACK__(CBNAME) \
378 void base_##CBNAME();
381 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
382 void CLASS::CBNAME() { \
384 wxPyBeginBlockThreads(); \
385 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
386 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
387 wxPyEndBlockThreads(); \
391 void CLASS::base_##CBNAME() { \
395 //---------------------------------------------------------------------------
397 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
398 bool CBNAME(int a, int b); \
399 bool base_##CBNAME(int a, int b);
402 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
403 bool CLASS::CBNAME(int a, int b) { \
404 bool rval=FALSE, found; \
405 wxPyBeginBlockThreads(); \
406 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
407 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
408 wxPyEndBlockThreads(); \
410 rval = PCLASS::CBNAME(a,b); \
413 bool CLASS::base_##CBNAME(int a, int b) { \
414 return PCLASS::CBNAME(a,b); \
417 //---------------------------------------------------------------------------
419 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
420 void CBNAME(int a, int b); \
421 void base_##CBNAME(int a, int b);
424 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
425 void CLASS::CBNAME(int a, int b) { \
427 wxPyBeginBlockThreads(); \
428 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
429 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
430 wxPyEndBlockThreads(); \
432 PCLASS::CBNAME(a,b); \
434 void CLASS::base_##CBNAME(int a, int b) { \
435 PCLASS::CBNAME(a,b); \
438 //---------------------------------------------------------------------------
440 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
441 bool CBNAME(int a); \
442 bool base_##CBNAME(int a);
445 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
446 bool CLASS::CBNAME(int a) { \
447 bool rval=FALSE, found; \
448 wxPyBeginBlockThreads(); \
449 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
450 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
451 wxPyEndBlockThreads(); \
453 rval = PCLASS::CBNAME(a); \
456 bool CLASS::base_##CBNAME(int a) { \
457 return PCLASS::CBNAME(a); \
460 //---------------------------------------------------------------------------
462 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
466 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
467 bool CLASS::CBNAME(int a) { \
469 wxPyBeginBlockThreads(); \
470 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
471 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
473 wxPyEndBlockThreads(); \
478 //---------------------------------------------------------------------------
480 #define DEC_PYCALLBACK__DC(CBNAME) \
481 void CBNAME(wxDC& a); \
482 void base_##CBNAME(wxDC& a);
485 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
486 void CLASS::CBNAME(wxDC& a) { \
488 wxPyBeginBlockThreads(); \
489 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
490 PyObject* obj = wxPyMake_wxObject(&a); \
491 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
494 wxPyEndBlockThreads(); \
498 void CLASS::base_##CBNAME(wxDC& a) { \
504 //---------------------------------------------------------------------------
506 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
507 void CBNAME(wxDC& a, bool b); \
508 void base_##CBNAME(wxDC& a, bool b);
511 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
512 void CLASS::CBNAME(wxDC& a, bool b) { \
514 wxPyBeginBlockThreads(); \
515 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
516 PyObject* obj = wxPyMake_wxObject(&a); \
517 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
520 wxPyEndBlockThreads(); \
522 PCLASS::CBNAME(a, b); \
524 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
525 PCLASS::CBNAME(a, b); \
528 //---------------------------------------------------------------------------
530 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
531 void CBNAME(wxDC& a, bool b); \
532 void base_##CBNAME(wxDC& a, bool b);
535 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
536 void CLASS::CBNAME(wxDC& a, bool b) { \
538 wxPyBeginBlockThreads(); \
539 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
540 PyObject* obj = wxPyMake_wxObject(&a); \
541 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
544 wxPyEndBlockThreads(); \
546 PCLASS::CBNAME(a, b); \
548 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
549 PCLASS::CBNAME(a, b); \
552 //---------------------------------------------------------------------------
554 #define DEC_PYCALLBACK__2DBL(CBNAME) \
555 void CBNAME(double a, double b); \
556 void base_##CBNAME(double a, double b);
559 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
560 void CLASS::CBNAME(double a, double b) { \
562 wxPyBeginBlockThreads(); \
563 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
564 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
565 wxPyEndBlockThreads(); \
567 PCLASS::CBNAME(a, b); \
569 void CLASS::base_##CBNAME(double a, double b) { \
570 PCLASS::CBNAME(a, b); \
573 //---------------------------------------------------------------------------
575 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
576 void CBNAME(double a, double b, int c, int d); \
577 void base_##CBNAME(double a, double b, int c, int d);
580 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
581 void CLASS::CBNAME(double a, double b, int c, int d) { \
583 wxPyBeginBlockThreads(); \
584 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
585 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
587 wxPyEndBlockThreads(); \
589 PCLASS::CBNAME(a, b, c, d); \
591 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
592 PCLASS::CBNAME(a, b, c, d); \
595 //---------------------------------------------------------------------------
597 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
598 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
599 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
602 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
603 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
605 wxPyBeginBlockThreads(); \
606 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
607 PyObject* obj = wxPyMake_wxObject(&a); \
608 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
611 wxPyEndBlockThreads(); \
613 PCLASS::CBNAME(a, b, c, d, e, f); \
615 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
616 PCLASS::CBNAME(a, b, c, d, e, f); \
619 //---------------------------------------------------------------------------
621 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
622 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
623 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
626 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
627 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
629 wxPyBeginBlockThreads(); \
631 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
632 PyObject* obj = wxPyMake_wxObject(&a); \
633 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
636 wxPyEndBlockThreads(); \
638 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
641 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
642 return PCLASS::CBNAME(a, b, c, d, e, f); \
645 //---------------------------------------------------------------------------
647 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
648 void CBNAME(bool a, double b, double c, int d, int e); \
649 void base_##CBNAME(bool a, double b, double c, int d, int e);
652 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
653 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
655 wxPyBeginBlockThreads(); \
656 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
657 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
659 wxPyEndBlockThreads(); \
661 PCLASS::CBNAME(a, b, c, d, e); \
663 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
664 PCLASS::CBNAME(a, b, c, d, e); \
667 //---------------------------------------------------------------------------
669 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
670 void CBNAME(wxDC& a, double b, double c, double d, double e); \
671 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
674 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
675 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
677 wxPyBeginBlockThreads(); \
678 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
679 PyObject* obj = wxPyMake_wxObject(&a); \
680 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
683 wxPyEndBlockThreads(); \
685 PCLASS::CBNAME(a, b, c, d, e); \
687 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
688 PCLASS::CBNAME(a, b, c, d, e); \
691 //---------------------------------------------------------------------------
693 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
694 void CBNAME(wxDC& a, bool b); \
695 void base_##CBNAME(wxDC& a, bool b);
698 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
699 void CLASS::CBNAME(wxDC& a, bool b) { \
701 wxPyBeginBlockThreads(); \
702 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
703 PyObject* obj = wxPyMake_wxObject(&a); \
704 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
707 wxPyEndBlockThreads(); \
709 PCLASS::CBNAME(a, b); \
711 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
712 PCLASS::CBNAME(a, b); \
715 //---------------------------------------------------------------------------
717 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
718 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
719 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
722 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
723 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
726 wxPyBeginBlockThreads(); \
727 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
728 PyObject* obj = wxPyMake_wxObject(a); \
729 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
732 wxPyEndBlockThreads(); \
734 PCLASS::CBNAME(a, b, c, d, e, f); \
736 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
738 PCLASS::CBNAME(a, b, c, d, e, f); \
741 //---------------------------------------------------------------------------
743 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
744 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
745 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
748 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
749 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
751 wxPyBeginBlockThreads(); \
752 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
753 PyObject* obj = wxPyMake_wxObject(a); \
754 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
757 wxPyEndBlockThreads(); \
759 PCLASS::CBNAME(a, b, c, d, e); \
761 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
763 PCLASS::CBNAME(a, b, c, d, e); \
766 //---------------------------------------------------------------------------
768 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
769 void CBNAME(double a, double b, int c); \
770 void base_##CBNAME(double a, double b, int c);
773 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
774 void CLASS::CBNAME(double a, double b, int c) { \
776 wxPyBeginBlockThreads(); \
777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
778 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
779 wxPyEndBlockThreads(); \
781 PCLASS::CBNAME(a, b, c); \
783 void CLASS::base_##CBNAME(double a, double b, int c) { \
784 PCLASS::CBNAME(a, b, c); \
787 //---------------------------------------------------------------------------
789 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
790 void CBNAME(bool a, double b, double c, int d); \
791 void base_##CBNAME(bool a, double b, double c, int d);
794 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
795 void CLASS::CBNAME(bool a, double b, double c, int d) { \
797 wxPyBeginBlockThreads(); \
798 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
799 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
800 wxPyEndBlockThreads(); \
802 PCLASS::CBNAME(a, b, c, d); \
804 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
805 PCLASS::CBNAME(a, b, c, d); \
808 //---------------------------------------------------------------------------
809 //---------------------------------------------------------------------------
811 #define DEC_PYCALLBACK__STRING(CBNAME) \
812 void CBNAME(const wxString& a); \
813 void base_##CBNAME(const wxString& a);
815 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
816 void CLASS::CBNAME(const wxString& a) { \
818 wxPyBeginBlockThreads(); \
819 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
820 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
821 wxPyEndBlockThreads(); \
825 void CLASS::base_##CBNAME(const wxString& a) { \
829 //---------------------------------------------------------------------------
831 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
832 bool CBNAME(const wxString& a); \
833 bool base_##CBNAME(const wxString& a);
835 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
836 bool CLASS::CBNAME(const wxString& a) { \
839 wxPyBeginBlockThreads(); \
840 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
841 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
842 wxPyEndBlockThreads(); \
844 rval = PCLASS::CBNAME(a); \
847 bool CLASS::base_##CBNAME(const wxString& a) { \
848 return PCLASS::CBNAME(a); \
851 //---------------------------------------------------------------------------
853 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
854 bool CBNAME(const wxString& a);
856 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
857 bool CLASS::CBNAME(const wxString& a) { \
859 wxPyBeginBlockThreads(); \
860 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
861 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
862 wxPyEndBlockThreads(); \
866 //---------------------------------------------------------------------------
868 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
869 wxString CBNAME(const wxString& a); \
871 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
872 wxString CLASS::CBNAME(const wxString& a) { \
874 wxPyBeginBlockThreads(); \
875 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
877 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
879 rval = Py2wxString(ro); \
883 wxPyEndBlockThreads(); \
887 //---------------------------------------------------------------------------
889 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
890 wxString CBNAME(const wxString& a,int b); \
892 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
893 wxString CLASS::CBNAME(const wxString& a,int b) { \
895 wxPyBeginBlockThreads(); \
896 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
898 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
900 rval = Py2wxString(ro); \
904 wxPyEndBlockThreads(); \
908 //---------------------------------------------------------------------------
910 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
911 bool CBNAME(const wxString& a, const wxString& b); \
912 bool base_##CBNAME(const wxString& a, const wxString& b);
914 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
915 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
918 wxPyBeginBlockThreads(); \
919 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
920 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
921 wx2PyString(a), wx2PyString(b))); \
922 wxPyEndBlockThreads(); \
924 rval = PCLASS::CBNAME(a, b); \
927 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
928 return PCLASS::CBNAME(a, b); \
931 //---------------------------------------------------------------------------
933 #define DEC_PYCALLBACK_STRING_(CBNAME) \
935 wxString base_##CBNAME();
937 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
938 wxString CLASS::CBNAME() { \
941 wxPyBeginBlockThreads(); \
942 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
944 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
946 rval = Py2wxString(ro); \
950 wxPyEndBlockThreads(); \
952 rval = PCLASS::CBNAME(); \
955 wxString CLASS::base_##CBNAME() { \
956 return PCLASS::CBNAME(); \
959 //---------------------------------------------------------------------------
961 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
964 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
965 wxString CLASS::CBNAME() { \
967 wxPyBeginBlockThreads(); \
968 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
970 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
972 rval = Py2wxString(ro); \
976 wxPyEndBlockThreads(); \
980 //---------------------------------------------------------------------------
982 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
983 bool CBNAME(const wxHtmlTag& a); \
986 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
987 bool CLASS::CBNAME(const wxHtmlTag& a) { \
989 wxPyBeginBlockThreads(); \
990 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
991 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
992 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
995 wxPyEndBlockThreads(); \
999 //---------------------------------------------------------------------------
1001 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1002 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1003 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1005 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1006 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1008 wxPyBeginBlockThreads(); \
1009 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1010 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1011 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1014 wxPyEndBlockThreads(); \
1016 PCLASS::CBNAME(cell, x, y); \
1018 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1019 PCLASS::CBNAME(cell, x, y); \
1023 //---------------------------------------------------------------------------
1025 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1026 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1027 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1029 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1030 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1032 wxPyBeginBlockThreads(); \
1033 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1034 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1035 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1036 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1040 wxPyEndBlockThreads(); \
1042 PCLASS::CBNAME(cell, x, y, e); \
1044 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1045 PCLASS::CBNAME(cell, x, y, e); \
1050 //---------------------------------------------------------------------------
1052 #define DEC_PYCALLBACK___pure(CBNAME) \
1056 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1057 void CLASS::CBNAME() { \
1058 wxPyBeginBlockThreads(); \
1059 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1060 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1061 wxPyEndBlockThreads(); \
1064 //---------------------------------------------------------------------------
1066 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1070 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1071 wxSize CLASS::CBNAME() { \
1073 wxPyBeginBlockThreads(); \
1074 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1077 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1079 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1084 wxPyEndBlockThreads(); \
1088 //---------------------------------------------------------------------------
1090 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1091 bool CBNAME(wxWindow* a); \
1092 bool base_##CBNAME(wxWindow* a);
1095 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1096 bool CLASS::CBNAME(wxWindow* a) { \
1099 wxPyBeginBlockThreads(); \
1100 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1101 PyObject* obj = wxPyMake_wxObject(a); \
1102 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1105 wxPyEndBlockThreads(); \
1107 rval = PCLASS::CBNAME(a); \
1110 bool CLASS::base_##CBNAME(wxWindow* a) { \
1111 return PCLASS::CBNAME(a); \
1114 //---------------------------------------------------------------------------
1116 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1118 bool base_##CBNAME();
1121 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1122 bool CLASS::CBNAME() { \
1125 wxPyBeginBlockThreads(); \
1126 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1127 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1128 wxPyEndBlockThreads(); \
1130 rval = PCLASS::CBNAME(); \
1133 bool CLASS::base_##CBNAME() { \
1134 return PCLASS::CBNAME(); \
1137 //---------------------------------------------------------------------------
1139 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1140 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1141 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1144 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1145 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1148 wxPyBeginBlockThreads(); \
1149 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1150 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1151 wxPyEndBlockThreads(); \
1153 rval = PCLASS::CBNAME(a, b, c); \
1154 return (wxDragResult)rval; \
1156 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1157 return PCLASS::CBNAME(a, b, c); \
1160 //---------------------------------------------------------------------------
1162 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1163 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1165 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1166 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1167 wxPyBeginBlockThreads(); \
1169 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1171 PyObject* obj = wxPyMake_wxObject(&a); \
1172 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1173 obj, wx2PyString)); \
1175 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1180 wxPyEndBlockThreads(); \
1184 //---------------------------------------------------------------------------
1186 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1187 bool CBNAME(wxDragResult a); \
1188 bool base_##CBNAME(wxDragResult a);
1191 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1192 bool CLASS::CBNAME(wxDragResult a) { \
1195 wxPyBeginBlockThreads(); \
1196 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1197 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1198 wxPyEndBlockThreads(); \
1200 rval = PCLASS::CBNAME(a); \
1203 bool CLASS::base_##CBNAME(wxDragResult a) { \
1204 return PCLASS::CBNAME(a); \
1207 //---------------------------------------------------------------------------
1209 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1210 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1213 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1214 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1215 wxPyBeginBlockThreads(); \
1217 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1218 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1219 wxPyEndBlockThreads(); \
1220 return (wxDragResult)rval; \
1223 //---------------------------------------------------------------------------
1225 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1226 bool CBNAME(int a, int b, const wxString& c);
1228 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1229 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1231 wxPyBeginBlockThreads(); \
1232 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1233 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1234 wxPyEndBlockThreads(); \
1238 //---------------------------------------------------------------------------
1240 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1242 size_t base_##CBNAME();
1245 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1246 size_t CLASS::CBNAME() { \
1249 wxPyBeginBlockThreads(); \
1250 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1251 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1252 wxPyEndBlockThreads(); \
1254 rval = PCLASS::CBNAME(); \
1257 size_t CLASS::base_##CBNAME() { \
1258 return PCLASS::CBNAME(); \
1261 //---------------------------------------------------------------------------
1263 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1264 wxDataFormat CBNAME(size_t a); \
1265 wxDataFormat base_##CBNAME(size_t a);
1268 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1269 wxDataFormat CLASS::CBNAME(size_t a) { \
1270 wxDataFormat rval=0; \
1272 wxPyBeginBlockThreads(); \
1273 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1275 wxDataFormat* ptr; \
1276 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1278 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1283 wxPyEndBlockThreads(); \
1285 rval = PCLASS::CBNAME(a); \
1288 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1289 return PCLASS::CBNAME(a); \
1292 //---------------------------------------------------------------------------
1294 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1295 void CBNAME(const Type& a); \
1296 void base_##CBNAME(const Type& a);
1299 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1300 void CLASS::CBNAME(const Type& a) { \
1302 wxPyBeginBlockThreads(); \
1303 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1304 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1305 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1308 wxPyEndBlockThreads(); \
1310 PCLASS::CBNAME(a); \
1312 void CLASS::base_##CBNAME(const Type& a) { \
1313 PCLASS::CBNAME(a); \
1317 //---------------------------------------------------------------------------
1319 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1320 void CBNAME(Type& a); \
1321 void base_##CBNAME(Type& a);
1324 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1325 void CLASS::CBNAME(Type& a) { \
1327 wxPyBeginBlockThreads(); \
1328 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1329 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1330 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1333 wxPyEndBlockThreads(); \
1335 PCLASS::CBNAME(a); \
1337 void CLASS::base_##CBNAME(Type& a) { \
1338 PCLASS::CBNAME(a); \
1341 //---------------------------------------------------------------------------
1343 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1344 bool CBNAME(Type& a); \
1345 bool base_##CBNAME(Type& a);
1348 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1349 bool CLASS::CBNAME(Type& a) { \
1352 wxPyBeginBlockThreads(); \
1353 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1354 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1355 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1358 wxPyEndBlockThreads(); \
1360 rv = PCLASS::CBNAME(a); \
1363 bool CLASS::base_##CBNAME(Type& a) { \
1364 return PCLASS::CBNAME(a); \
1367 //---------------------------------------------------------------------------
1369 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1370 wxString CBNAME(long a, long b) const; \
1371 wxString base_##CBNAME(long a, long b)const ;
1373 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1374 wxString CLASS::CBNAME(long a, long b) const { \
1377 wxPyBeginBlockThreads(); \
1378 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1380 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1382 rval = Py2wxString(ro); \
1386 wxPyEndBlockThreads(); \
1388 rval = PCLASS::CBNAME(a,b); \
1391 wxString CLASS::base_##CBNAME(long a, long b) const { \
1392 return PCLASS::CBNAME(a,b); \
1395 //---------------------------------------------------------------------------
1397 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1398 int CBNAME(long a) const; \
1399 int base_##CBNAME(long a)const ;
1402 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1403 int CLASS::CBNAME(long a) const { \
1406 wxPyBeginBlockThreads(); \
1407 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1409 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1411 rval = PyInt_AsLong(ro); \
1415 wxPyEndBlockThreads(); \
1417 rval = PCLASS::CBNAME(a); \
1420 int CLASS::base_##CBNAME(long a) const { \
1421 return PCLASS::CBNAME(a); \
1425 //---------------------------------------------------------------------------
1427 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1428 wxListItemAttr* CBNAME(long a) const; \
1429 wxListItemAttr* base_##CBNAME(long a);
1432 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1433 wxListItemAttr *CLASS::CBNAME(long a) const { \
1434 wxListItemAttr *rval = NULL; \
1436 wxPyBeginBlockThreads(); \
1437 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1439 wxListItemAttr* ptr; \
1440 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1442 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1447 wxPyEndBlockThreads(); \
1449 rval = PCLASS::CBNAME(a); \
1452 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1453 return PCLASS::CBNAME(a); \
1456 //---------------------------------------------------------------------------
1458 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1459 bool CBNAME(wxMouseEvent& e); \
1460 bool base_##CBNAME(wxMouseEvent& e);
1462 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1463 bool CLASS::CBNAME(wxMouseEvent& e) { \
1466 wxPyBeginBlockThreads(); \
1467 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1469 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1470 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1472 rval = PyInt_AsLong(ro); \
1477 wxPyEndBlockThreads(); \
1479 return PCLASS::CBNAME(e); \
1482 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1483 return PCLASS::CBNAME(e); \
1487 //---------------------------------------------------------------------------