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__
18 //----------------------------------------------------------------------
20 // if we want to handle threads and Python threads are available...
21 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
23 #define WXP_WITH_THREAD
24 #define wxPy_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
25 #define wxPy_END_ALLOW_THREADS Py_END_ALLOW_THREADS
27 #else // no Python threads...
28 #undef WXP_WITH_THREAD
29 #define wxPy_BEGIN_ALLOW_THREADS
30 #define wxPy_END_ALLOW_THREADS
34 //---------------------------------------------------------------------------
36 typedef unsigned char byte
;
39 class wxPyApp
: public wxApp
47 extern wxPyApp
*wxPythonApp
;
49 //----------------------------------------------------------------------
52 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
55 //extern PyObject* wxPython_dict;
56 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
58 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
60 PyObject
* wxPyConstructObject(void* ptr
,
61 const char* className
,
63 PyObject
* wxPyConstructObject(void* ptr
,
64 const char* className
,
67 PyObject
* wxPyClassExists(const char* className
);
68 PyObject
* wxPyMake_wxObject(wxObject
* source
);
69 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
71 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
72 long wxPyGetWinHandle(wxWindow
* win
);
74 //----------------------------------------------------------------------
77 PyThreadState
* newState
;
78 PyThreadState
* prevState
;
80 wxPyTState() : newState(NULL
), prevState(NULL
) {}
84 wxPyTState
* wxPyBeginBlockThreads();
85 void wxPyEndBlockThreads(wxPyTState
* state
);
88 //----------------------------------------------------------------------
89 // Handle wxInputStreams by Joerg Baumann
90 // See stream.i for implementations
92 // list class for return list of strings, e.g. readlines()
93 WX_DECLARE_LIST(wxString
, wxStringPtrList
);
96 // C++ class wxPyInputStream to act as base for python class wxInputStream
97 // Use it in python like a python file object
98 class wxPyInputStream
{
100 // underlying wxInputStream
104 wxPyInputStream(wxInputStream
* wxi_
) : wxi(wxi_
) {}
107 // python file object interface for input files (most of it)
111 wxString
* read(int size
=-1);
112 wxString
* readline(int size
=-1);
113 wxStringPtrList
* readlines(int sizehint
=-1);
114 void seek(int offset
, int whence
=0);
119 void truncate(int size=-1);
120 void write(wxString data);
121 void writelines(wxStringPtrList);
126 //----------------------------------------------------------------------
127 // These are helpers used by the typemaps
129 byte
* byte_LIST_helper(PyObject
* source
);
130 int* int_LIST_helper(PyObject
* source
);
131 long* long_LIST_helper(PyObject
* source
);
132 char** string_LIST_helper(PyObject
* source
);
133 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
134 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
135 wxString
* wxString_LIST_helper(PyObject
* source
);
136 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
137 wxPen
** wxPen_LIST_helper(PyObject
* source
);
139 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
140 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
141 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
142 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
143 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
145 #if PYTHON_API_VERSION < 1009
146 #define PySequence_Fast_GET_ITEM(o, i) \
147 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
150 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
151 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
154 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& app
);
157 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
159 //----------------------------------------------------------------------
162 extern "C" void SWIG_MakePtr(char *, void *, char *);
163 extern "C" char *SWIG_GetPtr(char *, void **, char *);
164 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
169 # pragma warning(disable:4800)
170 # pragma warning(disable:4190)
173 //----------------------------------------------------------------------
175 class wxPyCallback
: public wxObject
{
176 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
178 wxPyCallback(PyObject
* func
);
179 wxPyCallback(const wxPyCallback
& other
);
182 void EventThunker(wxEvent
& event
);
187 //---------------------------------------------------------------------------
189 class wxPyTimer
: public wxTimer
{
191 wxPyTimer(PyObject
* callback
);
200 //---------------------------------------------------------------------------
201 //---------------------------------------------------------------------------
202 // These Event classes can be derived from in Python and passed through the
203 // event system without loosing anything. They do this by keeping a reference
204 // to themselves and some special case handling in wxPyCallback::EventThunker.
207 class wxPyEvtSelfRef
{
212 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
213 PyObject
* GetSelf() const;
221 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
222 DECLARE_DYNAMIC_CLASS(wxPyEvent
)
227 void CopyObject(wxObject
& dest
) const;
231 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
232 DECLARE_DYNAMIC_CLASS(wxPyCommandEvent
)
234 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
237 void CopyObject(wxObject
& dest
) const;
241 //---------------------------------------------------------------------------
242 // Export a C API in a struct. Other modules will be able to load this from
243 // the wxc module and will then have safe access to these functions, even if
244 // in another shared library.
246 class wxPyCallbackHelper
;
250 void (*p_SWIG_MakePtr
)(char*, void*, char*);
251 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
252 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
253 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
254 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
255 PyObject
* (*p_SWIG_newvarlink
)(void);
257 wxPyTState
* (*p_wxPyBeginBlockThreads
)();
258 void (*p_wxPyEndBlockThreads
)(wxPyTState
* state
);
260 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
261 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
263 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
264 int* (*p_int_LIST_helper
)(PyObject
* source
);
265 long* (*p_long_LIST_helper
)(PyObject
* source
);
266 char** (*p_string_LIST_helper
)(PyObject
* source
);
267 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
268 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
269 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
270 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
272 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
273 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
274 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
275 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
276 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
278 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
279 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
280 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
281 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
282 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
284 PyObject
* (*p_wxPyClassExists
)(const char* className
);
285 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
);
286 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
290 #ifdef wxPyUSE_EXPORT
291 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
294 //---------------------------------------------------------------------------
295 // This class holds an instance of a Python Shadow Class object and assists
296 // with looking up and invoking Python callback methods from C++ virtual
297 // method redirections. For all classes which have virtuals which should be
298 // overridable in wxPython, a new subclass is created that contains a
299 // wxPyCallbackHelper.
302 class wxPyCallbackHelper
{
304 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
306 wxPyCallbackHelper() {
313 ~wxPyCallbackHelper() {
314 #ifdef wxPyUSE_EXPORT
315 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
317 wxPyCBH_delete(this);
321 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
322 bool findCallback(const char* name
) const;
323 int callCallback(PyObject
* argTuple
) const;
324 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
329 PyObject
* m_lastFound
;
332 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
336 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
337 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
338 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
339 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
340 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
344 //----------------------------------------------------------------------
346 class wxPyUserData
: public wxObject
{
348 wxPyUserData(PyObject
* obj
) {
354 #ifdef wxPyUSE_EXPORT
355 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
357 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
359 wxPyTState
* state
= wxPyBeginBlockThreads();
361 wxPyEndBlockThreads(state
);
369 class wxPyClientData
: public wxClientData
{
371 wxPyClientData(PyObject
* obj
) {
377 #ifdef wxPyUSE_EXPORT
378 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
380 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
382 wxPyTState
* state
= wxPyBeginBlockThreads();
384 wxPyEndBlockThreads(state
);
392 //---------------------------------------------------------------------------
393 // These macros are used to implement the virtual methods that should
394 // redirect to a Python method if one exists. The names designate the
395 // return type, if any, as well as any parameter types.
396 //---------------------------------------------------------------------------
399 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
400 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
402 private: wxPyCallbackHelper m_myInst
404 //---------------------------------------------------------------------------
406 #define DEC_PYCALLBACK__(CBNAME) \
408 void base_##CBNAME();
411 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
412 void CLASS::CBNAME() { \
414 wxPyTState* state = wxPyBeginBlockThreads(); \
415 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
416 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
417 wxPyEndBlockThreads(state); \
421 void CLASS::base_##CBNAME() { \
425 //---------------------------------------------------------------------------
427 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
428 bool CBNAME(int a, int b); \
429 bool base_##CBNAME(int a, int b);
432 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
433 bool CLASS::CBNAME(int a, int b) { \
434 bool rval=FALSE, found; \
435 wxPyTState* state = wxPyBeginBlockThreads(); \
436 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
437 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
438 wxPyEndBlockThreads(state); \
440 rval = PCLASS::CBNAME(a,b); \
443 bool CLASS::base_##CBNAME(int a, int b) { \
444 return PCLASS::CBNAME(a,b); \
447 //---------------------------------------------------------------------------
449 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
450 void CBNAME(int a, int b); \
451 void base_##CBNAME(int a, int b);
454 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
455 void CLASS::CBNAME(int a, int b) { \
457 wxPyTState* state = wxPyBeginBlockThreads(); \
458 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
459 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
460 wxPyEndBlockThreads(state); \
462 PCLASS::CBNAME(a,b); \
464 void CLASS::base_##CBNAME(int a, int b) { \
465 PCLASS::CBNAME(a,b); \
468 //---------------------------------------------------------------------------
470 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
471 bool CBNAME(int a); \
472 bool base_##CBNAME(int a);
475 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
476 bool CLASS::CBNAME(int a) { \
477 bool rval=FALSE, found; \
478 wxPyTState* state = wxPyBeginBlockThreads(); \
479 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
480 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
481 wxPyEndBlockThreads(state); \
483 rval = PCLASS::CBNAME(a); \
486 bool CLASS::base_##CBNAME(int a) { \
487 return PCLASS::CBNAME(a); \
490 //---------------------------------------------------------------------------
492 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
496 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
497 bool CLASS::CBNAME(int a) { \
499 wxPyTState* state = wxPyBeginBlockThreads(); \
500 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
501 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
503 wxPyEndBlockThreads(state); \
508 //---------------------------------------------------------------------------
510 #define DEC_PYCALLBACK__DC(CBNAME) \
511 void CBNAME(wxDC& a); \
512 void base_##CBNAME(wxDC& a);
515 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
516 void CLASS::CBNAME(wxDC& a) { \
518 wxPyTState* state = wxPyBeginBlockThreads(); \
519 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
520 PyObject* obj = wxPyMake_wxObject(&a); \
521 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
524 wxPyEndBlockThreads(state); \
528 void CLASS::base_##CBNAME(wxDC& a) { \
534 //---------------------------------------------------------------------------
536 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
537 void CBNAME(wxDC& a, bool b); \
538 void base_##CBNAME(wxDC& a, bool b);
541 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
542 void CLASS::CBNAME(wxDC& a, bool b) { \
544 wxPyTState* state = wxPyBeginBlockThreads(); \
545 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
546 PyObject* obj = wxPyMake_wxObject(&a); \
547 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
550 wxPyEndBlockThreads(state); \
552 PCLASS::CBNAME(a, b); \
554 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
555 PCLASS::CBNAME(a, b); \
558 //---------------------------------------------------------------------------
560 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
561 void CBNAME(wxDC& a, bool b); \
562 void base_##CBNAME(wxDC& a, bool b);
565 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
566 void CLASS::CBNAME(wxDC& a, bool b) { \
568 wxPyTState* state = wxPyBeginBlockThreads(); \
569 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
570 PyObject* obj = wxPyMake_wxObject(&a); \
571 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
574 wxPyEndBlockThreads(state); \
576 PCLASS::CBNAME(a, b); \
578 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
579 PCLASS::CBNAME(a, b); \
582 //---------------------------------------------------------------------------
584 #define DEC_PYCALLBACK__2DBL(CBNAME) \
585 void CBNAME(double a, double b); \
586 void base_##CBNAME(double a, double b);
589 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
590 void CLASS::CBNAME(double a, double b) { \
592 wxPyTState* state = wxPyBeginBlockThreads(); \
593 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
594 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
595 wxPyEndBlockThreads(state); \
597 PCLASS::CBNAME(a, b); \
599 void CLASS::base_##CBNAME(double a, double b) { \
600 PCLASS::CBNAME(a, b); \
603 //---------------------------------------------------------------------------
605 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
606 void CBNAME(double a, double b, int c, int d); \
607 void base_##CBNAME(double a, double b, int c, int d);
610 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
611 void CLASS::CBNAME(double a, double b, int c, int d) { \
613 wxPyTState* state = wxPyBeginBlockThreads(); \
614 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
615 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
617 wxPyEndBlockThreads(state); \
619 PCLASS::CBNAME(a, b, c, d); \
621 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
622 PCLASS::CBNAME(a, b, c, d); \
625 //---------------------------------------------------------------------------
627 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
628 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
629 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
632 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
633 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
635 wxPyTState* state = wxPyBeginBlockThreads(); \
636 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
637 PyObject* obj = wxPyMake_wxObject(&a); \
638 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
641 wxPyEndBlockThreads(state); \
643 PCLASS::CBNAME(a, b, c, d, e, f); \
645 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
646 PCLASS::CBNAME(a, b, c, d, e, f); \
649 //---------------------------------------------------------------------------
651 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
652 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
653 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
656 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
657 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
659 wxPyTState* state = wxPyBeginBlockThreads(); \
661 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
662 PyObject* obj = wxPyMake_wxObject(&a); \
663 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
666 wxPyEndBlockThreads(state); \
668 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
671 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
672 return PCLASS::CBNAME(a, b, c, d, e, f); \
675 //---------------------------------------------------------------------------
677 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
678 void CBNAME(bool a, double b, double c, int d, int e); \
679 void base_##CBNAME(bool a, double b, double c, int d, int e);
682 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
683 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
685 wxPyTState* state = wxPyBeginBlockThreads(); \
686 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
687 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
689 wxPyEndBlockThreads(state); \
691 PCLASS::CBNAME(a, b, c, d, e); \
693 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
694 PCLASS::CBNAME(a, b, c, d, e); \
697 //---------------------------------------------------------------------------
699 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
700 void CBNAME(wxDC& a, double b, double c, double d, double e); \
701 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
704 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
705 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
707 wxPyTState* state = wxPyBeginBlockThreads(); \
708 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
709 PyObject* obj = wxPyMake_wxObject(&a); \
710 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
713 wxPyEndBlockThreads(state); \
715 PCLASS::CBNAME(a, b, c, d, e); \
717 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
718 PCLASS::CBNAME(a, b, c, d, e); \
721 //---------------------------------------------------------------------------
723 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
724 void CBNAME(wxDC& a, bool b); \
725 void base_##CBNAME(wxDC& a, bool b);
728 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
729 void CLASS::CBNAME(wxDC& a, bool b) { \
731 wxPyTState* state = wxPyBeginBlockThreads(); \
732 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
733 PyObject* obj = wxPyMake_wxObject(&a); \
734 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
737 wxPyEndBlockThreads(state); \
739 PCLASS::CBNAME(a, b); \
741 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
742 PCLASS::CBNAME(a, b); \
745 //---------------------------------------------------------------------------
747 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
748 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
749 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
752 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
753 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
756 wxPyTState* state = wxPyBeginBlockThreads(); \
757 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
758 PyObject* obj = wxPyMake_wxObject(a); \
759 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
762 wxPyEndBlockThreads(state); \
764 PCLASS::CBNAME(a, b, c, d, e, f); \
766 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
768 PCLASS::CBNAME(a, b, c, d, e, f); \
771 //---------------------------------------------------------------------------
773 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
774 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
775 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
778 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
779 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
781 wxPyTState* state = wxPyBeginBlockThreads(); \
782 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
783 PyObject* obj = wxPyMake_wxObject(a); \
784 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
787 wxPyEndBlockThreads(state); \
789 PCLASS::CBNAME(a, b, c, d, e); \
791 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
793 PCLASS::CBNAME(a, b, c, d, e); \
796 //---------------------------------------------------------------------------
798 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
799 void CBNAME(double a, double b, int c); \
800 void base_##CBNAME(double a, double b, int c);
803 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
804 void CLASS::CBNAME(double a, double b, int c) { \
806 wxPyTState* state = wxPyBeginBlockThreads(); \
807 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
808 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
809 wxPyEndBlockThreads(state); \
811 PCLASS::CBNAME(a, b, c); \
813 void CLASS::base_##CBNAME(double a, double b, int c) { \
814 PCLASS::CBNAME(a, b, c); \
817 //---------------------------------------------------------------------------
819 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
820 void CBNAME(bool a, double b, double c, int d); \
821 void base_##CBNAME(bool a, double b, double c, int d);
824 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
825 void CLASS::CBNAME(bool a, double b, double c, int d) { \
827 wxPyTState* state = wxPyBeginBlockThreads(); \
828 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
829 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
830 wxPyEndBlockThreads(state); \
832 PCLASS::CBNAME(a, b, c, d); \
834 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
835 PCLASS::CBNAME(a, b, c, d); \
838 //---------------------------------------------------------------------------
839 //---------------------------------------------------------------------------
841 #define DEC_PYCALLBACK__STRING(CBNAME) \
842 void CBNAME(const wxString& a); \
843 void base_##CBNAME(const wxString& a);
846 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
847 void CLASS::CBNAME(const wxString& a) { \
849 wxPyTState* state = wxPyBeginBlockThreads(); \
850 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
851 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
852 wxPyEndBlockThreads(state); \
856 void CLASS::base_##CBNAME(const wxString& a) { \
860 //---------------------------------------------------------------------------
862 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
863 bool CBNAME(const wxString& a); \
864 bool base_##CBNAME(const wxString& a);
867 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
868 bool CLASS::CBNAME(const wxString& a) { \
871 wxPyTState* state = wxPyBeginBlockThreads(); \
872 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
873 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
874 wxPyEndBlockThreads(state); \
876 rval = PCLASS::CBNAME(a); \
879 bool CLASS::base_##CBNAME(const wxString& a) { \
880 return PCLASS::CBNAME(a); \
883 //---------------------------------------------------------------------------
885 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
886 bool CBNAME(const wxString& a);
888 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
889 bool CLASS::CBNAME(const wxString& a) { \
891 wxPyTState* state = wxPyBeginBlockThreads(); \
892 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
893 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
894 wxPyEndBlockThreads(state); \
898 //---------------------------------------------------------------------------
900 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
901 wxString CBNAME(const wxString& a); \
903 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
904 wxString CLASS::CBNAME(const wxString& a) { \
906 wxPyTState* state = wxPyBeginBlockThreads(); \
907 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
909 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
911 PyObject* str = PyObject_Str(ro); \
912 rval = PyString_AsString(str); \
913 Py_DECREF(ro); Py_DECREF(str); \
916 wxPyEndBlockThreads(state); \
920 //---------------------------------------------------------------------------
922 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
923 wxString CBNAME(const wxString& a,int b); \
925 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
926 wxString CLASS::CBNAME(const wxString& a,int b) { \
928 wxPyTState* state = wxPyBeginBlockThreads(); \
929 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
931 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
933 PyObject* str = PyObject_Str(ro); \
934 rval = PyString_AsString(str); \
935 Py_DECREF(ro); Py_DECREF(str); \
938 wxPyEndBlockThreads(state); \
942 //---------------------------------------------------------------------------
944 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
945 bool CBNAME(const wxString& a, const wxString& b); \
946 bool base_##CBNAME(const wxString& a, const wxString& b);
949 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
950 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
953 wxPyTState* state = wxPyBeginBlockThreads(); \
954 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
955 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
956 a.c_str(), b.c_str())); \
957 wxPyEndBlockThreads(state); \
959 rval = PCLASS::CBNAME(a, b); \
962 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
963 return PCLASS::CBNAME(a, b); \
966 //---------------------------------------------------------------------------
968 #define DEC_PYCALLBACK_STRING_(CBNAME) \
970 wxString base_##CBNAME();
973 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
974 wxString CLASS::CBNAME() { \
977 wxPyTState* state = wxPyBeginBlockThreads(); \
978 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
980 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
982 PyObject* str = PyObject_Str(ro); \
983 rval = PyString_AsString(str); \
984 Py_DECREF(ro); Py_DECREF(str); \
987 wxPyEndBlockThreads(state); \
989 rval = PCLASS::CBNAME(); \
992 wxString CLASS::base_##CBNAME() { \
993 return PCLASS::CBNAME(); \
996 //---------------------------------------------------------------------------
998 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1002 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1003 wxString CLASS::CBNAME() { \
1005 wxPyTState* state = wxPyBeginBlockThreads(); \
1006 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1008 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1010 PyObject* str = PyObject_Str(ro); \
1011 rval = PyString_AsString(str); \
1012 Py_DECREF(ro); Py_DECREF(str); \
1015 wxPyEndBlockThreads(state); \
1019 //---------------------------------------------------------------------------
1021 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1022 bool CBNAME(const wxHtmlTag& a); \
1025 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1026 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1028 wxPyTState* state = wxPyBeginBlockThreads(); \
1029 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1030 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1031 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1034 wxPyEndBlockThreads(state); \
1038 //---------------------------------------------------------------------------
1040 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1041 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1042 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1044 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1045 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1048 wxPyTState* state = wxPyBeginBlockThreads(); \
1049 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1050 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1051 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1054 wxPyEndBlockThreads(state); \
1056 PCLASS::CBNAME(cell, x, y); \
1058 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1059 PCLASS::CBNAME(cell, x, y); \
1063 //---------------------------------------------------------------------------
1065 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1066 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1067 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1069 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1070 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1072 wxPyTState* state = wxPyBeginBlockThreads(); \
1073 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1074 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1075 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1076 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1080 wxPyEndBlockThreads(state); \
1082 PCLASS::CBNAME(cell, x, y, e); \
1084 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1085 PCLASS::CBNAME(cell, x, y, e); \
1090 //---------------------------------------------------------------------------
1092 #define DEC_PYCALLBACK___pure(CBNAME) \
1096 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1097 void CLASS::CBNAME() { \
1098 wxPyTState* state = wxPyBeginBlockThreads(); \
1099 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1100 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1101 wxPyEndBlockThreads(state); \
1104 //---------------------------------------------------------------------------
1106 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1110 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1111 wxSize CLASS::CBNAME() { \
1113 wxPyTState* state = wxPyBeginBlockThreads(); \
1114 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1117 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1119 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1124 wxPyEndBlockThreads(state); \
1128 //---------------------------------------------------------------------------
1130 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1131 bool CBNAME(wxWindow* a); \
1132 bool base_##CBNAME(wxWindow* a);
1135 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1136 bool CLASS::CBNAME(wxWindow* a) { \
1139 wxPyTState* state = wxPyBeginBlockThreads(); \
1140 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1141 PyObject* obj = wxPyMake_wxObject(a); \
1142 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1145 wxPyEndBlockThreads(state); \
1147 rval = PCLASS::CBNAME(a); \
1150 bool CLASS::base_##CBNAME(wxWindow* a) { \
1151 return PCLASS::CBNAME(a); \
1154 //---------------------------------------------------------------------------
1156 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1158 bool base_##CBNAME();
1161 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1162 bool CLASS::CBNAME() { \
1165 wxPyTState* state = wxPyBeginBlockThreads(); \
1166 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1167 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1168 wxPyEndBlockThreads(state); \
1170 rval = PCLASS::CBNAME(); \
1173 bool CLASS::base_##CBNAME() { \
1174 return PCLASS::CBNAME(); \
1177 //---------------------------------------------------------------------------
1179 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1180 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1181 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1184 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1185 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1188 wxPyTState* state = wxPyBeginBlockThreads(); \
1189 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1190 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1191 wxPyEndBlockThreads(state); \
1193 rval = PCLASS::CBNAME(a, b, c); \
1194 return (wxDragResult)rval; \
1196 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1197 return PCLASS::CBNAME(a, b, c); \
1200 //---------------------------------------------------------------------------
1202 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1203 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1205 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1206 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1207 wxPyTState* state = wxPyBeginBlockThreads(); \
1209 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1211 PyObject* obj = wxPyMake_wxObject(&a); \
1212 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1215 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1220 wxPyEndBlockThreads(state); \
1224 //---------------------------------------------------------------------------
1226 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1227 bool CBNAME(wxDragResult a); \
1228 bool base_##CBNAME(wxDragResult a);
1231 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1232 bool CLASS::CBNAME(wxDragResult a) { \
1235 wxPyTState* state = wxPyBeginBlockThreads(); \
1236 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1237 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1238 wxPyEndBlockThreads(state); \
1240 rval = PCLASS::CBNAME(a); \
1243 bool CLASS::base_##CBNAME(wxDragResult a) { \
1244 return PCLASS::CBNAME(a); \
1247 //---------------------------------------------------------------------------
1249 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1250 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1253 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1254 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1255 wxPyTState* state = wxPyBeginBlockThreads(); \
1257 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1258 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1259 wxPyEndBlockThreads(state); \
1260 return (wxDragResult)rval; \
1263 //---------------------------------------------------------------------------
1265 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1266 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 wxPyTState* state = wxPyBeginBlockThreads(); \
1273 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1274 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1275 wxPyEndBlockThreads(state); \
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 wxPyTState* state = wxPyBeginBlockThreads(); \
1291 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1292 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1293 wxPyEndBlockThreads(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 ;
1415 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1416 wxString CLASS::CBNAME(long a, long b) const { \
1419 wxPyTState* state = wxPyBeginBlockThreads(); \
1420 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1422 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1424 PyObject* str = PyObject_Str(ro); \
1425 rval = PyString_AsString(str); \
1426 Py_DECREF(ro); Py_DECREF(str); \
1429 wxPyEndBlockThreads(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
1522 return PCLASS::CBNAME(e); \
1525 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1526 return PCLASS::CBNAME(e); \
1530 //---------------------------------------------------------------------------