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_ABSTRACT_CLASS(wxPyEvent
)
225 wxPyEvent(const wxPyEvent
& evt
);
228 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
232 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
233 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
235 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
236 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
239 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
243 //---------------------------------------------------------------------------
244 // Export a C API in a struct. Other modules will be able to load this from
245 // the wxc module and will then have safe access to these functions, even if
246 // in another shared library.
248 class wxPyCallbackHelper
;
252 void (*p_SWIG_MakePtr
)(char*, void*, char*);
253 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
254 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
255 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
256 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
257 PyObject
* (*p_SWIG_newvarlink
)(void);
259 wxPyTState
* (*p_wxPyBeginBlockThreads
)();
260 void (*p_wxPyEndBlockThreads
)(wxPyTState
* state
);
262 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
263 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
265 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
266 int* (*p_int_LIST_helper
)(PyObject
* source
);
267 long* (*p_long_LIST_helper
)(PyObject
* source
);
268 char** (*p_string_LIST_helper
)(PyObject
* source
);
269 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
270 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
271 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
272 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
274 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
275 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
276 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
277 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
278 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
280 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
281 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
282 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
283 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
284 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
286 PyObject
* (*p_wxPyClassExists
)(const char* className
);
287 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
);
288 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
292 #ifdef wxPyUSE_EXPORT
293 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
296 //---------------------------------------------------------------------------
297 // This class holds an instance of a Python Shadow Class object and assists
298 // with looking up and invoking Python callback methods from C++ virtual
299 // method redirections. For all classes which have virtuals which should be
300 // overridable in wxPython, a new subclass is created that contains a
301 // wxPyCallbackHelper.
304 class wxPyCallbackHelper
{
306 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
308 wxPyCallbackHelper() {
315 ~wxPyCallbackHelper() {
316 #ifdef wxPyUSE_EXPORT
317 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
319 wxPyCBH_delete(this);
323 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
324 bool findCallback(const char* name
) const;
325 int callCallback(PyObject
* argTuple
) const;
326 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
331 PyObject
* m_lastFound
;
334 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
338 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
339 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
340 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
341 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
342 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
346 //----------------------------------------------------------------------
348 class wxPyUserData
: public wxObject
{
350 wxPyUserData(PyObject
* obj
) {
356 #ifdef wxPyUSE_EXPORT
357 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
359 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
361 wxPyTState
* state
= wxPyBeginBlockThreads();
363 wxPyEndBlockThreads(state
);
371 class wxPyClientData
: public wxClientData
{
373 wxPyClientData(PyObject
* obj
) {
379 #ifdef wxPyUSE_EXPORT
380 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
382 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
384 wxPyTState
* state
= wxPyBeginBlockThreads();
386 wxPyEndBlockThreads(state
);
394 //---------------------------------------------------------------------------
395 // These macros are used to implement the virtual methods that should
396 // redirect to a Python method if one exists. The names designate the
397 // return type, if any, as well as any parameter types.
398 //---------------------------------------------------------------------------
401 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
402 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
404 private: wxPyCallbackHelper m_myInst
406 //---------------------------------------------------------------------------
408 #define DEC_PYCALLBACK__(CBNAME) \
410 void base_##CBNAME();
413 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
414 void CLASS::CBNAME() { \
416 wxPyTState* state = wxPyBeginBlockThreads(); \
417 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
418 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
419 wxPyEndBlockThreads(state); \
423 void CLASS::base_##CBNAME() { \
427 //---------------------------------------------------------------------------
429 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
430 bool CBNAME(int a, int b); \
431 bool base_##CBNAME(int a, int b);
434 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
435 bool CLASS::CBNAME(int a, int b) { \
436 bool rval=FALSE, found; \
437 wxPyTState* state = wxPyBeginBlockThreads(); \
438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
439 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
440 wxPyEndBlockThreads(state); \
442 rval = PCLASS::CBNAME(a,b); \
445 bool CLASS::base_##CBNAME(int a, int b) { \
446 return PCLASS::CBNAME(a,b); \
449 //---------------------------------------------------------------------------
451 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
452 void CBNAME(int a, int b); \
453 void base_##CBNAME(int a, int b);
456 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
457 void CLASS::CBNAME(int a, int b) { \
459 wxPyTState* state = wxPyBeginBlockThreads(); \
460 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
461 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
462 wxPyEndBlockThreads(state); \
464 PCLASS::CBNAME(a,b); \
466 void CLASS::base_##CBNAME(int a, int b) { \
467 PCLASS::CBNAME(a,b); \
470 //---------------------------------------------------------------------------
472 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
473 bool CBNAME(int a); \
474 bool base_##CBNAME(int a);
477 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
478 bool CLASS::CBNAME(int a) { \
479 bool rval=FALSE, found; \
480 wxPyTState* state = wxPyBeginBlockThreads(); \
481 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
482 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
483 wxPyEndBlockThreads(state); \
485 rval = PCLASS::CBNAME(a); \
488 bool CLASS::base_##CBNAME(int a) { \
489 return PCLASS::CBNAME(a); \
492 //---------------------------------------------------------------------------
494 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
498 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
499 bool CLASS::CBNAME(int a) { \
501 wxPyTState* state = wxPyBeginBlockThreads(); \
502 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
503 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
505 wxPyEndBlockThreads(state); \
510 //---------------------------------------------------------------------------
512 #define DEC_PYCALLBACK__DC(CBNAME) \
513 void CBNAME(wxDC& a); \
514 void base_##CBNAME(wxDC& a);
517 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
518 void CLASS::CBNAME(wxDC& a) { \
520 wxPyTState* state = wxPyBeginBlockThreads(); \
521 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
522 PyObject* obj = wxPyMake_wxObject(&a); \
523 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
526 wxPyEndBlockThreads(state); \
530 void CLASS::base_##CBNAME(wxDC& a) { \
536 //---------------------------------------------------------------------------
538 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
539 void CBNAME(wxDC& a, bool b); \
540 void base_##CBNAME(wxDC& a, bool b);
543 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
544 void CLASS::CBNAME(wxDC& a, bool b) { \
546 wxPyTState* state = wxPyBeginBlockThreads(); \
547 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
548 PyObject* obj = wxPyMake_wxObject(&a); \
549 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
552 wxPyEndBlockThreads(state); \
554 PCLASS::CBNAME(a, b); \
556 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
557 PCLASS::CBNAME(a, b); \
560 //---------------------------------------------------------------------------
562 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
563 void CBNAME(wxDC& a, bool b); \
564 void base_##CBNAME(wxDC& a, bool b);
567 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
568 void CLASS::CBNAME(wxDC& a, bool b) { \
570 wxPyTState* state = wxPyBeginBlockThreads(); \
571 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
572 PyObject* obj = wxPyMake_wxObject(&a); \
573 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
576 wxPyEndBlockThreads(state); \
578 PCLASS::CBNAME(a, b); \
580 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
581 PCLASS::CBNAME(a, b); \
584 //---------------------------------------------------------------------------
586 #define DEC_PYCALLBACK__2DBL(CBNAME) \
587 void CBNAME(double a, double b); \
588 void base_##CBNAME(double a, double b);
591 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
592 void CLASS::CBNAME(double a, double b) { \
594 wxPyTState* state = wxPyBeginBlockThreads(); \
595 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
596 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
597 wxPyEndBlockThreads(state); \
599 PCLASS::CBNAME(a, b); \
601 void CLASS::base_##CBNAME(double a, double b) { \
602 PCLASS::CBNAME(a, b); \
605 //---------------------------------------------------------------------------
607 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
608 void CBNAME(double a, double b, int c, int d); \
609 void base_##CBNAME(double a, double b, int c, int d);
612 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
613 void CLASS::CBNAME(double a, double b, int c, int d) { \
615 wxPyTState* state = wxPyBeginBlockThreads(); \
616 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
617 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
619 wxPyEndBlockThreads(state); \
621 PCLASS::CBNAME(a, b, c, d); \
623 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
624 PCLASS::CBNAME(a, b, c, d); \
627 //---------------------------------------------------------------------------
629 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
630 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
631 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
634 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
635 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
637 wxPyTState* state = wxPyBeginBlockThreads(); \
638 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
639 PyObject* obj = wxPyMake_wxObject(&a); \
640 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
643 wxPyEndBlockThreads(state); \
645 PCLASS::CBNAME(a, b, c, d, e, f); \
647 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
648 PCLASS::CBNAME(a, b, c, d, e, f); \
651 //---------------------------------------------------------------------------
653 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
654 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
655 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
658 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
659 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
661 wxPyTState* state = wxPyBeginBlockThreads(); \
663 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
664 PyObject* obj = wxPyMake_wxObject(&a); \
665 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
668 wxPyEndBlockThreads(state); \
670 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
673 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
674 return PCLASS::CBNAME(a, b, c, d, e, f); \
677 //---------------------------------------------------------------------------
679 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
680 void CBNAME(bool a, double b, double c, int d, int e); \
681 void base_##CBNAME(bool a, double b, double c, int d, int e);
684 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
685 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
687 wxPyTState* state = wxPyBeginBlockThreads(); \
688 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
689 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
691 wxPyEndBlockThreads(state); \
693 PCLASS::CBNAME(a, b, c, d, e); \
695 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
696 PCLASS::CBNAME(a, b, c, d, e); \
699 //---------------------------------------------------------------------------
701 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
702 void CBNAME(wxDC& a, double b, double c, double d, double e); \
703 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
706 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
707 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
709 wxPyTState* state = wxPyBeginBlockThreads(); \
710 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
711 PyObject* obj = wxPyMake_wxObject(&a); \
712 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
715 wxPyEndBlockThreads(state); \
717 PCLASS::CBNAME(a, b, c, d, e); \
719 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
720 PCLASS::CBNAME(a, b, c, d, e); \
723 //---------------------------------------------------------------------------
725 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
726 void CBNAME(wxDC& a, bool b); \
727 void base_##CBNAME(wxDC& a, bool b);
730 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
731 void CLASS::CBNAME(wxDC& a, bool b) { \
733 wxPyTState* state = wxPyBeginBlockThreads(); \
734 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
735 PyObject* obj = wxPyMake_wxObject(&a); \
736 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
739 wxPyEndBlockThreads(state); \
741 PCLASS::CBNAME(a, b); \
743 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
744 PCLASS::CBNAME(a, b); \
747 //---------------------------------------------------------------------------
749 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
750 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
751 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
754 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
755 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
758 wxPyTState* state = wxPyBeginBlockThreads(); \
759 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
760 PyObject* obj = wxPyMake_wxObject(a); \
761 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
764 wxPyEndBlockThreads(state); \
766 PCLASS::CBNAME(a, b, c, d, e, f); \
768 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
770 PCLASS::CBNAME(a, b, c, d, e, f); \
773 //---------------------------------------------------------------------------
775 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
776 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
777 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
780 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
781 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
783 wxPyTState* state = wxPyBeginBlockThreads(); \
784 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
785 PyObject* obj = wxPyMake_wxObject(a); \
786 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
789 wxPyEndBlockThreads(state); \
791 PCLASS::CBNAME(a, b, c, d, e); \
793 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
795 PCLASS::CBNAME(a, b, c, d, e); \
798 //---------------------------------------------------------------------------
800 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
801 void CBNAME(double a, double b, int c); \
802 void base_##CBNAME(double a, double b, int c);
805 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
806 void CLASS::CBNAME(double a, double b, int c) { \
808 wxPyTState* state = wxPyBeginBlockThreads(); \
809 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
810 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
811 wxPyEndBlockThreads(state); \
813 PCLASS::CBNAME(a, b, c); \
815 void CLASS::base_##CBNAME(double a, double b, int c) { \
816 PCLASS::CBNAME(a, b, c); \
819 //---------------------------------------------------------------------------
821 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
822 void CBNAME(bool a, double b, double c, int d); \
823 void base_##CBNAME(bool a, double b, double c, int d);
826 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
827 void CLASS::CBNAME(bool a, double b, double c, int d) { \
829 wxPyTState* state = wxPyBeginBlockThreads(); \
830 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
831 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
832 wxPyEndBlockThreads(state); \
834 PCLASS::CBNAME(a, b, c, d); \
836 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
837 PCLASS::CBNAME(a, b, c, d); \
840 //---------------------------------------------------------------------------
841 //---------------------------------------------------------------------------
843 #define DEC_PYCALLBACK__STRING(CBNAME) \
844 void CBNAME(const wxString& a); \
845 void base_##CBNAME(const wxString& a);
848 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
849 void CLASS::CBNAME(const wxString& a) { \
851 wxPyTState* state = wxPyBeginBlockThreads(); \
852 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
853 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
854 wxPyEndBlockThreads(state); \
858 void CLASS::base_##CBNAME(const wxString& a) { \
862 //---------------------------------------------------------------------------
864 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
865 bool CBNAME(const wxString& a); \
866 bool base_##CBNAME(const wxString& a);
869 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
870 bool CLASS::CBNAME(const wxString& a) { \
873 wxPyTState* state = wxPyBeginBlockThreads(); \
874 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
875 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
876 wxPyEndBlockThreads(state); \
878 rval = PCLASS::CBNAME(a); \
881 bool CLASS::base_##CBNAME(const wxString& a) { \
882 return PCLASS::CBNAME(a); \
885 //---------------------------------------------------------------------------
887 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
888 bool CBNAME(const wxString& a);
890 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
891 bool CLASS::CBNAME(const wxString& a) { \
893 wxPyTState* state = wxPyBeginBlockThreads(); \
894 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
895 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
896 wxPyEndBlockThreads(state); \
900 //---------------------------------------------------------------------------
902 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
903 wxString CBNAME(const wxString& a); \
905 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
906 wxString CLASS::CBNAME(const wxString& a) { \
908 wxPyTState* state = wxPyBeginBlockThreads(); \
909 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
911 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
913 PyObject* str = PyObject_Str(ro); \
914 rval = PyString_AsString(str); \
915 Py_DECREF(ro); Py_DECREF(str); \
918 wxPyEndBlockThreads(state); \
922 //---------------------------------------------------------------------------
924 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
925 wxString CBNAME(const wxString& a,int b); \
927 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
928 wxString CLASS::CBNAME(const wxString& a,int b) { \
930 wxPyTState* state = wxPyBeginBlockThreads(); \
931 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
933 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
935 PyObject* str = PyObject_Str(ro); \
936 rval = PyString_AsString(str); \
937 Py_DECREF(ro); Py_DECREF(str); \
940 wxPyEndBlockThreads(state); \
944 //---------------------------------------------------------------------------
946 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
947 bool CBNAME(const wxString& a, const wxString& b); \
948 bool base_##CBNAME(const wxString& a, const wxString& b);
951 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
952 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
955 wxPyTState* state = wxPyBeginBlockThreads(); \
956 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
957 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
958 a.c_str(), b.c_str())); \
959 wxPyEndBlockThreads(state); \
961 rval = PCLASS::CBNAME(a, b); \
964 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
965 return PCLASS::CBNAME(a, b); \
968 //---------------------------------------------------------------------------
970 #define DEC_PYCALLBACK_STRING_(CBNAME) \
972 wxString base_##CBNAME();
975 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
976 wxString CLASS::CBNAME() { \
979 wxPyTState* state = wxPyBeginBlockThreads(); \
980 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
982 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
984 PyObject* str = PyObject_Str(ro); \
985 rval = PyString_AsString(str); \
986 Py_DECREF(ro); Py_DECREF(str); \
989 wxPyEndBlockThreads(state); \
991 rval = PCLASS::CBNAME(); \
994 wxString CLASS::base_##CBNAME() { \
995 return PCLASS::CBNAME(); \
998 //---------------------------------------------------------------------------
1000 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1004 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1005 wxString CLASS::CBNAME() { \
1007 wxPyTState* state = wxPyBeginBlockThreads(); \
1008 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1010 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1012 PyObject* str = PyObject_Str(ro); \
1013 rval = PyString_AsString(str); \
1014 Py_DECREF(ro); Py_DECREF(str); \
1017 wxPyEndBlockThreads(state); \
1021 //---------------------------------------------------------------------------
1023 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1024 bool CBNAME(const wxHtmlTag& a); \
1027 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1028 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1030 wxPyTState* state = wxPyBeginBlockThreads(); \
1031 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1032 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1033 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1036 wxPyEndBlockThreads(state); \
1040 //---------------------------------------------------------------------------
1042 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1043 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1044 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1046 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1047 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1050 wxPyTState* state = wxPyBeginBlockThreads(); \
1051 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1052 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1053 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1056 wxPyEndBlockThreads(state); \
1058 PCLASS::CBNAME(cell, x, y); \
1060 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1061 PCLASS::CBNAME(cell, x, y); \
1065 //---------------------------------------------------------------------------
1067 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1068 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1069 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1071 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1072 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1074 wxPyTState* state = wxPyBeginBlockThreads(); \
1075 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1076 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1077 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1078 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1082 wxPyEndBlockThreads(state); \
1084 PCLASS::CBNAME(cell, x, y, e); \
1086 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1087 PCLASS::CBNAME(cell, x, y, e); \
1092 //---------------------------------------------------------------------------
1094 #define DEC_PYCALLBACK___pure(CBNAME) \
1098 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1099 void CLASS::CBNAME() { \
1100 wxPyTState* state = wxPyBeginBlockThreads(); \
1101 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1102 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1103 wxPyEndBlockThreads(state); \
1106 //---------------------------------------------------------------------------
1108 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1112 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1113 wxSize CLASS::CBNAME() { \
1115 wxPyTState* state = wxPyBeginBlockThreads(); \
1116 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1119 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1121 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1126 wxPyEndBlockThreads(state); \
1130 //---------------------------------------------------------------------------
1132 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1133 bool CBNAME(wxWindow* a); \
1134 bool base_##CBNAME(wxWindow* a);
1137 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1138 bool CLASS::CBNAME(wxWindow* a) { \
1141 wxPyTState* state = wxPyBeginBlockThreads(); \
1142 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1143 PyObject* obj = wxPyMake_wxObject(a); \
1144 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1147 wxPyEndBlockThreads(state); \
1149 rval = PCLASS::CBNAME(a); \
1152 bool CLASS::base_##CBNAME(wxWindow* a) { \
1153 return PCLASS::CBNAME(a); \
1156 //---------------------------------------------------------------------------
1158 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1160 bool base_##CBNAME();
1163 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1164 bool CLASS::CBNAME() { \
1167 wxPyTState* state = wxPyBeginBlockThreads(); \
1168 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1169 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1170 wxPyEndBlockThreads(state); \
1172 rval = PCLASS::CBNAME(); \
1175 bool CLASS::base_##CBNAME() { \
1176 return PCLASS::CBNAME(); \
1179 //---------------------------------------------------------------------------
1181 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1182 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1183 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1186 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1187 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1190 wxPyTState* state = wxPyBeginBlockThreads(); \
1191 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1192 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1193 wxPyEndBlockThreads(state); \
1195 rval = PCLASS::CBNAME(a, b, c); \
1196 return (wxDragResult)rval; \
1198 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1199 return PCLASS::CBNAME(a, b, c); \
1202 //---------------------------------------------------------------------------
1204 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1205 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1207 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1208 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1209 wxPyTState* state = wxPyBeginBlockThreads(); \
1211 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1213 PyObject* obj = wxPyMake_wxObject(&a); \
1214 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1217 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1222 wxPyEndBlockThreads(state); \
1226 //---------------------------------------------------------------------------
1228 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1229 bool CBNAME(wxDragResult a); \
1230 bool base_##CBNAME(wxDragResult a);
1233 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1234 bool CLASS::CBNAME(wxDragResult a) { \
1237 wxPyTState* state = wxPyBeginBlockThreads(); \
1238 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1239 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1240 wxPyEndBlockThreads(state); \
1242 rval = PCLASS::CBNAME(a); \
1245 bool CLASS::base_##CBNAME(wxDragResult a) { \
1246 return PCLASS::CBNAME(a); \
1249 //---------------------------------------------------------------------------
1251 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1252 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1255 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1256 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1257 wxPyTState* state = wxPyBeginBlockThreads(); \
1259 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1260 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1261 wxPyEndBlockThreads(state); \
1262 return (wxDragResult)rval; \
1265 //---------------------------------------------------------------------------
1267 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1268 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 wxPyTState* state = wxPyBeginBlockThreads(); \
1275 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1276 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1277 wxPyEndBlockThreads(state); \
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 wxPyTState* state = wxPyBeginBlockThreads(); \
1293 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1294 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1295 wxPyEndBlockThreads(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 wxPyTState* state = 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(state); \
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 ;
1417 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1418 wxString CLASS::CBNAME(long a, long b) const { \
1421 wxPyTState* state = wxPyBeginBlockThreads(); \
1422 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1424 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1426 PyObject* str = PyObject_Str(ro); \
1427 rval = PyString_AsString(str); \
1428 Py_DECREF(ro); Py_DECREF(str); \
1431 wxPyEndBlockThreads(state); \
1433 rval = PCLASS::CBNAME(a,b); \
1436 wxString CLASS::base_##CBNAME(long a, long b) const { \
1437 return PCLASS::CBNAME(a,b); \
1440 //---------------------------------------------------------------------------
1442 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1443 int CBNAME(long a) const; \
1444 int base_##CBNAME(long a)const ;
1447 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1448 int CLASS::CBNAME(long a) const { \
1451 wxPyTState* state = wxPyBeginBlockThreads(); \
1452 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1454 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1456 rval = PyInt_AsLong(ro); \
1460 wxPyEndBlockThreads(state); \
1462 rval = PCLASS::CBNAME(a); \
1465 int CLASS::base_##CBNAME(long a) const { \
1466 return PCLASS::CBNAME(a); \
1470 //---------------------------------------------------------------------------
1472 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1473 wxListItemAttr* CBNAME(long a) const; \
1474 wxListItemAttr* base_##CBNAME(long a);
1477 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1478 wxListItemAttr *CLASS::CBNAME(long a) const { \
1479 wxListItemAttr *rval = NULL; \
1481 wxPyTState* state = wxPyBeginBlockThreads(); \
1482 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1484 wxListItemAttr* ptr; \
1485 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1487 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1492 wxPyEndBlockThreads(state); \
1494 rval = PCLASS::CBNAME(a); \
1497 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1498 return PCLASS::CBNAME(a); \
1501 //---------------------------------------------------------------------------
1503 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1504 bool CBNAME(wxMouseEvent& e); \
1505 bool base_##CBNAME(wxMouseEvent& e);
1507 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1508 bool CLASS::CBNAME(wxMouseEvent& e) { \
1511 wxPyTState* state = wxPyBeginBlockThreads(); \
1512 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1514 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1515 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1517 rval = PyInt_AsLong(ro); \
1522 wxPyEndBlockThreads(state); \
1524 return PCLASS::CBNAME(e); \
1527 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1528 return PCLASS::CBNAME(e); \
1532 //---------------------------------------------------------------------------