1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: Helper functions/classes for the wxPython extension 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 //----------------------------------------------------------------------
105 // Other helpful stuff
107 #if PYTHON_API_VERSION < 1009
108 #define PySequence_Fast_GET_ITEM(o, i) \
109 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
112 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
113 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
116 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
117 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
119 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
120 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
121 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
123 //----------------------------------------------------------------------
126 extern "C" void SWIG_MakePtr(char *, void *, char *);
127 extern "C" char *SWIG_GetPtr(char *, void **, char *);
128 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
133 # pragma warning(disable:4800)
134 # pragma warning(disable:4190)
137 //----------------------------------------------------------------------
139 class wxPyCallback
: public wxObject
{
140 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
142 wxPyCallback(PyObject
* func
);
143 wxPyCallback(const wxPyCallback
& other
);
146 void EventThunker(wxEvent
& event
);
151 //---------------------------------------------------------------------------
153 class wxPyTimer
: public wxTimer
{
155 wxPyTimer(PyObject
* callback
);
164 //---------------------------------------------------------------------------
165 //---------------------------------------------------------------------------
166 // These Event classes can be derived from in Python and passed through the
167 // event system without loosing anything. They do this by keeping a reference
168 // to themselves and some special case handling in wxPyCallback::EventThunker.
171 class wxPyEvtSelfRef
{
176 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
177 PyObject
* GetSelf() const;
185 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
186 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
189 wxPyEvent(const wxPyEvent
& evt
);
192 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
196 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
197 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
199 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
200 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
203 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
208 //----------------------------------------------------------------------
209 // Forward decalre a few things used in the exported API
210 class wxPyClientData
;
212 class wxPyOORClientData
;
214 void wxPyClientData_dtor(wxPyClientData
* self
);
215 void wxPyUserData_dtor(wxPyUserData
* self
);
216 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
219 //---------------------------------------------------------------------------
220 // Export a C API in a struct. Other modules will be able to load this from
221 // the wxc module and will then have safe access to these functions, even if
222 // in another shared library.
224 class wxPyCallbackHelper
;
228 void (*p_SWIG_MakePtr
)(char*, void*, char*);
229 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
230 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
231 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
232 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
233 PyObject
* (*p_SWIG_newvarlink
)(void);
235 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
236 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
237 void (*p_wxPyBeginBlockThreads
)();
238 void (*p_wxPyEndBlockThreads
)();
240 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
241 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
243 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
244 wxString (*p_Py2wxString
)(PyObject
* source
);
245 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
247 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
248 int* (*p_int_LIST_helper
)(PyObject
* source
);
249 long* (*p_long_LIST_helper
)(PyObject
* source
);
250 char** (*p_string_LIST_helper
)(PyObject
* source
);
251 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
252 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
253 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
254 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
256 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
257 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
258 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
259 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
260 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
262 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
263 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
264 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
265 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
266 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
268 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
269 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
270 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
271 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
272 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
273 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
275 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
276 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
277 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
280 #ifdef wxPyUSE_EXPORT
281 // Notice that this is static, not extern. This is by design, each module
282 // needs one, but doesn't have to use it.
283 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
287 //---------------------------------------------------------------------------
290 class wxPyUserData
: public wxObject
{
292 wxPyUserData(PyObject
* obj
) {
298 #ifdef wxPyUSE_EXPORT
299 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
301 wxPyUserData_dtor(this);
308 class wxPyClientData
: public wxClientData
{
310 wxPyClientData(PyObject
* obj
) {
316 #ifdef wxPyUSE_EXPORT
317 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
319 wxPyClientData_dtor(this);
326 class wxPyOORClientData
: public wxPyClientData
{
328 wxPyOORClientData(PyObject
* obj
)
329 : wxPyClientData(obj
) {}
331 ~wxPyOORClientData() {
332 #ifdef wxPyUSE_EXPORT
333 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
335 wxPyOORClientData_dtor(this);
340 //---------------------------------------------------------------------------
341 // This class holds an instance of a Python Shadow Class object and assists
342 // with looking up and invoking Python callback methods from C++ virtual
343 // method redirections. For all classes which have virtuals which should be
344 // overridable in wxPython, a new subclass is created that contains a
345 // wxPyCallbackHelper.
348 class wxPyCallbackHelper
{
350 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
352 wxPyCallbackHelper() {
359 ~wxPyCallbackHelper() {
360 #ifdef wxPyUSE_EXPORT
361 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
363 wxPyCBH_delete(this);
367 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
368 bool findCallback(const char* name
) const;
369 int callCallback(PyObject
* argTuple
) const;
370 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
375 PyObject
* m_lastFound
;
378 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
382 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
383 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
384 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
385 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
386 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
391 //---------------------------------------------------------------------------
392 // These macros are used to implement the virtual methods that should
393 // redirect to a Python method if one exists. The names designate the
394 // return type, if any, as well as any parameter types.
395 //---------------------------------------------------------------------------
398 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
399 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
401 private: wxPyCallbackHelper m_myInst
403 //---------------------------------------------------------------------------
405 #define DEC_PYCALLBACK__(CBNAME) \
407 void base_##CBNAME();
410 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
411 void CLASS::CBNAME() { \
413 wxPyBeginBlockThreads(); \
414 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
415 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
416 wxPyEndBlockThreads(); \
420 void CLASS::base_##CBNAME() { \
424 //---------------------------------------------------------------------------
426 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
427 bool CBNAME(int a, int b); \
428 bool base_##CBNAME(int a, int b);
431 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
432 bool CLASS::CBNAME(int a, int b) { \
433 bool rval=FALSE, found; \
434 wxPyBeginBlockThreads(); \
435 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
436 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
437 wxPyEndBlockThreads(); \
439 rval = PCLASS::CBNAME(a,b); \
442 bool CLASS::base_##CBNAME(int a, int b) { \
443 return PCLASS::CBNAME(a,b); \
446 //---------------------------------------------------------------------------
448 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
449 void CBNAME(int a, int b); \
450 void base_##CBNAME(int a, int b);
453 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
454 void CLASS::CBNAME(int a, int b) { \
456 wxPyBeginBlockThreads(); \
457 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
458 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
459 wxPyEndBlockThreads(); \
461 PCLASS::CBNAME(a,b); \
463 void CLASS::base_##CBNAME(int a, int b) { \
464 PCLASS::CBNAME(a,b); \
467 //---------------------------------------------------------------------------
469 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
470 bool CBNAME(int a); \
471 bool base_##CBNAME(int a);
474 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
475 bool CLASS::CBNAME(int a) { \
476 bool rval=FALSE, found; \
477 wxPyBeginBlockThreads(); \
478 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
479 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
480 wxPyEndBlockThreads(); \
482 rval = PCLASS::CBNAME(a); \
485 bool CLASS::base_##CBNAME(int a) { \
486 return PCLASS::CBNAME(a); \
489 //---------------------------------------------------------------------------
491 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
495 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
496 bool CLASS::CBNAME(int a) { \
498 wxPyBeginBlockThreads(); \
499 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
500 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
502 wxPyEndBlockThreads(); \
507 //---------------------------------------------------------------------------
509 #define DEC_PYCALLBACK__DC(CBNAME) \
510 void CBNAME(wxDC& a); \
511 void base_##CBNAME(wxDC& a);
514 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
515 void CLASS::CBNAME(wxDC& a) { \
517 wxPyBeginBlockThreads(); \
518 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
519 PyObject* obj = wxPyMake_wxObject(&a); \
520 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
523 wxPyEndBlockThreads(); \
527 void CLASS::base_##CBNAME(wxDC& a) { \
533 //---------------------------------------------------------------------------
535 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
536 void CBNAME(wxDC& a, bool b); \
537 void base_##CBNAME(wxDC& a, bool b);
540 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
541 void CLASS::CBNAME(wxDC& a, bool b) { \
543 wxPyBeginBlockThreads(); \
544 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
545 PyObject* obj = wxPyMake_wxObject(&a); \
546 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
549 wxPyEndBlockThreads(); \
551 PCLASS::CBNAME(a, b); \
553 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
554 PCLASS::CBNAME(a, b); \
557 //---------------------------------------------------------------------------
559 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
560 void CBNAME(wxDC& a, bool b); \
561 void base_##CBNAME(wxDC& a, bool b);
564 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
565 void CLASS::CBNAME(wxDC& a, bool b) { \
567 wxPyBeginBlockThreads(); \
568 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
569 PyObject* obj = wxPyMake_wxObject(&a); \
570 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
573 wxPyEndBlockThreads(); \
575 PCLASS::CBNAME(a, b); \
577 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
578 PCLASS::CBNAME(a, b); \
581 //---------------------------------------------------------------------------
583 #define DEC_PYCALLBACK__2DBL(CBNAME) \
584 void CBNAME(double a, double b); \
585 void base_##CBNAME(double a, double b);
588 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
589 void CLASS::CBNAME(double a, double b) { \
591 wxPyBeginBlockThreads(); \
592 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
593 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
594 wxPyEndBlockThreads(); \
596 PCLASS::CBNAME(a, b); \
598 void CLASS::base_##CBNAME(double a, double b) { \
599 PCLASS::CBNAME(a, b); \
602 //---------------------------------------------------------------------------
604 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
605 void CBNAME(double a, double b, int c, int d); \
606 void base_##CBNAME(double a, double b, int c, int d);
609 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
610 void CLASS::CBNAME(double a, double b, int c, int d) { \
612 wxPyBeginBlockThreads(); \
613 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
614 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
616 wxPyEndBlockThreads(); \
618 PCLASS::CBNAME(a, b, c, d); \
620 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
621 PCLASS::CBNAME(a, b, c, d); \
624 //---------------------------------------------------------------------------
626 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
627 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
628 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
631 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
632 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
634 wxPyBeginBlockThreads(); \
635 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
636 PyObject* obj = wxPyMake_wxObject(&a); \
637 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
640 wxPyEndBlockThreads(); \
642 PCLASS::CBNAME(a, b, c, d, e, f); \
644 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
645 PCLASS::CBNAME(a, b, c, d, e, f); \
648 //---------------------------------------------------------------------------
650 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
651 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
652 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
655 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
656 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
658 wxPyBeginBlockThreads(); \
660 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
661 PyObject* obj = wxPyMake_wxObject(&a); \
662 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
665 wxPyEndBlockThreads(); \
667 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
670 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
671 return PCLASS::CBNAME(a, b, c, d, e, f); \
674 //---------------------------------------------------------------------------
676 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
677 void CBNAME(bool a, double b, double c, int d, int e); \
678 void base_##CBNAME(bool a, double b, double c, int d, int e);
681 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
682 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
684 wxPyBeginBlockThreads(); \
685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
686 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
688 wxPyEndBlockThreads(); \
690 PCLASS::CBNAME(a, b, c, d, e); \
692 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
693 PCLASS::CBNAME(a, b, c, d, e); \
696 //---------------------------------------------------------------------------
698 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
699 void CBNAME(wxDC& a, double b, double c, double d, double e); \
700 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
703 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
704 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
706 wxPyBeginBlockThreads(); \
707 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
708 PyObject* obj = wxPyMake_wxObject(&a); \
709 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
712 wxPyEndBlockThreads(); \
714 PCLASS::CBNAME(a, b, c, d, e); \
716 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
717 PCLASS::CBNAME(a, b, c, d, e); \
720 //---------------------------------------------------------------------------
722 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
723 void CBNAME(wxDC& a, bool b); \
724 void base_##CBNAME(wxDC& a, bool b);
727 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
728 void CLASS::CBNAME(wxDC& a, bool b) { \
730 wxPyBeginBlockThreads(); \
731 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
732 PyObject* obj = wxPyMake_wxObject(&a); \
733 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
736 wxPyEndBlockThreads(); \
738 PCLASS::CBNAME(a, b); \
740 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
741 PCLASS::CBNAME(a, b); \
744 //---------------------------------------------------------------------------
746 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
747 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
748 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
751 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
752 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
755 wxPyBeginBlockThreads(); \
756 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
757 PyObject* obj = wxPyMake_wxObject(a); \
758 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
761 wxPyEndBlockThreads(); \
763 PCLASS::CBNAME(a, b, c, d, e, f); \
765 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
767 PCLASS::CBNAME(a, b, c, d, e, f); \
770 //---------------------------------------------------------------------------
772 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
773 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
774 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
777 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
778 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
780 wxPyBeginBlockThreads(); \
781 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
782 PyObject* obj = wxPyMake_wxObject(a); \
783 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
786 wxPyEndBlockThreads(); \
788 PCLASS::CBNAME(a, b, c, d, e); \
790 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
792 PCLASS::CBNAME(a, b, c, d, e); \
795 //---------------------------------------------------------------------------
797 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
798 void CBNAME(double a, double b, int c); \
799 void base_##CBNAME(double a, double b, int c);
802 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
803 void CLASS::CBNAME(double a, double b, int c) { \
805 wxPyBeginBlockThreads(); \
806 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
807 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
808 wxPyEndBlockThreads(); \
810 PCLASS::CBNAME(a, b, c); \
812 void CLASS::base_##CBNAME(double a, double b, int c) { \
813 PCLASS::CBNAME(a, b, c); \
816 //---------------------------------------------------------------------------
818 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
819 void CBNAME(bool a, double b, double c, int d); \
820 void base_##CBNAME(bool a, double b, double c, int d);
823 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
824 void CLASS::CBNAME(bool a, double b, double c, int d) { \
826 wxPyBeginBlockThreads(); \
827 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
828 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
829 wxPyEndBlockThreads(); \
831 PCLASS::CBNAME(a, b, c, d); \
833 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
834 PCLASS::CBNAME(a, b, c, d); \
837 //---------------------------------------------------------------------------
838 //---------------------------------------------------------------------------
840 #define DEC_PYCALLBACK__STRING(CBNAME) \
841 void CBNAME(const wxString& a); \
842 void base_##CBNAME(const wxString& a);
844 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
845 void CLASS::CBNAME(const wxString& a) { \
847 wxPyBeginBlockThreads(); \
848 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
849 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
850 wxPyEndBlockThreads(); \
854 void CLASS::base_##CBNAME(const wxString& a) { \
858 //---------------------------------------------------------------------------
860 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
861 bool CBNAME(const wxString& a); \
862 bool base_##CBNAME(const wxString& a);
864 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
865 bool CLASS::CBNAME(const wxString& a) { \
868 wxPyBeginBlockThreads(); \
869 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
870 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
871 wxPyEndBlockThreads(); \
873 rval = PCLASS::CBNAME(a); \
876 bool CLASS::base_##CBNAME(const wxString& a) { \
877 return PCLASS::CBNAME(a); \
880 //---------------------------------------------------------------------------
882 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
883 bool CBNAME(const wxString& a);
885 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
886 bool CLASS::CBNAME(const wxString& a) { \
888 wxPyBeginBlockThreads(); \
889 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
890 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
891 wxPyEndBlockThreads(); \
895 //---------------------------------------------------------------------------
897 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
898 wxString CBNAME(const wxString& a); \
900 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
901 wxString CLASS::CBNAME(const wxString& a) { \
903 wxPyBeginBlockThreads(); \
904 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
906 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
908 rval = Py2wxString(ro); \
912 wxPyEndBlockThreads(); \
916 //---------------------------------------------------------------------------
918 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
919 wxString CBNAME(const wxString& a,int b); \
921 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
922 wxString CLASS::CBNAME(const wxString& a,int b) { \
924 wxPyBeginBlockThreads(); \
925 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
927 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
929 rval = Py2wxString(ro); \
933 wxPyEndBlockThreads(); \
937 //---------------------------------------------------------------------------
939 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
940 bool CBNAME(const wxString& a, const wxString& b); \
941 bool base_##CBNAME(const wxString& a, const wxString& b);
943 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
944 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
947 wxPyBeginBlockThreads(); \
948 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
949 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
950 wx2PyString(a), wx2PyString(b))); \
951 wxPyEndBlockThreads(); \
953 rval = PCLASS::CBNAME(a, b); \
956 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
957 return PCLASS::CBNAME(a, b); \
960 //---------------------------------------------------------------------------
962 #define DEC_PYCALLBACK_STRING_(CBNAME) \
964 wxString base_##CBNAME();
966 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
967 wxString CLASS::CBNAME() { \
970 wxPyBeginBlockThreads(); \
971 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
973 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
975 rval = Py2wxString(ro); \
979 wxPyEndBlockThreads(); \
981 rval = PCLASS::CBNAME(); \
984 wxString CLASS::base_##CBNAME() { \
985 return PCLASS::CBNAME(); \
988 //---------------------------------------------------------------------------
990 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
993 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
994 wxString CLASS::CBNAME() { \
996 wxPyBeginBlockThreads(); \
997 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
999 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1001 rval = Py2wxString(ro); \
1005 wxPyEndBlockThreads(); \
1009 //---------------------------------------------------------------------------
1011 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1012 bool CBNAME(const wxHtmlTag& a); \
1015 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1016 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1018 wxPyBeginBlockThreads(); \
1019 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1020 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1021 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1024 wxPyEndBlockThreads(); \
1028 //---------------------------------------------------------------------------
1030 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1031 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1032 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1034 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1035 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1037 wxPyBeginBlockThreads(); \
1038 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1039 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1040 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1043 wxPyEndBlockThreads(); \
1045 PCLASS::CBNAME(cell, x, y); \
1047 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1048 PCLASS::CBNAME(cell, x, y); \
1052 //---------------------------------------------------------------------------
1054 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1055 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1056 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1058 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1059 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1061 wxPyBeginBlockThreads(); \
1062 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1063 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1064 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1065 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1069 wxPyEndBlockThreads(); \
1071 PCLASS::CBNAME(cell, x, y, e); \
1073 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1074 PCLASS::CBNAME(cell, x, y, e); \
1079 //---------------------------------------------------------------------------
1081 #define DEC_PYCALLBACK___pure(CBNAME) \
1085 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1086 void CLASS::CBNAME() { \
1087 wxPyBeginBlockThreads(); \
1088 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1089 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1090 wxPyEndBlockThreads(); \
1093 //---------------------------------------------------------------------------
1095 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1099 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1100 wxSize CLASS::CBNAME() { \
1101 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1103 wxPyBeginBlockThreads(); \
1104 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1107 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1109 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1111 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1112 PyObject* o1 = PySequence_GetItem(ro, 0); \
1113 PyObject* o2 = PySequence_GetItem(ro, 1); \
1114 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1115 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1117 PyErr_SetString(PyExc_TypeError, errmsg); \
1122 PyErr_SetString(PyExc_TypeError, errmsg); \
1127 wxPyEndBlockThreads(); \
1131 //---------------------------------------------------------------------------
1133 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1134 bool CBNAME(wxWindow* a); \
1135 bool base_##CBNAME(wxWindow* a);
1138 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1139 bool CLASS::CBNAME(wxWindow* a) { \
1142 wxPyBeginBlockThreads(); \
1143 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1144 PyObject* obj = wxPyMake_wxObject(a); \
1145 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1148 wxPyEndBlockThreads(); \
1150 rval = PCLASS::CBNAME(a); \
1153 bool CLASS::base_##CBNAME(wxWindow* a) { \
1154 return PCLASS::CBNAME(a); \
1157 //---------------------------------------------------------------------------
1159 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1161 bool base_##CBNAME();
1164 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1165 bool CLASS::CBNAME() { \
1168 wxPyBeginBlockThreads(); \
1169 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1170 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1171 wxPyEndBlockThreads(); \
1173 rval = PCLASS::CBNAME(); \
1176 bool CLASS::base_##CBNAME() { \
1177 return PCLASS::CBNAME(); \
1180 //---------------------------------------------------------------------------
1182 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1183 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1184 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1187 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1188 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1191 wxPyBeginBlockThreads(); \
1192 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1193 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1194 wxPyEndBlockThreads(); \
1196 rval = PCLASS::CBNAME(a, b, c); \
1197 return (wxDragResult)rval; \
1199 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1200 return PCLASS::CBNAME(a, b, c); \
1203 //---------------------------------------------------------------------------
1205 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1206 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1208 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1209 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1210 wxPyBeginBlockThreads(); \
1212 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1214 PyObject* obj = wxPyMake_wxObject(&a); \
1215 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1216 obj, wx2PyString(b))); \
1218 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1223 wxPyEndBlockThreads(); \
1227 //---------------------------------------------------------------------------
1229 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1230 bool CBNAME(wxDragResult a); \
1231 bool base_##CBNAME(wxDragResult a);
1234 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1235 bool CLASS::CBNAME(wxDragResult a) { \
1238 wxPyBeginBlockThreads(); \
1239 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1240 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1241 wxPyEndBlockThreads(); \
1243 rval = PCLASS::CBNAME(a); \
1246 bool CLASS::base_##CBNAME(wxDragResult a) { \
1247 return PCLASS::CBNAME(a); \
1250 //---------------------------------------------------------------------------
1252 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1253 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1256 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1257 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1258 wxPyBeginBlockThreads(); \
1260 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1261 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1262 wxPyEndBlockThreads(); \
1263 return (wxDragResult)rval; \
1266 //---------------------------------------------------------------------------
1268 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1269 bool CBNAME(int a, int b, const wxString& c);
1271 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1272 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1274 wxPyBeginBlockThreads(); \
1275 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1276 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1277 wxPyEndBlockThreads(); \
1281 //---------------------------------------------------------------------------
1283 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1285 size_t base_##CBNAME();
1288 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1289 size_t CLASS::CBNAME() { \
1292 wxPyBeginBlockThreads(); \
1293 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1294 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1295 wxPyEndBlockThreads(); \
1297 rval = PCLASS::CBNAME(); \
1300 size_t CLASS::base_##CBNAME() { \
1301 return PCLASS::CBNAME(); \
1304 //---------------------------------------------------------------------------
1306 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1307 wxDataFormat CBNAME(size_t a); \
1308 wxDataFormat base_##CBNAME(size_t a);
1311 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1312 wxDataFormat CLASS::CBNAME(size_t a) { \
1313 wxDataFormat rval=0; \
1315 wxPyBeginBlockThreads(); \
1316 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1318 wxDataFormat* ptr; \
1319 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1321 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1326 wxPyEndBlockThreads(); \
1328 rval = PCLASS::CBNAME(a); \
1331 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1332 return PCLASS::CBNAME(a); \
1335 //---------------------------------------------------------------------------
1337 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1338 void CBNAME(const Type& a); \
1339 void base_##CBNAME(const Type& a);
1342 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1343 void CLASS::CBNAME(const Type& a) { \
1345 wxPyBeginBlockThreads(); \
1346 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1347 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1348 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1351 wxPyEndBlockThreads(); \
1353 PCLASS::CBNAME(a); \
1355 void CLASS::base_##CBNAME(const Type& a) { \
1356 PCLASS::CBNAME(a); \
1360 //---------------------------------------------------------------------------
1362 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1363 void CBNAME(Type& a); \
1364 void base_##CBNAME(Type& a);
1367 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1368 void CLASS::CBNAME(Type& a) { \
1370 wxPyBeginBlockThreads(); \
1371 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1372 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1373 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1376 wxPyEndBlockThreads(); \
1378 PCLASS::CBNAME(a); \
1380 void CLASS::base_##CBNAME(Type& a) { \
1381 PCLASS::CBNAME(a); \
1384 //---------------------------------------------------------------------------
1386 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1387 bool CBNAME(Type& a); \
1388 bool base_##CBNAME(Type& a);
1391 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1392 bool CLASS::CBNAME(Type& a) { \
1395 wxPyBeginBlockThreads(); \
1396 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1397 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1398 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1401 wxPyEndBlockThreads(); \
1403 rv = PCLASS::CBNAME(a); \
1406 bool CLASS::base_##CBNAME(Type& a) { \
1407 return PCLASS::CBNAME(a); \
1410 //---------------------------------------------------------------------------
1412 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1413 wxString CBNAME(long a, long b) const; \
1414 wxString base_##CBNAME(long a, long b)const ;
1416 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1417 wxString CLASS::CBNAME(long a, long b) const { \
1420 wxPyBeginBlockThreads(); \
1421 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1423 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1425 rval = Py2wxString(ro); \
1429 wxPyEndBlockThreads(); \
1431 rval = PCLASS::CBNAME(a,b); \
1434 wxString CLASS::base_##CBNAME(long a, long b) const { \
1435 return PCLASS::CBNAME(a,b); \
1438 //---------------------------------------------------------------------------
1440 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1441 int CBNAME(long a) const; \
1442 int base_##CBNAME(long a)const ;
1445 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1446 int CLASS::CBNAME(long a) const { \
1449 wxPyBeginBlockThreads(); \
1450 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1452 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1454 rval = PyInt_AsLong(ro); \
1458 wxPyEndBlockThreads(); \
1460 rval = PCLASS::CBNAME(a); \
1463 int CLASS::base_##CBNAME(long a) const { \
1464 return PCLASS::CBNAME(a); \
1468 //---------------------------------------------------------------------------
1470 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1471 wxListItemAttr* CBNAME(long a) const; \
1472 wxListItemAttr* base_##CBNAME(long a);
1475 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1476 wxListItemAttr *CLASS::CBNAME(long a) const { \
1477 wxListItemAttr *rval = NULL; \
1479 wxPyBeginBlockThreads(); \
1480 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1482 wxListItemAttr* ptr; \
1483 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1485 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1490 wxPyEndBlockThreads(); \
1492 rval = PCLASS::CBNAME(a); \
1495 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1496 return PCLASS::CBNAME(a); \
1499 //---------------------------------------------------------------------------
1501 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1502 bool CBNAME(wxMouseEvent& e); \
1503 bool base_##CBNAME(wxMouseEvent& e);
1505 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1506 bool CLASS::CBNAME(wxMouseEvent& e) { \
1509 wxPyBeginBlockThreads(); \
1510 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1512 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1513 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1515 rval = PyInt_AsLong(ro); \
1520 wxPyEndBlockThreads(); \
1522 return PCLASS::CBNAME(e); \
1525 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1526 return PCLASS::CBNAME(e); \
1530 //---------------------------------------------------------------------------