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 char* className
,
49 PyObject
* wxPyConstructObject(void* ptr
,
50 const char* className
,
53 PyObject
* wxPyClassExists(const char* className
);
54 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=TRUE
);
55 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
56 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
58 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
59 long wxPyGetWinHandle(wxWindow
* win
);
61 //----------------------------------------------------------------------
63 // if we want to handle threads and Python threads are available...
64 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
65 #define WXP_WITH_THREAD
66 #else // no Python threads...
67 #undef WXP_WITH_THREAD
72 PyThreadState
* wxPyBeginAllowThreads();
73 void wxPyEndAllowThreads(PyThreadState
* state
);
76 void wxPyBeginBlockThreads();
77 void wxPyEndBlockThreads();
79 //----------------------------------------------------------------------
80 // These are helpers used by the typemaps
82 byte
* byte_LIST_helper(PyObject
* source
);
83 int* int_LIST_helper(PyObject
* source
);
84 long* long_LIST_helper(PyObject
* source
);
85 char** string_LIST_helper(PyObject
* source
);
86 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
87 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
88 wxString
* wxString_LIST_helper(PyObject
* source
);
89 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
90 wxPen
** wxPen_LIST_helper(PyObject
* source
);
92 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
93 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
94 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
95 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
96 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
98 #if PYTHON_API_VERSION < 1009
99 #define PySequence_Fast_GET_ITEM(o, i) \
100 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
103 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
104 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
107 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
108 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
111 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
113 //----------------------------------------------------------------------
116 extern "C" void SWIG_MakePtr(char *, void *, char *);
117 extern "C" char *SWIG_GetPtr(char *, void **, char *);
118 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
123 # pragma warning(disable:4800)
124 # pragma warning(disable:4190)
127 //----------------------------------------------------------------------
129 class wxPyCallback
: public wxObject
{
130 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
132 wxPyCallback(PyObject
* func
);
133 wxPyCallback(const wxPyCallback
& other
);
136 void EventThunker(wxEvent
& event
);
141 //---------------------------------------------------------------------------
143 class wxPyTimer
: public wxTimer
{
145 wxPyTimer(PyObject
* callback
);
154 //---------------------------------------------------------------------------
155 //---------------------------------------------------------------------------
156 // These Event classes can be derived from in Python and passed through the
157 // event system without loosing anything. They do this by keeping a reference
158 // to themselves and some special case handling in wxPyCallback::EventThunker.
161 class wxPyEvtSelfRef
{
166 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
167 PyObject
* GetSelf() const;
175 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
176 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
179 wxPyEvent(const wxPyEvent
& evt
);
182 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
186 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
187 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
189 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
190 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
193 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
197 //---------------------------------------------------------------------------
198 // Export a C API in a struct. Other modules will be able to load this from
199 // the wxc module and will then have safe access to these functions, even if
200 // in another shared library.
202 class wxPyCallbackHelper
;
206 void (*p_SWIG_MakePtr
)(char*, void*, char*);
207 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
208 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
209 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
210 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
211 PyObject
* (*p_SWIG_newvarlink
)(void);
213 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
214 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
215 void (*p_wxPyBeginBlockThreads
)();
216 void (*p_wxPyEndBlockThreads
)();
218 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
219 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
221 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
222 int* (*p_int_LIST_helper
)(PyObject
* source
);
223 long* (*p_long_LIST_helper
)(PyObject
* source
);
224 char** (*p_string_LIST_helper
)(PyObject
* source
);
225 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
226 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
227 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
228 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
230 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
231 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
232 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
233 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
234 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
236 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
237 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
238 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
239 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
240 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
242 PyObject
* (*p_wxPyClassExists
)(const char* className
);
243 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
244 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
245 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
246 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
247 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
250 #ifdef wxPyUSE_EXPORT
251 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
254 //---------------------------------------------------------------------------
255 // This class holds an instance of a Python Shadow Class object and assists
256 // with looking up and invoking Python callback methods from C++ virtual
257 // method redirections. For all classes which have virtuals which should be
258 // overridable in wxPython, a new subclass is created that contains a
259 // wxPyCallbackHelper.
262 class wxPyCallbackHelper
{
264 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
266 wxPyCallbackHelper() {
273 ~wxPyCallbackHelper() {
274 #ifdef wxPyUSE_EXPORT
275 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
277 wxPyCBH_delete(this);
281 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
282 bool findCallback(const char* name
) const;
283 int callCallback(PyObject
* argTuple
) const;
284 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
289 PyObject
* m_lastFound
;
292 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
296 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
297 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
298 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
299 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
300 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
304 //----------------------------------------------------------------------
306 class wxPyUserData
: public wxObject
{
308 wxPyUserData(PyObject
* obj
) {
314 #ifdef wxPyUSE_EXPORT
315 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
317 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
319 wxPyBeginBlockThreads();
321 wxPyEndBlockThreads();
329 class wxPyClientData
: public wxClientData
{
331 wxPyClientData(PyObject
* obj
) {
337 #ifdef wxPyUSE_EXPORT
338 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
340 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
342 wxPyBeginBlockThreads();
344 wxPyEndBlockThreads();
352 //---------------------------------------------------------------------------
353 // These macros are used to implement the virtual methods that should
354 // redirect to a Python method if one exists. The names designate the
355 // return type, if any, as well as any parameter types.
356 //---------------------------------------------------------------------------
359 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
360 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
362 private: wxPyCallbackHelper m_myInst
364 //---------------------------------------------------------------------------
366 #define DEC_PYCALLBACK__(CBNAME) \
368 void base_##CBNAME();
371 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
372 void CLASS::CBNAME() { \
374 wxPyBeginBlockThreads(); \
375 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
376 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
377 wxPyEndBlockThreads(); \
381 void CLASS::base_##CBNAME() { \
385 //---------------------------------------------------------------------------
387 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
388 bool CBNAME(int a, int b); \
389 bool base_##CBNAME(int a, int b);
392 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
393 bool CLASS::CBNAME(int a, int b) { \
394 bool rval=FALSE, found; \
395 wxPyBeginBlockThreads(); \
396 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
397 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
398 wxPyEndBlockThreads(); \
400 rval = PCLASS::CBNAME(a,b); \
403 bool CLASS::base_##CBNAME(int a, int b) { \
404 return PCLASS::CBNAME(a,b); \
407 //---------------------------------------------------------------------------
409 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
410 void CBNAME(int a, int b); \
411 void base_##CBNAME(int a, int b);
414 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
415 void CLASS::CBNAME(int a, int b) { \
417 wxPyBeginBlockThreads(); \
418 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
419 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
420 wxPyEndBlockThreads(); \
422 PCLASS::CBNAME(a,b); \
424 void CLASS::base_##CBNAME(int a, int b) { \
425 PCLASS::CBNAME(a,b); \
428 //---------------------------------------------------------------------------
430 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
431 bool CBNAME(int a); \
432 bool base_##CBNAME(int a);
435 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
436 bool CLASS::CBNAME(int a) { \
437 bool rval=FALSE, found; \
438 wxPyBeginBlockThreads(); \
439 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
440 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
441 wxPyEndBlockThreads(); \
443 rval = PCLASS::CBNAME(a); \
446 bool CLASS::base_##CBNAME(int a) { \
447 return PCLASS::CBNAME(a); \
450 //---------------------------------------------------------------------------
452 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
456 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
457 bool CLASS::CBNAME(int a) { \
459 wxPyBeginBlockThreads(); \
460 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
461 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
463 wxPyEndBlockThreads(); \
468 //---------------------------------------------------------------------------
470 #define DEC_PYCALLBACK__DC(CBNAME) \
471 void CBNAME(wxDC& a); \
472 void base_##CBNAME(wxDC& a);
475 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
476 void CLASS::CBNAME(wxDC& a) { \
478 wxPyBeginBlockThreads(); \
479 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
480 PyObject* obj = wxPyMake_wxObject(&a); \
481 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
484 wxPyEndBlockThreads(); \
488 void CLASS::base_##CBNAME(wxDC& a) { \
494 //---------------------------------------------------------------------------
496 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
497 void CBNAME(wxDC& a, bool b); \
498 void base_##CBNAME(wxDC& a, bool b);
501 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
502 void CLASS::CBNAME(wxDC& a, bool b) { \
504 wxPyBeginBlockThreads(); \
505 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
506 PyObject* obj = wxPyMake_wxObject(&a); \
507 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
510 wxPyEndBlockThreads(); \
512 PCLASS::CBNAME(a, b); \
514 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
515 PCLASS::CBNAME(a, b); \
518 //---------------------------------------------------------------------------
520 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
521 void CBNAME(wxDC& a, bool b); \
522 void base_##CBNAME(wxDC& a, bool b);
525 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
526 void CLASS::CBNAME(wxDC& a, bool b) { \
528 wxPyBeginBlockThreads(); \
529 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
530 PyObject* obj = wxPyMake_wxObject(&a); \
531 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
534 wxPyEndBlockThreads(); \
536 PCLASS::CBNAME(a, b); \
538 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
539 PCLASS::CBNAME(a, b); \
542 //---------------------------------------------------------------------------
544 #define DEC_PYCALLBACK__2DBL(CBNAME) \
545 void CBNAME(double a, double b); \
546 void base_##CBNAME(double a, double b);
549 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
550 void CLASS::CBNAME(double a, double b) { \
552 wxPyBeginBlockThreads(); \
553 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
554 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
555 wxPyEndBlockThreads(); \
557 PCLASS::CBNAME(a, b); \
559 void CLASS::base_##CBNAME(double a, double b) { \
560 PCLASS::CBNAME(a, b); \
563 //---------------------------------------------------------------------------
565 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
566 void CBNAME(double a, double b, int c, int d); \
567 void base_##CBNAME(double a, double b, int c, int d);
570 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
571 void CLASS::CBNAME(double a, double b, int c, int d) { \
573 wxPyBeginBlockThreads(); \
574 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
575 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
577 wxPyEndBlockThreads(); \
579 PCLASS::CBNAME(a, b, c, d); \
581 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
582 PCLASS::CBNAME(a, b, c, d); \
585 //---------------------------------------------------------------------------
587 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
588 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
589 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
592 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
593 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
595 wxPyBeginBlockThreads(); \
596 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
597 PyObject* obj = wxPyMake_wxObject(&a); \
598 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
601 wxPyEndBlockThreads(); \
603 PCLASS::CBNAME(a, b, c, d, e, f); \
605 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
606 PCLASS::CBNAME(a, b, c, d, e, f); \
609 //---------------------------------------------------------------------------
611 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
612 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
613 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
616 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
617 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
619 wxPyBeginBlockThreads(); \
621 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
622 PyObject* obj = wxPyMake_wxObject(&a); \
623 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
626 wxPyEndBlockThreads(); \
628 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
631 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
632 return PCLASS::CBNAME(a, b, c, d, e, f); \
635 //---------------------------------------------------------------------------
637 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
638 void CBNAME(bool a, double b, double c, int d, int e); \
639 void base_##CBNAME(bool a, double b, double c, int d, int e);
642 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
643 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
645 wxPyBeginBlockThreads(); \
646 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
647 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
649 wxPyEndBlockThreads(); \
651 PCLASS::CBNAME(a, b, c, d, e); \
653 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
654 PCLASS::CBNAME(a, b, c, d, e); \
657 //---------------------------------------------------------------------------
659 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
660 void CBNAME(wxDC& a, double b, double c, double d, double e); \
661 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
664 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
665 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
667 wxPyBeginBlockThreads(); \
668 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
669 PyObject* obj = wxPyMake_wxObject(&a); \
670 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
673 wxPyEndBlockThreads(); \
675 PCLASS::CBNAME(a, b, c, d, e); \
677 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
678 PCLASS::CBNAME(a, b, c, d, e); \
681 //---------------------------------------------------------------------------
683 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
684 void CBNAME(wxDC& a, bool b); \
685 void base_##CBNAME(wxDC& a, bool b);
688 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
689 void CLASS::CBNAME(wxDC& a, bool b) { \
691 wxPyBeginBlockThreads(); \
692 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
693 PyObject* obj = wxPyMake_wxObject(&a); \
694 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
697 wxPyEndBlockThreads(); \
699 PCLASS::CBNAME(a, b); \
701 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
702 PCLASS::CBNAME(a, b); \
705 //---------------------------------------------------------------------------
707 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
708 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
709 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
712 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
713 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
716 wxPyBeginBlockThreads(); \
717 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
718 PyObject* obj = wxPyMake_wxObject(a); \
719 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
722 wxPyEndBlockThreads(); \
724 PCLASS::CBNAME(a, b, c, d, e, f); \
726 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
728 PCLASS::CBNAME(a, b, c, d, e, f); \
731 //---------------------------------------------------------------------------
733 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
734 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
735 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
738 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
739 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
741 wxPyBeginBlockThreads(); \
742 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
743 PyObject* obj = wxPyMake_wxObject(a); \
744 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
747 wxPyEndBlockThreads(); \
749 PCLASS::CBNAME(a, b, c, d, e); \
751 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
753 PCLASS::CBNAME(a, b, c, d, e); \
756 //---------------------------------------------------------------------------
758 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
759 void CBNAME(double a, double b, int c); \
760 void base_##CBNAME(double a, double b, int c);
763 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
764 void CLASS::CBNAME(double a, double b, int c) { \
766 wxPyBeginBlockThreads(); \
767 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
768 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
769 wxPyEndBlockThreads(); \
771 PCLASS::CBNAME(a, b, c); \
773 void CLASS::base_##CBNAME(double a, double b, int c) { \
774 PCLASS::CBNAME(a, b, c); \
777 //---------------------------------------------------------------------------
779 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
780 void CBNAME(bool a, double b, double c, int d); \
781 void base_##CBNAME(bool a, double b, double c, int d);
784 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
785 void CLASS::CBNAME(bool a, double b, double c, int d) { \
787 wxPyBeginBlockThreads(); \
788 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
789 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
790 wxPyEndBlockThreads(); \
792 PCLASS::CBNAME(a, b, c, d); \
794 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
795 PCLASS::CBNAME(a, b, c, d); \
798 //---------------------------------------------------------------------------
799 //---------------------------------------------------------------------------
801 #define DEC_PYCALLBACK__STRING(CBNAME) \
802 void CBNAME(const wxString& a); \
803 void base_##CBNAME(const wxString& a);
806 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
807 void CLASS::CBNAME(const wxString& a) { \
809 wxPyBeginBlockThreads(); \
810 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
811 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
812 wxPyEndBlockThreads(); \
816 void CLASS::base_##CBNAME(const wxString& a) { \
820 //---------------------------------------------------------------------------
822 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
823 bool CBNAME(const wxString& a); \
824 bool base_##CBNAME(const wxString& a);
827 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
828 bool CLASS::CBNAME(const wxString& a) { \
831 wxPyBeginBlockThreads(); \
832 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
833 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
834 wxPyEndBlockThreads(); \
836 rval = PCLASS::CBNAME(a); \
839 bool CLASS::base_##CBNAME(const wxString& a) { \
840 return PCLASS::CBNAME(a); \
843 //---------------------------------------------------------------------------
845 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
846 bool CBNAME(const wxString& a);
848 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
849 bool CLASS::CBNAME(const wxString& a) { \
851 wxPyBeginBlockThreads(); \
852 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
853 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
854 wxPyEndBlockThreads(); \
858 //---------------------------------------------------------------------------
860 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
861 wxString CBNAME(const wxString& a); \
863 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
864 wxString CLASS::CBNAME(const wxString& a) { \
866 wxPyBeginBlockThreads(); \
867 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
869 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
871 PyObject* str = PyObject_Str(ro); \
872 rval = PyString_AsString(str); \
873 Py_DECREF(ro); Py_DECREF(str); \
876 wxPyEndBlockThreads(); \
880 //---------------------------------------------------------------------------
882 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
883 wxString CBNAME(const wxString& a,int b); \
885 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
886 wxString CLASS::CBNAME(const wxString& a,int b) { \
888 wxPyBeginBlockThreads(); \
889 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
891 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
893 PyObject* str = PyObject_Str(ro); \
894 rval = PyString_AsString(str); \
895 Py_DECREF(ro); Py_DECREF(str); \
898 wxPyEndBlockThreads(); \
902 //---------------------------------------------------------------------------
904 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
905 bool CBNAME(const wxString& a, const wxString& b); \
906 bool base_##CBNAME(const wxString& a, const wxString& b);
909 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
910 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
913 wxPyBeginBlockThreads(); \
914 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
915 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
916 a.c_str(), b.c_str())); \
917 wxPyEndBlockThreads(); \
919 rval = PCLASS::CBNAME(a, b); \
922 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
923 return PCLASS::CBNAME(a, b); \
926 //---------------------------------------------------------------------------
928 #define DEC_PYCALLBACK_STRING_(CBNAME) \
930 wxString base_##CBNAME();
933 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
934 wxString CLASS::CBNAME() { \
937 wxPyBeginBlockThreads(); \
938 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
940 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
942 PyObject* str = PyObject_Str(ro); \
943 rval = PyString_AsString(str); \
944 Py_DECREF(ro); Py_DECREF(str); \
947 wxPyEndBlockThreads(); \
949 rval = PCLASS::CBNAME(); \
952 wxString CLASS::base_##CBNAME() { \
953 return PCLASS::CBNAME(); \
956 //---------------------------------------------------------------------------
958 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
962 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
963 wxString CLASS::CBNAME() { \
965 wxPyBeginBlockThreads(); \
966 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
968 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
970 PyObject* str = PyObject_Str(ro); \
971 rval = PyString_AsString(str); \
972 Py_DECREF(ro); Py_DECREF(str); \
975 wxPyEndBlockThreads(); \
979 //---------------------------------------------------------------------------
981 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
982 bool CBNAME(const wxHtmlTag& a); \
985 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
986 bool CLASS::CBNAME(const wxHtmlTag& a) { \
988 wxPyBeginBlockThreads(); \
989 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
990 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
991 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
994 wxPyEndBlockThreads(); \
998 //---------------------------------------------------------------------------
1000 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1001 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1002 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1004 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1005 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("(Os)",\
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);
1229 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1230 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1232 wxPyBeginBlockThreads(); \
1233 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1234 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1235 wxPyEndBlockThreads(); \
1239 //---------------------------------------------------------------------------
1241 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1243 size_t base_##CBNAME();
1246 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1247 size_t CLASS::CBNAME() { \
1250 wxPyBeginBlockThreads(); \
1251 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1252 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1253 wxPyEndBlockThreads(); \
1255 rval = PCLASS::CBNAME(); \
1258 size_t CLASS::base_##CBNAME() { \
1259 return PCLASS::CBNAME(); \
1262 //---------------------------------------------------------------------------
1264 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1265 wxDataFormat CBNAME(size_t a); \
1266 wxDataFormat base_##CBNAME(size_t a);
1269 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1270 wxDataFormat CLASS::CBNAME(size_t a) { \
1271 wxDataFormat rval=0; \
1273 wxPyBeginBlockThreads(); \
1274 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1276 wxDataFormat* ptr; \
1277 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1279 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1284 wxPyEndBlockThreads(); \
1286 rval = PCLASS::CBNAME(a); \
1289 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1290 return PCLASS::CBNAME(a); \
1293 //---------------------------------------------------------------------------
1295 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1296 void CBNAME(const Type& a); \
1297 void base_##CBNAME(const Type& a);
1300 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1301 void CLASS::CBNAME(const Type& a) { \
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)); \
1309 wxPyEndBlockThreads(); \
1311 PCLASS::CBNAME(a); \
1313 void CLASS::base_##CBNAME(const Type& a) { \
1314 PCLASS::CBNAME(a); \
1318 //---------------------------------------------------------------------------
1320 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1321 void CBNAME(Type& a); \
1322 void base_##CBNAME(Type& a);
1325 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1326 void CLASS::CBNAME(Type& a) { \
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)); \
1334 wxPyEndBlockThreads(); \
1336 PCLASS::CBNAME(a); \
1338 void CLASS::base_##CBNAME(Type& a) { \
1339 PCLASS::CBNAME(a); \
1342 //---------------------------------------------------------------------------
1344 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1345 bool CBNAME(Type& a); \
1346 bool base_##CBNAME(Type& a);
1349 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1350 bool CLASS::CBNAME(Type& a) { \
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)); \
1359 wxPyEndBlockThreads(); \
1361 rv = PCLASS::CBNAME(a); \
1364 bool CLASS::base_##CBNAME(Type& a) { \
1365 return PCLASS::CBNAME(a); \
1368 //---------------------------------------------------------------------------
1370 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1371 wxString CBNAME(long a, long b) const; \
1372 wxString base_##CBNAME(long a, long b)const ;
1375 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1376 wxString CLASS::CBNAME(long a, long b) const { \
1379 wxPyBeginBlockThreads(); \
1380 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1382 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1384 PyObject* str = PyObject_Str(ro); \
1385 rval = PyString_AsString(str); \
1386 Py_DECREF(ro); Py_DECREF(str); \
1389 wxPyEndBlockThreads(); \
1391 rval = PCLASS::CBNAME(a,b); \
1394 wxString CLASS::base_##CBNAME(long a, long b) const { \
1395 return PCLASS::CBNAME(a,b); \
1398 //---------------------------------------------------------------------------
1400 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1401 int CBNAME(long a) const; \
1402 int base_##CBNAME(long a)const ;
1405 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1406 int CLASS::CBNAME(long a) const { \
1409 wxPyBeginBlockThreads(); \
1410 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1412 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1414 rval = PyInt_AsLong(ro); \
1418 wxPyEndBlockThreads(); \
1420 rval = PCLASS::CBNAME(a); \
1423 int CLASS::base_##CBNAME(long a) const { \
1424 return PCLASS::CBNAME(a); \
1428 //---------------------------------------------------------------------------
1430 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1431 wxListItemAttr* CBNAME(long a) const; \
1432 wxListItemAttr* base_##CBNAME(long a);
1435 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1436 wxListItemAttr *CLASS::CBNAME(long a) const { \
1437 wxListItemAttr *rval = NULL; \
1439 wxPyBeginBlockThreads(); \
1440 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1442 wxListItemAttr* ptr; \
1443 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1445 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1450 wxPyEndBlockThreads(); \
1452 rval = PCLASS::CBNAME(a); \
1455 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1456 return PCLASS::CBNAME(a); \
1459 //---------------------------------------------------------------------------
1461 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1462 bool CBNAME(wxMouseEvent& e); \
1463 bool base_##CBNAME(wxMouseEvent& e);
1465 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1466 bool CLASS::CBNAME(wxMouseEvent& e) { \
1469 wxPyBeginBlockThreads(); \
1470 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1472 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1473 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1475 rval = PyInt_AsLong(ro); \
1480 wxPyEndBlockThreads(); \
1482 return PCLASS::CBNAME(e); \
1485 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1486 return PCLASS::CBNAME(e); \
1490 //---------------------------------------------------------------------------