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 //----------------------------------------------------------------------
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 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but doesn't have to use it.
285 //---------------------------------------------------------------------------
288 class wxPyUserData
: public wxObject
{
290 wxPyUserData(PyObject
* obj
) {
296 #ifdef wxPyUSE_EXPORT
297 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
299 wxPyUserData_dtor(this);
306 class wxPyClientData
: public wxClientData
{
308 wxPyClientData(PyObject
* obj
) {
314 #ifdef wxPyUSE_EXPORT
315 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
317 wxPyClientData_dtor(this);
324 class wxPyOORClientData
: public wxPyClientData
{
326 wxPyOORClientData(PyObject
* obj
)
327 : wxPyClientData(obj
) {}
329 ~wxPyOORClientData() {
330 #ifdef wxPyUSE_EXPORT
331 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
333 wxPyOORClientData_dtor(this);
338 //---------------------------------------------------------------------------
339 // This class holds an instance of a Python Shadow Class object and assists
340 // with looking up and invoking Python callback methods from C++ virtual
341 // method redirections. For all classes which have virtuals which should be
342 // overridable in wxPython, a new subclass is created that contains a
343 // wxPyCallbackHelper.
346 class wxPyCallbackHelper
{
348 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
350 wxPyCallbackHelper() {
357 ~wxPyCallbackHelper() {
358 #ifdef wxPyUSE_EXPORT
359 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
361 wxPyCBH_delete(this);
365 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
366 bool findCallback(const char* name
) const;
367 int callCallback(PyObject
* argTuple
) const;
368 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
373 PyObject
* m_lastFound
;
376 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
380 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
381 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
382 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
383 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
384 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
389 //---------------------------------------------------------------------------
390 // These macros are used to implement the virtual methods that should
391 // redirect to a Python method if one exists. The names designate the
392 // return type, if any, as well as any parameter types.
393 //---------------------------------------------------------------------------
396 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
397 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
399 private: wxPyCallbackHelper m_myInst
401 //---------------------------------------------------------------------------
403 #define DEC_PYCALLBACK__(CBNAME) \
405 void base_##CBNAME();
408 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
409 void CLASS::CBNAME() { \
411 wxPyBeginBlockThreads(); \
412 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
413 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
414 wxPyEndBlockThreads(); \
418 void CLASS::base_##CBNAME() { \
422 //---------------------------------------------------------------------------
424 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
425 bool CBNAME(int a, int b); \
426 bool base_##CBNAME(int a, int b);
429 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
430 bool CLASS::CBNAME(int a, int b) { \
431 bool rval=FALSE, found; \
432 wxPyBeginBlockThreads(); \
433 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
434 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
435 wxPyEndBlockThreads(); \
437 rval = PCLASS::CBNAME(a,b); \
440 bool CLASS::base_##CBNAME(int a, int b) { \
441 return PCLASS::CBNAME(a,b); \
444 //---------------------------------------------------------------------------
446 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
447 void CBNAME(int a, int b); \
448 void base_##CBNAME(int a, int b);
451 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
452 void CLASS::CBNAME(int a, int b) { \
454 wxPyBeginBlockThreads(); \
455 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
456 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
457 wxPyEndBlockThreads(); \
459 PCLASS::CBNAME(a,b); \
461 void CLASS::base_##CBNAME(int a, int b) { \
462 PCLASS::CBNAME(a,b); \
465 //---------------------------------------------------------------------------
467 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
468 bool CBNAME(int a); \
469 bool base_##CBNAME(int a);
472 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
473 bool CLASS::CBNAME(int a) { \
474 bool rval=FALSE, found; \
475 wxPyBeginBlockThreads(); \
476 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
477 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
478 wxPyEndBlockThreads(); \
480 rval = PCLASS::CBNAME(a); \
483 bool CLASS::base_##CBNAME(int a) { \
484 return PCLASS::CBNAME(a); \
487 //---------------------------------------------------------------------------
489 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
493 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
494 bool CLASS::CBNAME(int a) { \
496 wxPyBeginBlockThreads(); \
497 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
498 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
500 wxPyEndBlockThreads(); \
505 //---------------------------------------------------------------------------
507 #define DEC_PYCALLBACK__DC(CBNAME) \
508 void CBNAME(wxDC& a); \
509 void base_##CBNAME(wxDC& a);
512 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
513 void CLASS::CBNAME(wxDC& a) { \
515 wxPyBeginBlockThreads(); \
516 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
517 PyObject* obj = wxPyMake_wxObject(&a); \
518 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
521 wxPyEndBlockThreads(); \
525 void CLASS::base_##CBNAME(wxDC& a) { \
531 //---------------------------------------------------------------------------
533 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
534 void CBNAME(wxDC& a, bool b); \
535 void base_##CBNAME(wxDC& a, bool b);
538 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
539 void CLASS::CBNAME(wxDC& a, bool b) { \
541 wxPyBeginBlockThreads(); \
542 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
543 PyObject* obj = wxPyMake_wxObject(&a); \
544 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
547 wxPyEndBlockThreads(); \
549 PCLASS::CBNAME(a, b); \
551 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
552 PCLASS::CBNAME(a, b); \
555 //---------------------------------------------------------------------------
557 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
558 void CBNAME(wxDC& a, bool b); \
559 void base_##CBNAME(wxDC& a, bool b);
562 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
563 void CLASS::CBNAME(wxDC& a, bool b) { \
565 wxPyBeginBlockThreads(); \
566 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
567 PyObject* obj = wxPyMake_wxObject(&a); \
568 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
571 wxPyEndBlockThreads(); \
573 PCLASS::CBNAME(a, b); \
575 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
576 PCLASS::CBNAME(a, b); \
579 //---------------------------------------------------------------------------
581 #define DEC_PYCALLBACK__2DBL(CBNAME) \
582 void CBNAME(double a, double b); \
583 void base_##CBNAME(double a, double b);
586 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
587 void CLASS::CBNAME(double a, double b) { \
589 wxPyBeginBlockThreads(); \
590 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
591 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
592 wxPyEndBlockThreads(); \
594 PCLASS::CBNAME(a, b); \
596 void CLASS::base_##CBNAME(double a, double b) { \
597 PCLASS::CBNAME(a, b); \
600 //---------------------------------------------------------------------------
602 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
603 void CBNAME(double a, double b, int c, int d); \
604 void base_##CBNAME(double a, double b, int c, int d);
607 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
608 void CLASS::CBNAME(double a, double b, int c, int d) { \
610 wxPyBeginBlockThreads(); \
611 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
612 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
614 wxPyEndBlockThreads(); \
616 PCLASS::CBNAME(a, b, c, d); \
618 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
619 PCLASS::CBNAME(a, b, c, d); \
622 //---------------------------------------------------------------------------
624 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
625 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
626 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
629 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
630 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
632 wxPyBeginBlockThreads(); \
633 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
634 PyObject* obj = wxPyMake_wxObject(&a); \
635 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
638 wxPyEndBlockThreads(); \
640 PCLASS::CBNAME(a, b, c, d, e, f); \
642 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
643 PCLASS::CBNAME(a, b, c, d, e, f); \
646 //---------------------------------------------------------------------------
648 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
649 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
650 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
653 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
654 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
656 wxPyBeginBlockThreads(); \
658 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
659 PyObject* obj = wxPyMake_wxObject(&a); \
660 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
663 wxPyEndBlockThreads(); \
665 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
668 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
669 return PCLASS::CBNAME(a, b, c, d, e, f); \
672 //---------------------------------------------------------------------------
674 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
675 void CBNAME(bool a, double b, double c, int d, int e); \
676 void base_##CBNAME(bool a, double b, double c, int d, int e);
679 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
680 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
682 wxPyBeginBlockThreads(); \
683 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
684 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
686 wxPyEndBlockThreads(); \
688 PCLASS::CBNAME(a, b, c, d, e); \
690 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
691 PCLASS::CBNAME(a, b, c, d, e); \
694 //---------------------------------------------------------------------------
696 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
697 void CBNAME(wxDC& a, double b, double c, double d, double e); \
698 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
701 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
702 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
704 wxPyBeginBlockThreads(); \
705 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
706 PyObject* obj = wxPyMake_wxObject(&a); \
707 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
710 wxPyEndBlockThreads(); \
712 PCLASS::CBNAME(a, b, c, d, e); \
714 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
715 PCLASS::CBNAME(a, b, c, d, e); \
718 //---------------------------------------------------------------------------
720 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
721 void CBNAME(wxDC& a, bool b); \
722 void base_##CBNAME(wxDC& a, bool b);
725 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
726 void CLASS::CBNAME(wxDC& a, bool b) { \
728 wxPyBeginBlockThreads(); \
729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
730 PyObject* obj = wxPyMake_wxObject(&a); \
731 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
734 wxPyEndBlockThreads(); \
736 PCLASS::CBNAME(a, b); \
738 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
739 PCLASS::CBNAME(a, b); \
742 //---------------------------------------------------------------------------
744 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
745 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
746 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
749 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
750 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
753 wxPyBeginBlockThreads(); \
754 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
755 PyObject* obj = wxPyMake_wxObject(a); \
756 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
759 wxPyEndBlockThreads(); \
761 PCLASS::CBNAME(a, b, c, d, e, f); \
763 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
765 PCLASS::CBNAME(a, b, c, d, e, f); \
768 //---------------------------------------------------------------------------
770 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
771 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
772 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
775 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
776 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
778 wxPyBeginBlockThreads(); \
779 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
780 PyObject* obj = wxPyMake_wxObject(a); \
781 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
784 wxPyEndBlockThreads(); \
786 PCLASS::CBNAME(a, b, c, d, e); \
788 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
790 PCLASS::CBNAME(a, b, c, d, e); \
793 //---------------------------------------------------------------------------
795 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
796 void CBNAME(double a, double b, int c); \
797 void base_##CBNAME(double a, double b, int c);
800 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
801 void CLASS::CBNAME(double a, double b, int c) { \
803 wxPyBeginBlockThreads(); \
804 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
805 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
806 wxPyEndBlockThreads(); \
808 PCLASS::CBNAME(a, b, c); \
810 void CLASS::base_##CBNAME(double a, double b, int c) { \
811 PCLASS::CBNAME(a, b, c); \
814 //---------------------------------------------------------------------------
816 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
817 void CBNAME(bool a, double b, double c, int d); \
818 void base_##CBNAME(bool a, double b, double c, int d);
821 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
822 void CLASS::CBNAME(bool a, double b, double c, int d) { \
824 wxPyBeginBlockThreads(); \
825 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
826 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
827 wxPyEndBlockThreads(); \
829 PCLASS::CBNAME(a, b, c, d); \
831 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
832 PCLASS::CBNAME(a, b, c, d); \
835 //---------------------------------------------------------------------------
836 //---------------------------------------------------------------------------
838 #define DEC_PYCALLBACK__STRING(CBNAME) \
839 void CBNAME(const wxString& a); \
840 void base_##CBNAME(const wxString& a);
842 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
843 void CLASS::CBNAME(const wxString& a) { \
845 wxPyBeginBlockThreads(); \
846 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
847 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
848 wxPyEndBlockThreads(); \
852 void CLASS::base_##CBNAME(const wxString& a) { \
856 //---------------------------------------------------------------------------
858 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
859 bool CBNAME(const wxString& a); \
860 bool base_##CBNAME(const wxString& a);
862 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
863 bool CLASS::CBNAME(const wxString& a) { \
866 wxPyBeginBlockThreads(); \
867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
868 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
869 wxPyEndBlockThreads(); \
871 rval = PCLASS::CBNAME(a); \
874 bool CLASS::base_##CBNAME(const wxString& a) { \
875 return PCLASS::CBNAME(a); \
878 //---------------------------------------------------------------------------
880 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
881 bool CBNAME(const wxString& a);
883 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
884 bool CLASS::CBNAME(const wxString& a) { \
886 wxPyBeginBlockThreads(); \
887 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
888 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
889 wxPyEndBlockThreads(); \
893 //---------------------------------------------------------------------------
895 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
896 wxString CBNAME(const wxString& a); \
898 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
899 wxString CLASS::CBNAME(const wxString& a) { \
901 wxPyBeginBlockThreads(); \
902 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
904 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
906 rval = Py2wxString(ro); \
910 wxPyEndBlockThreads(); \
914 //---------------------------------------------------------------------------
916 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
917 wxString CBNAME(const wxString& a,int b); \
919 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
920 wxString CLASS::CBNAME(const wxString& a,int b) { \
922 wxPyBeginBlockThreads(); \
923 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
925 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
927 rval = Py2wxString(ro); \
931 wxPyEndBlockThreads(); \
935 //---------------------------------------------------------------------------
937 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
938 bool CBNAME(const wxString& a, const wxString& b); \
939 bool base_##CBNAME(const wxString& a, const wxString& b);
941 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
942 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
945 wxPyBeginBlockThreads(); \
946 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
947 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
948 wx2PyString(a), wx2PyString(b))); \
949 wxPyEndBlockThreads(); \
951 rval = PCLASS::CBNAME(a, b); \
954 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
955 return PCLASS::CBNAME(a, b); \
958 //---------------------------------------------------------------------------
960 #define DEC_PYCALLBACK_STRING_(CBNAME) \
962 wxString base_##CBNAME();
964 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
965 wxString CLASS::CBNAME() { \
968 wxPyBeginBlockThreads(); \
969 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
971 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
973 rval = Py2wxString(ro); \
977 wxPyEndBlockThreads(); \
979 rval = PCLASS::CBNAME(); \
982 wxString CLASS::base_##CBNAME() { \
983 return PCLASS::CBNAME(); \
986 //---------------------------------------------------------------------------
988 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
991 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
992 wxString CLASS::CBNAME() { \
994 wxPyBeginBlockThreads(); \
995 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
997 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
999 rval = Py2wxString(ro); \
1003 wxPyEndBlockThreads(); \
1007 //---------------------------------------------------------------------------
1009 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1010 bool CBNAME(const wxHtmlTag& a); \
1013 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1014 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1016 wxPyBeginBlockThreads(); \
1017 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1018 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1019 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1022 wxPyEndBlockThreads(); \
1026 //---------------------------------------------------------------------------
1028 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1029 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1030 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1032 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1033 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1035 wxPyBeginBlockThreads(); \
1036 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1037 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1038 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1041 wxPyEndBlockThreads(); \
1043 PCLASS::CBNAME(cell, x, y); \
1045 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1046 PCLASS::CBNAME(cell, x, y); \
1050 //---------------------------------------------------------------------------
1052 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1053 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1054 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1056 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1057 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1059 wxPyBeginBlockThreads(); \
1060 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1061 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1062 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1063 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1067 wxPyEndBlockThreads(); \
1069 PCLASS::CBNAME(cell, x, y, e); \
1071 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1072 PCLASS::CBNAME(cell, x, y, e); \
1077 //---------------------------------------------------------------------------
1079 #define DEC_PYCALLBACK___pure(CBNAME) \
1083 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1084 void CLASS::CBNAME() { \
1085 wxPyBeginBlockThreads(); \
1086 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1087 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1088 wxPyEndBlockThreads(); \
1091 //---------------------------------------------------------------------------
1093 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1097 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1098 wxSize CLASS::CBNAME() { \
1099 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1101 wxPyBeginBlockThreads(); \
1102 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1105 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1107 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1109 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1110 PyObject* o1 = PySequence_GetItem(ro, 0); \
1111 PyObject* o2 = PySequence_GetItem(ro, 1); \
1112 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1113 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1115 PyErr_SetString(PyExc_TypeError, errmsg); \
1120 PyErr_SetString(PyExc_TypeError, errmsg); \
1125 wxPyEndBlockThreads(); \
1129 //---------------------------------------------------------------------------
1131 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1132 bool CBNAME(wxWindow* a); \
1133 bool base_##CBNAME(wxWindow* a);
1136 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1137 bool CLASS::CBNAME(wxWindow* a) { \
1140 wxPyBeginBlockThreads(); \
1141 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1142 PyObject* obj = wxPyMake_wxObject(a); \
1143 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1146 wxPyEndBlockThreads(); \
1148 rval = PCLASS::CBNAME(a); \
1151 bool CLASS::base_##CBNAME(wxWindow* a) { \
1152 return PCLASS::CBNAME(a); \
1155 //---------------------------------------------------------------------------
1157 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1159 bool base_##CBNAME();
1162 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1163 bool CLASS::CBNAME() { \
1166 wxPyBeginBlockThreads(); \
1167 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1168 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1169 wxPyEndBlockThreads(); \
1171 rval = PCLASS::CBNAME(); \
1174 bool CLASS::base_##CBNAME() { \
1175 return PCLASS::CBNAME(); \
1178 //---------------------------------------------------------------------------
1180 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1181 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1182 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1185 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1186 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1189 wxPyBeginBlockThreads(); \
1190 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1191 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1192 wxPyEndBlockThreads(); \
1194 rval = PCLASS::CBNAME(a, b, c); \
1195 return (wxDragResult)rval; \
1197 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1198 return PCLASS::CBNAME(a, b, c); \
1201 //---------------------------------------------------------------------------
1203 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1204 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1206 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1207 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1208 wxPyBeginBlockThreads(); \
1210 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1212 PyObject* obj = wxPyMake_wxObject(&a); \
1213 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1214 obj, wx2PyString(b))); \
1216 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1221 wxPyEndBlockThreads(); \
1225 //---------------------------------------------------------------------------
1227 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1228 bool CBNAME(wxDragResult a); \
1229 bool base_##CBNAME(wxDragResult a);
1232 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1233 bool CLASS::CBNAME(wxDragResult a) { \
1236 wxPyBeginBlockThreads(); \
1237 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1238 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1239 wxPyEndBlockThreads(); \
1241 rval = PCLASS::CBNAME(a); \
1244 bool CLASS::base_##CBNAME(wxDragResult a) { \
1245 return PCLASS::CBNAME(a); \
1248 //---------------------------------------------------------------------------
1250 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1251 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1254 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1255 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1256 wxPyBeginBlockThreads(); \
1258 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1259 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1260 wxPyEndBlockThreads(); \
1261 return (wxDragResult)rval; \
1264 //---------------------------------------------------------------------------
1266 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1267 bool CBNAME(int a, int b, const wxString& c);
1269 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1270 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1272 wxPyBeginBlockThreads(); \
1273 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1274 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1275 wxPyEndBlockThreads(); \
1279 //---------------------------------------------------------------------------
1281 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1283 size_t base_##CBNAME();
1286 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1287 size_t CLASS::CBNAME() { \
1290 wxPyBeginBlockThreads(); \
1291 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1292 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1293 wxPyEndBlockThreads(); \
1295 rval = PCLASS::CBNAME(); \
1298 size_t CLASS::base_##CBNAME() { \
1299 return PCLASS::CBNAME(); \
1302 //---------------------------------------------------------------------------
1304 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1305 wxDataFormat CBNAME(size_t a); \
1306 wxDataFormat base_##CBNAME(size_t a);
1309 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1310 wxDataFormat CLASS::CBNAME(size_t a) { \
1311 wxDataFormat rval=0; \
1313 wxPyBeginBlockThreads(); \
1314 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1316 wxDataFormat* ptr; \
1317 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1319 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1324 wxPyEndBlockThreads(); \
1326 rval = PCLASS::CBNAME(a); \
1329 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1330 return PCLASS::CBNAME(a); \
1333 //---------------------------------------------------------------------------
1335 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1336 void CBNAME(const Type& a); \
1337 void base_##CBNAME(const Type& a);
1340 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1341 void CLASS::CBNAME(const Type& a) { \
1343 wxPyBeginBlockThreads(); \
1344 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1345 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1346 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1349 wxPyEndBlockThreads(); \
1351 PCLASS::CBNAME(a); \
1353 void CLASS::base_##CBNAME(const Type& a) { \
1354 PCLASS::CBNAME(a); \
1358 //---------------------------------------------------------------------------
1360 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1361 void CBNAME(Type& a); \
1362 void base_##CBNAME(Type& a);
1365 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1366 void CLASS::CBNAME(Type& a) { \
1368 wxPyBeginBlockThreads(); \
1369 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1370 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1371 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1374 wxPyEndBlockThreads(); \
1376 PCLASS::CBNAME(a); \
1378 void CLASS::base_##CBNAME(Type& a) { \
1379 PCLASS::CBNAME(a); \
1382 //---------------------------------------------------------------------------
1384 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1385 bool CBNAME(Type& a); \
1386 bool base_##CBNAME(Type& a);
1389 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1390 bool CLASS::CBNAME(Type& a) { \
1393 wxPyBeginBlockThreads(); \
1394 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1395 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1396 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1399 wxPyEndBlockThreads(); \
1401 rv = PCLASS::CBNAME(a); \
1404 bool CLASS::base_##CBNAME(Type& a) { \
1405 return PCLASS::CBNAME(a); \
1408 //---------------------------------------------------------------------------
1410 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1411 wxString CBNAME(long a, long b) const; \
1412 wxString base_##CBNAME(long a, long b)const ;
1414 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1415 wxString CLASS::CBNAME(long a, long b) const { \
1418 wxPyBeginBlockThreads(); \
1419 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1421 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1423 rval = Py2wxString(ro); \
1427 wxPyEndBlockThreads(); \
1429 rval = PCLASS::CBNAME(a,b); \
1432 wxString CLASS::base_##CBNAME(long a, long b) const { \
1433 return PCLASS::CBNAME(a,b); \
1436 //---------------------------------------------------------------------------
1438 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1439 int CBNAME(long a) const; \
1440 int base_##CBNAME(long a)const ;
1443 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1444 int CLASS::CBNAME(long a) const { \
1447 wxPyBeginBlockThreads(); \
1448 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1450 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1452 rval = PyInt_AsLong(ro); \
1456 wxPyEndBlockThreads(); \
1458 rval = PCLASS::CBNAME(a); \
1461 int CLASS::base_##CBNAME(long a) const { \
1462 return PCLASS::CBNAME(a); \
1466 //---------------------------------------------------------------------------
1468 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1469 wxListItemAttr* CBNAME(long a) const; \
1470 wxListItemAttr* base_##CBNAME(long a);
1473 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1474 wxListItemAttr *CLASS::CBNAME(long a) const { \
1475 wxListItemAttr *rval = NULL; \
1477 wxPyBeginBlockThreads(); \
1478 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1480 wxListItemAttr* ptr; \
1481 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1483 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1488 wxPyEndBlockThreads(); \
1490 rval = PCLASS::CBNAME(a); \
1493 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1494 return PCLASS::CBNAME(a); \
1497 //---------------------------------------------------------------------------
1499 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1500 bool CBNAME(wxMouseEvent& e); \
1501 bool base_##CBNAME(wxMouseEvent& e);
1503 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1504 bool CLASS::CBNAME(wxMouseEvent& e) { \
1507 wxPyBeginBlockThreads(); \
1508 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1510 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1511 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1513 rval = PyInt_AsLong(ro); \
1518 wxPyEndBlockThreads(); \
1520 return PCLASS::CBNAME(e); \
1523 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1524 return PCLASS::CBNAME(e); \
1528 //---------------------------------------------------------------------------