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; }
118 #define DECLARE_DEF_STRING(name) static wxString wxPy##name(wx##name)
120 //----------------------------------------------------------------------
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
);
130 # pragma warning(disable:4800)
131 # pragma warning(disable:4190)
134 //----------------------------------------------------------------------
136 class wxPyCallback
: public wxObject
{
137 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
139 wxPyCallback(PyObject
* func
);
140 wxPyCallback(const wxPyCallback
& other
);
143 void EventThunker(wxEvent
& event
);
148 //---------------------------------------------------------------------------
150 class wxPyTimer
: public wxTimer
{
152 wxPyTimer(PyObject
* callback
);
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.
168 class wxPyEvtSelfRef
{
173 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
174 PyObject
* GetSelf() const;
182 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
183 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
186 wxPyEvent(const wxPyEvent
& evt
);
189 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
193 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
194 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
196 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
197 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
200 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
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.
209 class wxPyCallbackHelper
;
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);
220 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
221 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
222 void (*p_wxPyBeginBlockThreads
)();
223 void (*p_wxPyEndBlockThreads
)();
225 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
226 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
228 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
229 wxString (*p_Py2wxString
)(PyObject
* source
);
230 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
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
);
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
);
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
);
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
);
261 #ifdef wxPyUSE_EXPORT
262 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
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.
273 class wxPyCallbackHelper
{
275 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
277 wxPyCallbackHelper() {
284 ~wxPyCallbackHelper() {
285 #ifdef wxPyUSE_EXPORT
286 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
288 wxPyCBH_delete(this);
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;
300 PyObject
* m_lastFound
;
303 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
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
);
315 //----------------------------------------------------------------------
317 class wxPyUserData
: public wxObject
{
319 wxPyUserData(PyObject
* obj
) {
325 #ifdef wxPyUSE_EXPORT
326 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
328 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
330 wxPyBeginBlockThreads();
332 wxPyEndBlockThreads();
340 class wxPyClientData
: public wxClientData
{
342 wxPyClientData(PyObject
* obj
) {
348 #ifdef wxPyUSE_EXPORT
349 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
351 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
353 wxPyBeginBlockThreads();
355 wxPyEndBlockThreads();
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 //---------------------------------------------------------------------------
370 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
371 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
373 private: wxPyCallbackHelper m_myInst
375 //---------------------------------------------------------------------------
377 #define DEC_PYCALLBACK__(CBNAME) \
379 void base_##CBNAME();
382 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
383 void CLASS::CBNAME() { \
385 wxPyBeginBlockThreads(); \
386 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
387 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
388 wxPyEndBlockThreads(); \
392 void CLASS::base_##CBNAME() { \
396 //---------------------------------------------------------------------------
398 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
399 bool CBNAME(int a, int b); \
400 bool base_##CBNAME(int a, int b);
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(); \
411 rval = PCLASS::CBNAME(a,b); \
414 bool CLASS::base_##CBNAME(int a, int b) { \
415 return PCLASS::CBNAME(a,b); \
418 //---------------------------------------------------------------------------
420 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
421 void CBNAME(int a, int b); \
422 void base_##CBNAME(int a, int b);
425 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
426 void CLASS::CBNAME(int a, int b) { \
428 wxPyBeginBlockThreads(); \
429 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
430 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
431 wxPyEndBlockThreads(); \
433 PCLASS::CBNAME(a,b); \
435 void CLASS::base_##CBNAME(int a, int b) { \
436 PCLASS::CBNAME(a,b); \
439 //---------------------------------------------------------------------------
441 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
442 bool CBNAME(int a); \
443 bool base_##CBNAME(int a);
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(); \
454 rval = PCLASS::CBNAME(a); \
457 bool CLASS::base_##CBNAME(int a) { \
458 return PCLASS::CBNAME(a); \
461 //---------------------------------------------------------------------------
463 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
467 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
468 bool CLASS::CBNAME(int a) { \
470 wxPyBeginBlockThreads(); \
471 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
472 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
474 wxPyEndBlockThreads(); \
479 //---------------------------------------------------------------------------
481 #define DEC_PYCALLBACK__DC(CBNAME) \
482 void CBNAME(wxDC& a); \
483 void base_##CBNAME(wxDC& a);
486 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
487 void CLASS::CBNAME(wxDC& a) { \
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)); \
495 wxPyEndBlockThreads(); \
499 void CLASS::base_##CBNAME(wxDC& a) { \
505 //---------------------------------------------------------------------------
507 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
508 void CBNAME(wxDC& a, bool b); \
509 void base_##CBNAME(wxDC& a, bool b);
512 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
513 void CLASS::CBNAME(wxDC& a, bool b) { \
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)); \
521 wxPyEndBlockThreads(); \
523 PCLASS::CBNAME(a, b); \
525 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
526 PCLASS::CBNAME(a, b); \
529 //---------------------------------------------------------------------------
531 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
532 void CBNAME(wxDC& a, bool b); \
533 void base_##CBNAME(wxDC& a, bool b);
536 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
537 void CLASS::CBNAME(wxDC& a, bool b) { \
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)); \
545 wxPyEndBlockThreads(); \
547 PCLASS::CBNAME(a, b); \
549 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
550 PCLASS::CBNAME(a, b); \
553 //---------------------------------------------------------------------------
555 #define DEC_PYCALLBACK__2DBL(CBNAME) \
556 void CBNAME(double a, double b); \
557 void base_##CBNAME(double a, double b);
560 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
561 void CLASS::CBNAME(double a, double b) { \
563 wxPyBeginBlockThreads(); \
564 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
565 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
566 wxPyEndBlockThreads(); \
568 PCLASS::CBNAME(a, b); \
570 void CLASS::base_##CBNAME(double a, double b) { \
571 PCLASS::CBNAME(a, b); \
574 //---------------------------------------------------------------------------
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);
581 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
582 void CLASS::CBNAME(double a, double b, int c, int d) { \
584 wxPyBeginBlockThreads(); \
585 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
586 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
588 wxPyEndBlockThreads(); \
590 PCLASS::CBNAME(a, b, c, d); \
592 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
593 PCLASS::CBNAME(a, b, c, d); \
596 //---------------------------------------------------------------------------
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);
603 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
604 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
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)); \
612 wxPyEndBlockThreads(); \
614 PCLASS::CBNAME(a, b, c, d, e, f); \
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); \
620 //---------------------------------------------------------------------------
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);
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) { \
630 wxPyBeginBlockThreads(); \
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));\
637 wxPyEndBlockThreads(); \
639 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
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); \
646 //---------------------------------------------------------------------------
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);
653 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
654 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
656 wxPyBeginBlockThreads(); \
657 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
658 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
660 wxPyEndBlockThreads(); \
662 PCLASS::CBNAME(a, b, c, d, e); \
664 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
665 PCLASS::CBNAME(a, b, c, d, e); \
668 //---------------------------------------------------------------------------
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);
675 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
676 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
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)); \
684 wxPyEndBlockThreads(); \
686 PCLASS::CBNAME(a, b, c, d, e); \
688 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
689 PCLASS::CBNAME(a, b, c, d, e); \
692 //---------------------------------------------------------------------------
694 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
695 void CBNAME(wxDC& a, bool b); \
696 void base_##CBNAME(wxDC& a, bool b);
699 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
700 void CLASS::CBNAME(wxDC& a, bool b) { \
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)); \
708 wxPyEndBlockThreads(); \
710 PCLASS::CBNAME(a, b); \
712 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
713 PCLASS::CBNAME(a, b); \
716 //---------------------------------------------------------------------------
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);
723 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
724 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
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));\
733 wxPyEndBlockThreads(); \
735 PCLASS::CBNAME(a, b, c, d, e, f); \
737 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
739 PCLASS::CBNAME(a, b, c, d, e, f); \
742 //---------------------------------------------------------------------------
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);
749 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
750 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
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)); \
758 wxPyEndBlockThreads(); \
760 PCLASS::CBNAME(a, b, c, d, e); \
762 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
764 PCLASS::CBNAME(a, b, c, d, e); \
767 //---------------------------------------------------------------------------
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);
774 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
775 void CLASS::CBNAME(double a, double b, int c) { \
777 wxPyBeginBlockThreads(); \
778 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
779 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
780 wxPyEndBlockThreads(); \
782 PCLASS::CBNAME(a, b, c); \
784 void CLASS::base_##CBNAME(double a, double b, int c) { \
785 PCLASS::CBNAME(a, b, c); \
788 //---------------------------------------------------------------------------
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);
795 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
796 void CLASS::CBNAME(bool a, double b, double c, int d) { \
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(); \
803 PCLASS::CBNAME(a, b, c, d); \
805 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
806 PCLASS::CBNAME(a, b, c, d); \
809 //---------------------------------------------------------------------------
810 //---------------------------------------------------------------------------
812 #define DEC_PYCALLBACK__STRING(CBNAME) \
813 void CBNAME(const wxString& a); \
814 void base_##CBNAME(const wxString& a);
816 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
817 void CLASS::CBNAME(const wxString& a) { \
819 wxPyBeginBlockThreads(); \
820 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
821 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
822 wxPyEndBlockThreads(); \
826 void CLASS::base_##CBNAME(const wxString& a) { \
830 //---------------------------------------------------------------------------
832 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
833 bool CBNAME(const wxString& a); \
834 bool base_##CBNAME(const wxString& a);
836 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
837 bool CLASS::CBNAME(const wxString& a) { \
840 wxPyBeginBlockThreads(); \
841 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
842 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
843 wxPyEndBlockThreads(); \
845 rval = PCLASS::CBNAME(a); \
848 bool CLASS::base_##CBNAME(const wxString& a) { \
849 return PCLASS::CBNAME(a); \
852 //---------------------------------------------------------------------------
854 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
855 bool CBNAME(const wxString& a);
857 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
858 bool CLASS::CBNAME(const wxString& a) { \
860 wxPyBeginBlockThreads(); \
861 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
862 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
863 wxPyEndBlockThreads(); \
867 //---------------------------------------------------------------------------
869 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
870 wxString CBNAME(const wxString& a); \
872 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
873 wxString CLASS::CBNAME(const wxString& a) { \
875 wxPyBeginBlockThreads(); \
876 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
878 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
880 rval = Py2wxString(ro); \
884 wxPyEndBlockThreads(); \
888 //---------------------------------------------------------------------------
890 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
891 wxString CBNAME(const wxString& a,int b); \
893 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
894 wxString CLASS::CBNAME(const wxString& a,int b) { \
896 wxPyBeginBlockThreads(); \
897 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
899 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
901 rval = Py2wxString(ro); \
905 wxPyEndBlockThreads(); \
909 //---------------------------------------------------------------------------
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);
915 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
916 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
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(); \
925 rval = PCLASS::CBNAME(a, b); \
928 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
929 return PCLASS::CBNAME(a, b); \
932 //---------------------------------------------------------------------------
934 #define DEC_PYCALLBACK_STRING_(CBNAME) \
936 wxString base_##CBNAME();
938 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
939 wxString CLASS::CBNAME() { \
942 wxPyBeginBlockThreads(); \
943 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
945 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
947 rval = Py2wxString(ro); \
951 wxPyEndBlockThreads(); \
953 rval = PCLASS::CBNAME(); \
956 wxString CLASS::base_##CBNAME() { \
957 return PCLASS::CBNAME(); \
960 //---------------------------------------------------------------------------
962 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
965 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
966 wxString CLASS::CBNAME() { \
968 wxPyBeginBlockThreads(); \
969 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
971 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
973 rval = Py2wxString(ro); \
977 wxPyEndBlockThreads(); \
981 //---------------------------------------------------------------------------
983 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
984 bool CBNAME(const wxHtmlTag& a); \
987 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
988 bool CLASS::CBNAME(const wxHtmlTag& a) { \
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)); \
996 wxPyEndBlockThreads(); \
1000 //---------------------------------------------------------------------------
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);
1006 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1007 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
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)); \
1015 wxPyEndBlockThreads(); \
1017 PCLASS::CBNAME(cell, x, y); \
1019 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1020 PCLASS::CBNAME(cell, x, y); \
1024 //---------------------------------------------------------------------------
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);
1030 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1031 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
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)); \
1041 wxPyEndBlockThreads(); \
1043 PCLASS::CBNAME(cell, x, y, e); \
1045 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1046 PCLASS::CBNAME(cell, x, y, e); \
1051 //---------------------------------------------------------------------------
1053 #define DEC_PYCALLBACK___pure(CBNAME) \
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(); \
1065 //---------------------------------------------------------------------------
1067 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1071 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1072 wxSize CLASS::CBNAME() { \
1074 wxPyBeginBlockThreads(); \
1075 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1078 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1080 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1085 wxPyEndBlockThreads(); \
1089 //---------------------------------------------------------------------------
1091 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1092 bool CBNAME(wxWindow* a); \
1093 bool base_##CBNAME(wxWindow* a);
1096 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1097 bool CLASS::CBNAME(wxWindow* a) { \
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)); \
1106 wxPyEndBlockThreads(); \
1108 rval = PCLASS::CBNAME(a); \
1111 bool CLASS::base_##CBNAME(wxWindow* a) { \
1112 return PCLASS::CBNAME(a); \
1115 //---------------------------------------------------------------------------
1117 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1119 bool base_##CBNAME();
1122 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1123 bool CLASS::CBNAME() { \
1126 wxPyBeginBlockThreads(); \
1127 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1128 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1129 wxPyEndBlockThreads(); \
1131 rval = PCLASS::CBNAME(); \
1134 bool CLASS::base_##CBNAME() { \
1135 return PCLASS::CBNAME(); \
1138 //---------------------------------------------------------------------------
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);
1145 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1146 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1149 wxPyBeginBlockThreads(); \
1150 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1151 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1152 wxPyEndBlockThreads(); \
1154 rval = PCLASS::CBNAME(a, b, c); \
1155 return (wxDragResult)rval; \
1157 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1158 return PCLASS::CBNAME(a, b, c); \
1161 //---------------------------------------------------------------------------
1163 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1164 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1166 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1167 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1168 wxPyBeginBlockThreads(); \
1170 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1172 PyObject* obj = wxPyMake_wxObject(&a); \
1173 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1174 obj, wx2PyString(b))); \
1176 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1181 wxPyEndBlockThreads(); \
1185 //---------------------------------------------------------------------------
1187 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1188 bool CBNAME(wxDragResult a); \
1189 bool base_##CBNAME(wxDragResult a);
1192 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1193 bool CLASS::CBNAME(wxDragResult a) { \
1196 wxPyBeginBlockThreads(); \
1197 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1198 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1199 wxPyEndBlockThreads(); \
1201 rval = PCLASS::CBNAME(a); \
1204 bool CLASS::base_##CBNAME(wxDragResult a) { \
1205 return PCLASS::CBNAME(a); \
1208 //---------------------------------------------------------------------------
1210 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1211 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1214 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1215 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1216 wxPyBeginBlockThreads(); \
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; \
1224 //---------------------------------------------------------------------------
1226 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1227 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("(iiO)",a,b, wx2PyString(c)));\
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 ;
1374 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1375 wxString CLASS::CBNAME(long a, long b) const { \
1378 wxPyBeginBlockThreads(); \
1379 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1381 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1383 rval = Py2wxString(ro); \
1387 wxPyEndBlockThreads(); \
1389 rval = PCLASS::CBNAME(a,b); \
1392 wxString CLASS::base_##CBNAME(long a, long b) const { \
1393 return PCLASS::CBNAME(a,b); \
1396 //---------------------------------------------------------------------------
1398 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1399 int CBNAME(long a) const; \
1400 int base_##CBNAME(long a)const ;
1403 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1404 int CLASS::CBNAME(long a) const { \
1407 wxPyBeginBlockThreads(); \
1408 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1410 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1412 rval = PyInt_AsLong(ro); \
1416 wxPyEndBlockThreads(); \
1418 rval = PCLASS::CBNAME(a); \
1421 int CLASS::base_##CBNAME(long a) const { \
1422 return PCLASS::CBNAME(a); \
1426 //---------------------------------------------------------------------------
1428 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1429 wxListItemAttr* CBNAME(long a) const; \
1430 wxListItemAttr* base_##CBNAME(long a);
1433 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1434 wxListItemAttr *CLASS::CBNAME(long a) const { \
1435 wxListItemAttr *rval = NULL; \
1437 wxPyBeginBlockThreads(); \
1438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1440 wxListItemAttr* ptr; \
1441 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1443 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1448 wxPyEndBlockThreads(); \
1450 rval = PCLASS::CBNAME(a); \
1453 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1454 return PCLASS::CBNAME(a); \
1457 //---------------------------------------------------------------------------
1459 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1460 bool CBNAME(wxMouseEvent& e); \
1461 bool base_##CBNAME(wxMouseEvent& e);
1463 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1464 bool CLASS::CBNAME(wxMouseEvent& e) { \
1467 wxPyBeginBlockThreads(); \
1468 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1470 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1471 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1473 rval = PyInt_AsLong(ro); \
1478 wxPyEndBlockThreads(); \
1480 return PCLASS::CBNAME(e); \
1483 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1484 return PCLASS::CBNAME(e); \
1488 //---------------------------------------------------------------------------