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() { \
1073 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1075 wxPyBeginBlockThreads(); \
1076 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1079 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1081 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1083 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1084 PyObject* o1 = PySequence_GetItem(ro, 0); \
1085 PyObject* o2 = PySequence_GetItem(ro, 1); \
1086 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1087 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1089 PyErr_SetString(PyExc_TypeError, errmsg); \
1094 PyErr_SetString(PyExc_TypeError, errmsg); \
1099 wxPyEndBlockThreads(); \
1103 //---------------------------------------------------------------------------
1105 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1106 bool CBNAME(wxWindow* a); \
1107 bool base_##CBNAME(wxWindow* a);
1110 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1111 bool CLASS::CBNAME(wxWindow* a) { \
1114 wxPyBeginBlockThreads(); \
1115 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1116 PyObject* obj = wxPyMake_wxObject(a); \
1117 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1120 wxPyEndBlockThreads(); \
1122 rval = PCLASS::CBNAME(a); \
1125 bool CLASS::base_##CBNAME(wxWindow* a) { \
1126 return PCLASS::CBNAME(a); \
1129 //---------------------------------------------------------------------------
1131 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1133 bool base_##CBNAME();
1136 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1137 bool CLASS::CBNAME() { \
1140 wxPyBeginBlockThreads(); \
1141 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1142 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1143 wxPyEndBlockThreads(); \
1145 rval = PCLASS::CBNAME(); \
1148 bool CLASS::base_##CBNAME() { \
1149 return PCLASS::CBNAME(); \
1152 //---------------------------------------------------------------------------
1154 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1155 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1156 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1159 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1160 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1163 wxPyBeginBlockThreads(); \
1164 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1165 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1166 wxPyEndBlockThreads(); \
1168 rval = PCLASS::CBNAME(a, b, c); \
1169 return (wxDragResult)rval; \
1171 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1172 return PCLASS::CBNAME(a, b, c); \
1175 //---------------------------------------------------------------------------
1177 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1178 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1180 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1181 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1182 wxPyBeginBlockThreads(); \
1184 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1186 PyObject* obj = wxPyMake_wxObject(&a); \
1187 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1188 obj, wx2PyString(b))); \
1190 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1195 wxPyEndBlockThreads(); \
1199 //---------------------------------------------------------------------------
1201 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1202 bool CBNAME(wxDragResult a); \
1203 bool base_##CBNAME(wxDragResult a);
1206 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1207 bool CLASS::CBNAME(wxDragResult a) { \
1210 wxPyBeginBlockThreads(); \
1211 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1212 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1213 wxPyEndBlockThreads(); \
1215 rval = PCLASS::CBNAME(a); \
1218 bool CLASS::base_##CBNAME(wxDragResult a) { \
1219 return PCLASS::CBNAME(a); \
1222 //---------------------------------------------------------------------------
1224 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1225 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1228 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1229 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1230 wxPyBeginBlockThreads(); \
1232 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1233 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1234 wxPyEndBlockThreads(); \
1235 return (wxDragResult)rval; \
1238 //---------------------------------------------------------------------------
1240 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1241 bool CBNAME(int a, int b, const wxString& c);
1243 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1244 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1246 wxPyBeginBlockThreads(); \
1247 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1248 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1249 wxPyEndBlockThreads(); \
1253 //---------------------------------------------------------------------------
1255 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1257 size_t base_##CBNAME();
1260 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1261 size_t CLASS::CBNAME() { \
1264 wxPyBeginBlockThreads(); \
1265 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1267 wxPyEndBlockThreads(); \
1269 rval = PCLASS::CBNAME(); \
1272 size_t CLASS::base_##CBNAME() { \
1273 return PCLASS::CBNAME(); \
1276 //---------------------------------------------------------------------------
1278 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1279 wxDataFormat CBNAME(size_t a); \
1280 wxDataFormat base_##CBNAME(size_t a);
1283 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1284 wxDataFormat CLASS::CBNAME(size_t a) { \
1285 wxDataFormat rval=0; \
1287 wxPyBeginBlockThreads(); \
1288 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1290 wxDataFormat* ptr; \
1291 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1293 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1298 wxPyEndBlockThreads(); \
1300 rval = PCLASS::CBNAME(a); \
1303 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1304 return PCLASS::CBNAME(a); \
1307 //---------------------------------------------------------------------------
1309 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1310 void CBNAME(const Type& a); \
1311 void base_##CBNAME(const Type& a);
1314 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1315 void CLASS::CBNAME(const Type& a) { \
1317 wxPyBeginBlockThreads(); \
1318 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1319 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1320 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1323 wxPyEndBlockThreads(); \
1325 PCLASS::CBNAME(a); \
1327 void CLASS::base_##CBNAME(const Type& a) { \
1328 PCLASS::CBNAME(a); \
1332 //---------------------------------------------------------------------------
1334 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1335 void CBNAME(Type& a); \
1336 void base_##CBNAME(Type& a);
1339 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1340 void CLASS::CBNAME(Type& a) { \
1342 wxPyBeginBlockThreads(); \
1343 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1344 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1345 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1348 wxPyEndBlockThreads(); \
1350 PCLASS::CBNAME(a); \
1352 void CLASS::base_##CBNAME(Type& a) { \
1353 PCLASS::CBNAME(a); \
1356 //---------------------------------------------------------------------------
1358 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1359 bool CBNAME(Type& a); \
1360 bool base_##CBNAME(Type& a);
1363 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1364 bool CLASS::CBNAME(Type& a) { \
1367 wxPyBeginBlockThreads(); \
1368 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1369 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1370 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1373 wxPyEndBlockThreads(); \
1375 rv = PCLASS::CBNAME(a); \
1378 bool CLASS::base_##CBNAME(Type& a) { \
1379 return PCLASS::CBNAME(a); \
1382 //---------------------------------------------------------------------------
1384 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1385 wxString CBNAME(long a, long b) const; \
1386 wxString base_##CBNAME(long a, long b)const ;
1388 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1389 wxString CLASS::CBNAME(long a, long b) const { \
1392 wxPyBeginBlockThreads(); \
1393 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1395 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1397 rval = Py2wxString(ro); \
1401 wxPyEndBlockThreads(); \
1403 rval = PCLASS::CBNAME(a,b); \
1406 wxString CLASS::base_##CBNAME(long a, long b) const { \
1407 return PCLASS::CBNAME(a,b); \
1410 //---------------------------------------------------------------------------
1412 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1413 int CBNAME(long a) const; \
1414 int base_##CBNAME(long a)const ;
1417 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1418 int CLASS::CBNAME(long a) const { \
1421 wxPyBeginBlockThreads(); \
1422 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1424 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1426 rval = PyInt_AsLong(ro); \
1430 wxPyEndBlockThreads(); \
1432 rval = PCLASS::CBNAME(a); \
1435 int CLASS::base_##CBNAME(long a) const { \
1436 return PCLASS::CBNAME(a); \
1440 //---------------------------------------------------------------------------
1442 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1443 wxListItemAttr* CBNAME(long a) const; \
1444 wxListItemAttr* base_##CBNAME(long a);
1447 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1448 wxListItemAttr *CLASS::CBNAME(long a) const { \
1449 wxListItemAttr *rval = NULL; \
1451 wxPyBeginBlockThreads(); \
1452 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1454 wxListItemAttr* ptr; \
1455 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1457 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1462 wxPyEndBlockThreads(); \
1464 rval = PCLASS::CBNAME(a); \
1467 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1468 return PCLASS::CBNAME(a); \
1471 //---------------------------------------------------------------------------
1473 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1474 bool CBNAME(wxMouseEvent& e); \
1475 bool base_##CBNAME(wxMouseEvent& e);
1477 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1478 bool CLASS::CBNAME(wxMouseEvent& e) { \
1481 wxPyBeginBlockThreads(); \
1482 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1484 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1485 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1487 rval = PyInt_AsLong(ro); \
1492 wxPyEndBlockThreads(); \
1494 return PCLASS::CBNAME(e); \
1497 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1498 return PCLASS::CBNAME(e); \
1502 //---------------------------------------------------------------------------