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 char* className
,
49 PyObject
* wxPyConstructObject(void* ptr
,
50 const char* className
,
53 PyObject
* wxPyClassExists(const char* className
);
54 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=TRUE
);
55 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
56 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
58 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
59 long wxPyGetWinHandle(wxWindow
* win
);
61 //----------------------------------------------------------------------
63 // if we want to handle threads and Python threads are available...
64 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
65 #define WXP_WITH_THREAD
66 #else // no Python threads...
67 #undef WXP_WITH_THREAD
72 PyThreadState
* wxPyBeginAllowThreads();
73 void wxPyEndAllowThreads(PyThreadState
* state
);
76 void wxPyBeginBlockThreads();
77 void wxPyEndBlockThreads();
79 //----------------------------------------------------------------------
80 // Handle wxInputStreams by Joerg Baumann
81 // See stream.i for implementations
83 // list class for return list of strings, e.g. readlines()
84 WX_DECLARE_LIST(wxString
, wxStringPtrList
);
87 // C++ class wxPyInputStream to act as base for python class wxInputStream
88 // Use it in python like a python file object
89 class wxPyInputStream
{
91 // underlying wxInputStream
95 wxPyInputStream(wxInputStream
* wxi_
) : wxi(wxi_
) {}
98 // python file object interface for input files (most of it)
102 wxString
* read(int size
=-1);
103 wxString
* readline(int size
=-1);
104 wxStringPtrList
* readlines(int sizehint
=-1);
105 void seek(int offset
, int whence
=0);
110 void truncate(int size=-1);
111 void write(wxString data);
112 void writelines(wxStringPtrList);
117 //----------------------------------------------------------------------
118 // These are helpers used by the typemaps
120 byte
* byte_LIST_helper(PyObject
* source
);
121 int* int_LIST_helper(PyObject
* source
);
122 long* long_LIST_helper(PyObject
* source
);
123 char** string_LIST_helper(PyObject
* source
);
124 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
125 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
126 wxString
* wxString_LIST_helper(PyObject
* source
);
127 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
128 wxPen
** wxPen_LIST_helper(PyObject
* source
);
130 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
131 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
132 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
133 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
134 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
136 #if PYTHON_API_VERSION < 1009
137 #define PySequence_Fast_GET_ITEM(o, i) \
138 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
141 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
142 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
145 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
146 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
149 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
151 //----------------------------------------------------------------------
154 extern "C" void SWIG_MakePtr(char *, void *, char *);
155 extern "C" char *SWIG_GetPtr(char *, void **, char *);
156 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
161 # pragma warning(disable:4800)
162 # pragma warning(disable:4190)
165 //----------------------------------------------------------------------
167 class wxPyCallback
: public wxObject
{
168 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
170 wxPyCallback(PyObject
* func
);
171 wxPyCallback(const wxPyCallback
& other
);
174 void EventThunker(wxEvent
& event
);
179 //---------------------------------------------------------------------------
181 class wxPyTimer
: public wxTimer
{
183 wxPyTimer(PyObject
* callback
);
192 //---------------------------------------------------------------------------
193 //---------------------------------------------------------------------------
194 // These Event classes can be derived from in Python and passed through the
195 // event system without loosing anything. They do this by keeping a reference
196 // to themselves and some special case handling in wxPyCallback::EventThunker.
199 class wxPyEvtSelfRef
{
204 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
205 PyObject
* GetSelf() const;
213 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
214 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
217 wxPyEvent(const wxPyEvent
& evt
);
220 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
224 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
225 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
227 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
228 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
231 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
235 //---------------------------------------------------------------------------
236 // Export a C API in a struct. Other modules will be able to load this from
237 // the wxc module and will then have safe access to these functions, even if
238 // in another shared library.
240 class wxPyCallbackHelper
;
244 void (*p_SWIG_MakePtr
)(char*, void*, char*);
245 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
246 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
247 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
248 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
249 PyObject
* (*p_SWIG_newvarlink
)(void);
251 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
252 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
253 void (*p_wxPyBeginBlockThreads
)();
254 void (*p_wxPyEndBlockThreads
)();
256 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
257 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
259 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
260 int* (*p_int_LIST_helper
)(PyObject
* source
);
261 long* (*p_long_LIST_helper
)(PyObject
* source
);
262 char** (*p_string_LIST_helper
)(PyObject
* source
);
263 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
264 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
265 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
266 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
268 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
269 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
270 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
271 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
272 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
274 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
275 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
276 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
277 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
278 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
280 PyObject
* (*p_wxPyClassExists
)(const char* className
);
281 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
282 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
283 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
284 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
285 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
288 #ifdef wxPyUSE_EXPORT
289 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
292 //---------------------------------------------------------------------------
293 // This class holds an instance of a Python Shadow Class object and assists
294 // with looking up and invoking Python callback methods from C++ virtual
295 // method redirections. For all classes which have virtuals which should be
296 // overridable in wxPython, a new subclass is created that contains a
297 // wxPyCallbackHelper.
300 class wxPyCallbackHelper
{
302 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
304 wxPyCallbackHelper() {
311 ~wxPyCallbackHelper() {
312 #ifdef wxPyUSE_EXPORT
313 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
315 wxPyCBH_delete(this);
319 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
320 bool findCallback(const char* name
) const;
321 int callCallback(PyObject
* argTuple
) const;
322 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
327 PyObject
* m_lastFound
;
330 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
334 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
335 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
336 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
337 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
338 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
342 //----------------------------------------------------------------------
344 class wxPyUserData
: public wxObject
{
346 wxPyUserData(PyObject
* obj
) {
352 #ifdef wxPyUSE_EXPORT
353 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
355 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
357 wxPyBeginBlockThreads();
359 wxPyEndBlockThreads();
367 class wxPyClientData
: public wxClientData
{
369 wxPyClientData(PyObject
* obj
) {
375 #ifdef wxPyUSE_EXPORT
376 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
378 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
380 wxPyBeginBlockThreads();
382 wxPyEndBlockThreads();
390 //---------------------------------------------------------------------------
391 // These macros are used to implement the virtual methods that should
392 // redirect to a Python method if one exists. The names designate the
393 // return type, if any, as well as any parameter types.
394 //---------------------------------------------------------------------------
397 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
398 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
400 private: wxPyCallbackHelper m_myInst
402 //---------------------------------------------------------------------------
404 #define DEC_PYCALLBACK__(CBNAME) \
406 void base_##CBNAME();
409 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
410 void CLASS::CBNAME() { \
412 wxPyBeginBlockThreads(); \
413 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
414 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
415 wxPyEndBlockThreads(); \
419 void CLASS::base_##CBNAME() { \
423 //---------------------------------------------------------------------------
425 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
426 bool CBNAME(int a, int b); \
427 bool base_##CBNAME(int a, int b);
430 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
431 bool CLASS::CBNAME(int a, int b) { \
432 bool rval=FALSE, found; \
433 wxPyBeginBlockThreads(); \
434 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
435 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
436 wxPyEndBlockThreads(); \
438 rval = PCLASS::CBNAME(a,b); \
441 bool CLASS::base_##CBNAME(int a, int b) { \
442 return PCLASS::CBNAME(a,b); \
445 //---------------------------------------------------------------------------
447 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
448 void CBNAME(int a, int b); \
449 void base_##CBNAME(int a, int b);
452 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
453 void CLASS::CBNAME(int a, int b) { \
455 wxPyBeginBlockThreads(); \
456 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
457 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
458 wxPyEndBlockThreads(); \
460 PCLASS::CBNAME(a,b); \
462 void CLASS::base_##CBNAME(int a, int b) { \
463 PCLASS::CBNAME(a,b); \
466 //---------------------------------------------------------------------------
468 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
469 bool CBNAME(int a); \
470 bool base_##CBNAME(int a);
473 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
474 bool CLASS::CBNAME(int a) { \
475 bool rval=FALSE, found; \
476 wxPyBeginBlockThreads(); \
477 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
478 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
479 wxPyEndBlockThreads(); \
481 rval = PCLASS::CBNAME(a); \
484 bool CLASS::base_##CBNAME(int a) { \
485 return PCLASS::CBNAME(a); \
488 //---------------------------------------------------------------------------
490 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
494 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
495 bool CLASS::CBNAME(int a) { \
497 wxPyBeginBlockThreads(); \
498 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
499 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
501 wxPyEndBlockThreads(); \
506 //---------------------------------------------------------------------------
508 #define DEC_PYCALLBACK__DC(CBNAME) \
509 void CBNAME(wxDC& a); \
510 void base_##CBNAME(wxDC& a);
513 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
514 void CLASS::CBNAME(wxDC& a) { \
516 wxPyBeginBlockThreads(); \
517 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
518 PyObject* obj = wxPyMake_wxObject(&a); \
519 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
522 wxPyEndBlockThreads(); \
526 void CLASS::base_##CBNAME(wxDC& a) { \
532 //---------------------------------------------------------------------------
534 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
535 void CBNAME(wxDC& a, bool b); \
536 void base_##CBNAME(wxDC& a, bool b);
539 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
540 void CLASS::CBNAME(wxDC& a, bool b) { \
542 wxPyBeginBlockThreads(); \
543 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
544 PyObject* obj = wxPyMake_wxObject(&a); \
545 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
548 wxPyEndBlockThreads(); \
550 PCLASS::CBNAME(a, b); \
552 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
553 PCLASS::CBNAME(a, b); \
556 //---------------------------------------------------------------------------
558 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
559 void CBNAME(wxDC& a, bool b); \
560 void base_##CBNAME(wxDC& a, bool b);
563 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
564 void CLASS::CBNAME(wxDC& a, bool b) { \
566 wxPyBeginBlockThreads(); \
567 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
568 PyObject* obj = wxPyMake_wxObject(&a); \
569 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
572 wxPyEndBlockThreads(); \
574 PCLASS::CBNAME(a, b); \
576 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
577 PCLASS::CBNAME(a, b); \
580 //---------------------------------------------------------------------------
582 #define DEC_PYCALLBACK__2DBL(CBNAME) \
583 void CBNAME(double a, double b); \
584 void base_##CBNAME(double a, double b);
587 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
588 void CLASS::CBNAME(double a, double b) { \
590 wxPyBeginBlockThreads(); \
591 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
592 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
593 wxPyEndBlockThreads(); \
595 PCLASS::CBNAME(a, b); \
597 void CLASS::base_##CBNAME(double a, double b) { \
598 PCLASS::CBNAME(a, b); \
601 //---------------------------------------------------------------------------
603 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
604 void CBNAME(double a, double b, int c, int d); \
605 void base_##CBNAME(double a, double b, int c, int d);
608 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
609 void CLASS::CBNAME(double a, double b, int c, int d) { \
611 wxPyBeginBlockThreads(); \
612 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
613 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
615 wxPyEndBlockThreads(); \
617 PCLASS::CBNAME(a, b, c, d); \
619 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
620 PCLASS::CBNAME(a, b, c, d); \
623 //---------------------------------------------------------------------------
625 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
626 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
627 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
630 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
631 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
633 wxPyBeginBlockThreads(); \
634 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
635 PyObject* obj = wxPyMake_wxObject(&a); \
636 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
639 wxPyEndBlockThreads(); \
641 PCLASS::CBNAME(a, b, c, d, e, f); \
643 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
644 PCLASS::CBNAME(a, b, c, d, e, f); \
647 //---------------------------------------------------------------------------
649 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
650 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
651 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
654 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
655 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
657 wxPyBeginBlockThreads(); \
659 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
660 PyObject* obj = wxPyMake_wxObject(&a); \
661 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
664 wxPyEndBlockThreads(); \
666 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
669 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
670 return PCLASS::CBNAME(a, b, c, d, e, f); \
673 //---------------------------------------------------------------------------
675 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
676 void CBNAME(bool a, double b, double c, int d, int e); \
677 void base_##CBNAME(bool a, double b, double c, int d, int e);
680 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
681 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
683 wxPyBeginBlockThreads(); \
684 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
685 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
687 wxPyEndBlockThreads(); \
689 PCLASS::CBNAME(a, b, c, d, e); \
691 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
692 PCLASS::CBNAME(a, b, c, d, e); \
695 //---------------------------------------------------------------------------
697 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
698 void CBNAME(wxDC& a, double b, double c, double d, double e); \
699 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
702 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
703 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
705 wxPyBeginBlockThreads(); \
706 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
707 PyObject* obj = wxPyMake_wxObject(&a); \
708 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
711 wxPyEndBlockThreads(); \
713 PCLASS::CBNAME(a, b, c, d, e); \
715 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
716 PCLASS::CBNAME(a, b, c, d, e); \
719 //---------------------------------------------------------------------------
721 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
722 void CBNAME(wxDC& a, bool b); \
723 void base_##CBNAME(wxDC& a, bool b);
726 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
727 void CLASS::CBNAME(wxDC& a, bool b) { \
729 wxPyBeginBlockThreads(); \
730 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
731 PyObject* obj = wxPyMake_wxObject(&a); \
732 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
735 wxPyEndBlockThreads(); \
737 PCLASS::CBNAME(a, b); \
739 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
740 PCLASS::CBNAME(a, b); \
743 //---------------------------------------------------------------------------
745 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
746 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
747 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
750 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
751 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
754 wxPyBeginBlockThreads(); \
755 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
756 PyObject* obj = wxPyMake_wxObject(a); \
757 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
760 wxPyEndBlockThreads(); \
762 PCLASS::CBNAME(a, b, c, d, e, f); \
764 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
766 PCLASS::CBNAME(a, b, c, d, e, f); \
769 //---------------------------------------------------------------------------
771 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
772 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
773 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
776 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
777 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
779 wxPyBeginBlockThreads(); \
780 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
781 PyObject* obj = wxPyMake_wxObject(a); \
782 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
785 wxPyEndBlockThreads(); \
787 PCLASS::CBNAME(a, b, c, d, e); \
789 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
791 PCLASS::CBNAME(a, b, c, d, e); \
794 //---------------------------------------------------------------------------
796 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
797 void CBNAME(double a, double b, int c); \
798 void base_##CBNAME(double a, double b, int c);
801 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
802 void CLASS::CBNAME(double a, double b, int c) { \
804 wxPyBeginBlockThreads(); \
805 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
806 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
807 wxPyEndBlockThreads(); \
809 PCLASS::CBNAME(a, b, c); \
811 void CLASS::base_##CBNAME(double a, double b, int c) { \
812 PCLASS::CBNAME(a, b, c); \
815 //---------------------------------------------------------------------------
817 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
818 void CBNAME(bool a, double b, double c, int d); \
819 void base_##CBNAME(bool a, double b, double c, int d);
822 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
823 void CLASS::CBNAME(bool a, double b, double c, int d) { \
825 wxPyBeginBlockThreads(); \
826 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
827 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
828 wxPyEndBlockThreads(); \
830 PCLASS::CBNAME(a, b, c, d); \
832 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
833 PCLASS::CBNAME(a, b, c, d); \
836 //---------------------------------------------------------------------------
837 //---------------------------------------------------------------------------
839 #define DEC_PYCALLBACK__STRING(CBNAME) \
840 void CBNAME(const wxString& a); \
841 void base_##CBNAME(const wxString& a);
844 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
845 void CLASS::CBNAME(const wxString& a) { \
847 wxPyBeginBlockThreads(); \
848 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
849 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
850 wxPyEndBlockThreads(); \
854 void CLASS::base_##CBNAME(const wxString& a) { \
858 //---------------------------------------------------------------------------
860 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
861 bool CBNAME(const wxString& a); \
862 bool base_##CBNAME(const wxString& a);
865 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
866 bool CLASS::CBNAME(const wxString& a) { \
869 wxPyBeginBlockThreads(); \
870 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
871 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
872 wxPyEndBlockThreads(); \
874 rval = PCLASS::CBNAME(a); \
877 bool CLASS::base_##CBNAME(const wxString& a) { \
878 return PCLASS::CBNAME(a); \
881 //---------------------------------------------------------------------------
883 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
884 bool CBNAME(const wxString& a);
886 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
887 bool CLASS::CBNAME(const wxString& a) { \
889 wxPyBeginBlockThreads(); \
890 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
891 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
892 wxPyEndBlockThreads(); \
896 //---------------------------------------------------------------------------
898 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
899 wxString CBNAME(const wxString& a); \
901 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
902 wxString CLASS::CBNAME(const wxString& a) { \
904 wxPyBeginBlockThreads(); \
905 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
907 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
909 PyObject* str = PyObject_Str(ro); \
910 rval = PyString_AsString(str); \
911 Py_DECREF(ro); Py_DECREF(str); \
914 wxPyEndBlockThreads(); \
918 //---------------------------------------------------------------------------
920 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
921 wxString CBNAME(const wxString& a,int b); \
923 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
924 wxString CLASS::CBNAME(const wxString& a,int b) { \
926 wxPyBeginBlockThreads(); \
927 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
929 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
931 PyObject* str = PyObject_Str(ro); \
932 rval = PyString_AsString(str); \
933 Py_DECREF(ro); Py_DECREF(str); \
936 wxPyEndBlockThreads(); \
940 //---------------------------------------------------------------------------
942 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
943 bool CBNAME(const wxString& a, const wxString& b); \
944 bool base_##CBNAME(const wxString& a, const wxString& b);
947 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
948 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
951 wxPyBeginBlockThreads(); \
952 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
953 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
954 a.c_str(), b.c_str())); \
955 wxPyEndBlockThreads(); \
957 rval = PCLASS::CBNAME(a, b); \
960 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
961 return PCLASS::CBNAME(a, b); \
964 //---------------------------------------------------------------------------
966 #define DEC_PYCALLBACK_STRING_(CBNAME) \
968 wxString base_##CBNAME();
971 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
972 wxString CLASS::CBNAME() { \
975 wxPyBeginBlockThreads(); \
976 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
978 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
980 PyObject* str = PyObject_Str(ro); \
981 rval = PyString_AsString(str); \
982 Py_DECREF(ro); Py_DECREF(str); \
985 wxPyEndBlockThreads(); \
987 rval = PCLASS::CBNAME(); \
990 wxString CLASS::base_##CBNAME() { \
991 return PCLASS::CBNAME(); \
994 //---------------------------------------------------------------------------
996 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1000 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1001 wxString CLASS::CBNAME() { \
1003 wxPyBeginBlockThreads(); \
1004 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1006 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1008 PyObject* str = PyObject_Str(ro); \
1009 rval = PyString_AsString(str); \
1010 Py_DECREF(ro); Py_DECREF(str); \
1013 wxPyEndBlockThreads(); \
1017 //---------------------------------------------------------------------------
1019 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1020 bool CBNAME(const wxHtmlTag& a); \
1023 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1024 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1026 wxPyBeginBlockThreads(); \
1027 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1028 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1029 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1032 wxPyEndBlockThreads(); \
1036 //---------------------------------------------------------------------------
1038 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1039 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1040 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1042 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1043 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1046 wxPyBeginBlockThreads(); \
1047 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1048 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1049 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1052 wxPyEndBlockThreads(); \
1054 PCLASS::CBNAME(cell, x, y); \
1056 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1057 PCLASS::CBNAME(cell, x, y); \
1061 //---------------------------------------------------------------------------
1063 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1064 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1065 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1067 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1068 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1070 wxPyBeginBlockThreads(); \
1071 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1072 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1073 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1074 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1078 wxPyEndBlockThreads(); \
1080 PCLASS::CBNAME(cell, x, y, e); \
1082 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1083 PCLASS::CBNAME(cell, x, y, e); \
1088 //---------------------------------------------------------------------------
1090 #define DEC_PYCALLBACK___pure(CBNAME) \
1094 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1095 void CLASS::CBNAME() { \
1096 wxPyBeginBlockThreads(); \
1097 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1098 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1099 wxPyEndBlockThreads(); \
1102 //---------------------------------------------------------------------------
1104 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1108 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1109 wxSize CLASS::CBNAME() { \
1111 wxPyBeginBlockThreads(); \
1112 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1115 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1117 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1122 wxPyEndBlockThreads(); \
1126 //---------------------------------------------------------------------------
1128 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1129 bool CBNAME(wxWindow* a); \
1130 bool base_##CBNAME(wxWindow* a);
1133 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1134 bool CLASS::CBNAME(wxWindow* a) { \
1137 wxPyBeginBlockThreads(); \
1138 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1139 PyObject* obj = wxPyMake_wxObject(a); \
1140 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1143 wxPyEndBlockThreads(); \
1145 rval = PCLASS::CBNAME(a); \
1148 bool CLASS::base_##CBNAME(wxWindow* a) { \
1149 return PCLASS::CBNAME(a); \
1152 //---------------------------------------------------------------------------
1154 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1156 bool base_##CBNAME();
1159 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1160 bool CLASS::CBNAME() { \
1163 wxPyBeginBlockThreads(); \
1164 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1165 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1166 wxPyEndBlockThreads(); \
1168 rval = PCLASS::CBNAME(); \
1171 bool CLASS::base_##CBNAME() { \
1172 return PCLASS::CBNAME(); \
1175 //---------------------------------------------------------------------------
1177 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1178 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1179 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1182 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1183 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1186 wxPyBeginBlockThreads(); \
1187 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1188 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1189 wxPyEndBlockThreads(); \
1191 rval = PCLASS::CBNAME(a, b, c); \
1192 return (wxDragResult)rval; \
1194 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1195 return PCLASS::CBNAME(a, b, c); \
1198 //---------------------------------------------------------------------------
1200 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1201 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1203 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1204 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1205 wxPyBeginBlockThreads(); \
1207 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1209 PyObject* obj = wxPyMake_wxObject(&a); \
1210 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1213 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1218 wxPyEndBlockThreads(); \
1222 //---------------------------------------------------------------------------
1224 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1225 bool CBNAME(wxDragResult a); \
1226 bool base_##CBNAME(wxDragResult a);
1229 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1230 bool CLASS::CBNAME(wxDragResult a) { \
1233 wxPyBeginBlockThreads(); \
1234 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1235 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1236 wxPyEndBlockThreads(); \
1238 rval = PCLASS::CBNAME(a); \
1241 bool CLASS::base_##CBNAME(wxDragResult a) { \
1242 return PCLASS::CBNAME(a); \
1245 //---------------------------------------------------------------------------
1247 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1248 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1251 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1252 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1253 wxPyBeginBlockThreads(); \
1255 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1256 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1257 wxPyEndBlockThreads(); \
1258 return (wxDragResult)rval; \
1261 //---------------------------------------------------------------------------
1263 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1264 bool CBNAME(int a, int b, const wxString& c);
1267 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1268 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1270 wxPyBeginBlockThreads(); \
1271 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1272 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1273 wxPyEndBlockThreads(); \
1277 //---------------------------------------------------------------------------
1279 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1281 size_t base_##CBNAME();
1284 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1285 size_t CLASS::CBNAME() { \
1288 wxPyBeginBlockThreads(); \
1289 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1290 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1291 wxPyEndBlockThreads(); \
1293 rval = PCLASS::CBNAME(); \
1296 size_t CLASS::base_##CBNAME() { \
1297 return PCLASS::CBNAME(); \
1300 //---------------------------------------------------------------------------
1302 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1303 wxDataFormat CBNAME(size_t a); \
1304 wxDataFormat base_##CBNAME(size_t a);
1307 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1308 wxDataFormat CLASS::CBNAME(size_t a) { \
1309 wxDataFormat rval=0; \
1311 wxPyBeginBlockThreads(); \
1312 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1314 wxDataFormat* ptr; \
1315 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1317 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1322 wxPyEndBlockThreads(); \
1324 rval = PCLASS::CBNAME(a); \
1327 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1328 return PCLASS::CBNAME(a); \
1331 //---------------------------------------------------------------------------
1333 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1334 void CBNAME(const Type& a); \
1335 void base_##CBNAME(const Type& a);
1338 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1339 void CLASS::CBNAME(const Type& a) { \
1341 wxPyBeginBlockThreads(); \
1342 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1343 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1344 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1347 wxPyEndBlockThreads(); \
1349 PCLASS::CBNAME(a); \
1351 void CLASS::base_##CBNAME(const Type& a) { \
1352 PCLASS::CBNAME(a); \
1356 //---------------------------------------------------------------------------
1358 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1359 void CBNAME(Type& a); \
1360 void base_##CBNAME(Type& a);
1363 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1364 void CLASS::CBNAME(Type& a) { \
1366 wxPyBeginBlockThreads(); \
1367 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1368 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1369 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1372 wxPyEndBlockThreads(); \
1374 PCLASS::CBNAME(a); \
1376 void CLASS::base_##CBNAME(Type& a) { \
1377 PCLASS::CBNAME(a); \
1380 //---------------------------------------------------------------------------
1382 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1383 bool CBNAME(Type& a); \
1384 bool base_##CBNAME(Type& a);
1387 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1388 bool CLASS::CBNAME(Type& a) { \
1391 wxPyBeginBlockThreads(); \
1392 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1393 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1394 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1397 wxPyEndBlockThreads(); \
1399 rv = PCLASS::CBNAME(a); \
1402 bool CLASS::base_##CBNAME(Type& a) { \
1403 return PCLASS::CBNAME(a); \
1406 //---------------------------------------------------------------------------
1408 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1409 wxString CBNAME(long a, long b) const; \
1410 wxString base_##CBNAME(long a, long b)const ;
1413 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1414 wxString CLASS::CBNAME(long a, long b) const { \
1417 wxPyBeginBlockThreads(); \
1418 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1420 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1422 PyObject* str = PyObject_Str(ro); \
1423 rval = PyString_AsString(str); \
1424 Py_DECREF(ro); Py_DECREF(str); \
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 //---------------------------------------------------------------------------