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 // Handling of 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 // You can use it in python like a python file object.
89 class wxPyInputStream
{
91 // underlying wxInputStream
92 wxInputStream
* m_wxis
;
95 wxPyInputStream(wxInputStream
* wxis
) : m_wxis(wxis
) {}
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);
111 void truncate(int size=-1);
112 void write(wxString data);
113 void writelines(wxStringPtrList);
119 // This is a wxInputStream that wraps a Python file-like
120 // object and calls the Python methods as needed.
121 class wxPyCBInputStream
: public wxInputStream
{
123 ~wxPyCBInputStream();
124 virtual size_t GetSize() const;
127 static wxPyCBInputStream
* create(PyObject
*py
, bool block
=TRUE
);
130 // can only be created via the factory
131 wxPyCBInputStream(PyObject
*r
, PyObject
*s
, PyObject
*t
, bool block
);
133 // wxStreamBase methods
134 virtual size_t OnSysRead(void *buffer
, size_t bufsize
);
135 virtual size_t OnSysWrite(const void *buffer
, size_t bufsize
);
136 virtual off_t
OnSysSeek(off_t off
, wxSeekMode mode
);
137 virtual off_t
OnSysTell() const;
140 static PyObject
* getMethod(PyObject
* py
, char* name
);
148 //----------------------------------------------------------------------
149 // These are helpers used by the typemaps
151 byte
* byte_LIST_helper(PyObject
* source
);
152 int* int_LIST_helper(PyObject
* source
);
153 long* long_LIST_helper(PyObject
* source
);
154 char** string_LIST_helper(PyObject
* source
);
155 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
156 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
157 wxString
* wxString_LIST_helper(PyObject
* source
);
158 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
159 wxPen
** wxPen_LIST_helper(PyObject
* source
);
161 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
162 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
163 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
164 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
165 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
167 #if PYTHON_API_VERSION < 1009
168 #define PySequence_Fast_GET_ITEM(o, i) \
169 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
172 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
173 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
176 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
177 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
180 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
182 //----------------------------------------------------------------------
185 extern "C" void SWIG_MakePtr(char *, void *, char *);
186 extern "C" char *SWIG_GetPtr(char *, void **, char *);
187 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
192 # pragma warning(disable:4800)
193 # pragma warning(disable:4190)
196 //----------------------------------------------------------------------
198 class wxPyCallback
: public wxObject
{
199 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
201 wxPyCallback(PyObject
* func
);
202 wxPyCallback(const wxPyCallback
& other
);
205 void EventThunker(wxEvent
& event
);
210 //---------------------------------------------------------------------------
212 class wxPyTimer
: public wxTimer
{
214 wxPyTimer(PyObject
* callback
);
223 //---------------------------------------------------------------------------
224 //---------------------------------------------------------------------------
225 // These Event classes can be derived from in Python and passed through the
226 // event system without loosing anything. They do this by keeping a reference
227 // to themselves and some special case handling in wxPyCallback::EventThunker.
230 class wxPyEvtSelfRef
{
235 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
236 PyObject
* GetSelf() const;
244 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
245 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
248 wxPyEvent(const wxPyEvent
& evt
);
251 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
255 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
256 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
258 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
259 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
262 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
266 //---------------------------------------------------------------------------
267 // Export a C API in a struct. Other modules will be able to load this from
268 // the wxc module and will then have safe access to these functions, even if
269 // in another shared library.
271 class wxPyCallbackHelper
;
275 void (*p_SWIG_MakePtr
)(char*, void*, char*);
276 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
277 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
278 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
279 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
280 PyObject
* (*p_SWIG_newvarlink
)(void);
282 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
283 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
284 void (*p_wxPyBeginBlockThreads
)();
285 void (*p_wxPyEndBlockThreads
)();
287 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
288 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
290 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
291 int* (*p_int_LIST_helper
)(PyObject
* source
);
292 long* (*p_long_LIST_helper
)(PyObject
* source
);
293 char** (*p_string_LIST_helper
)(PyObject
* source
);
294 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
295 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
296 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
297 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
299 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
300 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
301 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
302 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
303 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
305 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
306 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
307 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
308 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
309 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
311 PyObject
* (*p_wxPyClassExists
)(const char* className
);
312 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
313 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
314 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
315 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
316 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
319 #ifdef wxPyUSE_EXPORT
320 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
323 //---------------------------------------------------------------------------
324 // This class holds an instance of a Python Shadow Class object and assists
325 // with looking up and invoking Python callback methods from C++ virtual
326 // method redirections. For all classes which have virtuals which should be
327 // overridable in wxPython, a new subclass is created that contains a
328 // wxPyCallbackHelper.
331 class wxPyCallbackHelper
{
333 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
335 wxPyCallbackHelper() {
342 ~wxPyCallbackHelper() {
343 #ifdef wxPyUSE_EXPORT
344 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
346 wxPyCBH_delete(this);
350 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
351 bool findCallback(const char* name
) const;
352 int callCallback(PyObject
* argTuple
) const;
353 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
358 PyObject
* m_lastFound
;
361 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
365 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
366 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
367 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
368 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
369 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
373 //----------------------------------------------------------------------
375 class wxPyUserData
: public wxObject
{
377 wxPyUserData(PyObject
* obj
) {
383 #ifdef wxPyUSE_EXPORT
384 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
386 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
388 wxPyBeginBlockThreads();
390 wxPyEndBlockThreads();
398 class wxPyClientData
: public wxClientData
{
400 wxPyClientData(PyObject
* obj
) {
406 #ifdef wxPyUSE_EXPORT
407 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
409 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
411 wxPyBeginBlockThreads();
413 wxPyEndBlockThreads();
421 //---------------------------------------------------------------------------
422 // These macros are used to implement the virtual methods that should
423 // redirect to a Python method if one exists. The names designate the
424 // return type, if any, as well as any parameter types.
425 //---------------------------------------------------------------------------
428 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
429 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
431 private: wxPyCallbackHelper m_myInst
433 //---------------------------------------------------------------------------
435 #define DEC_PYCALLBACK__(CBNAME) \
437 void base_##CBNAME();
440 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
441 void CLASS::CBNAME() { \
443 wxPyBeginBlockThreads(); \
444 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
445 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
446 wxPyEndBlockThreads(); \
450 void CLASS::base_##CBNAME() { \
454 //---------------------------------------------------------------------------
456 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
457 bool CBNAME(int a, int b); \
458 bool base_##CBNAME(int a, int b);
461 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
462 bool CLASS::CBNAME(int a, int b) { \
463 bool rval=FALSE, found; \
464 wxPyBeginBlockThreads(); \
465 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
466 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
467 wxPyEndBlockThreads(); \
469 rval = PCLASS::CBNAME(a,b); \
472 bool CLASS::base_##CBNAME(int a, int b) { \
473 return PCLASS::CBNAME(a,b); \
476 //---------------------------------------------------------------------------
478 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
479 void CBNAME(int a, int b); \
480 void base_##CBNAME(int a, int b);
483 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
484 void CLASS::CBNAME(int a, int b) { \
486 wxPyBeginBlockThreads(); \
487 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
488 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
489 wxPyEndBlockThreads(); \
491 PCLASS::CBNAME(a,b); \
493 void CLASS::base_##CBNAME(int a, int b) { \
494 PCLASS::CBNAME(a,b); \
497 //---------------------------------------------------------------------------
499 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
500 bool CBNAME(int a); \
501 bool base_##CBNAME(int a);
504 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
505 bool CLASS::CBNAME(int a) { \
506 bool rval=FALSE, found; \
507 wxPyBeginBlockThreads(); \
508 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
509 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
510 wxPyEndBlockThreads(); \
512 rval = PCLASS::CBNAME(a); \
515 bool CLASS::base_##CBNAME(int a) { \
516 return PCLASS::CBNAME(a); \
519 //---------------------------------------------------------------------------
521 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
525 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
526 bool CLASS::CBNAME(int a) { \
528 wxPyBeginBlockThreads(); \
529 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
530 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
532 wxPyEndBlockThreads(); \
537 //---------------------------------------------------------------------------
539 #define DEC_PYCALLBACK__DC(CBNAME) \
540 void CBNAME(wxDC& a); \
541 void base_##CBNAME(wxDC& a);
544 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
545 void CLASS::CBNAME(wxDC& a) { \
547 wxPyBeginBlockThreads(); \
548 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
549 PyObject* obj = wxPyMake_wxObject(&a); \
550 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
553 wxPyEndBlockThreads(); \
557 void CLASS::base_##CBNAME(wxDC& a) { \
563 //---------------------------------------------------------------------------
565 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
566 void CBNAME(wxDC& a, bool b); \
567 void base_##CBNAME(wxDC& a, bool b);
570 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
571 void CLASS::CBNAME(wxDC& a, bool b) { \
573 wxPyBeginBlockThreads(); \
574 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
575 PyObject* obj = wxPyMake_wxObject(&a); \
576 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
579 wxPyEndBlockThreads(); \
581 PCLASS::CBNAME(a, b); \
583 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
584 PCLASS::CBNAME(a, b); \
587 //---------------------------------------------------------------------------
589 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
590 void CBNAME(wxDC& a, bool b); \
591 void base_##CBNAME(wxDC& a, bool b);
594 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
595 void CLASS::CBNAME(wxDC& a, bool b) { \
597 wxPyBeginBlockThreads(); \
598 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
599 PyObject* obj = wxPyMake_wxObject(&a); \
600 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
603 wxPyEndBlockThreads(); \
605 PCLASS::CBNAME(a, b); \
607 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
608 PCLASS::CBNAME(a, b); \
611 //---------------------------------------------------------------------------
613 #define DEC_PYCALLBACK__2DBL(CBNAME) \
614 void CBNAME(double a, double b); \
615 void base_##CBNAME(double a, double b);
618 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
619 void CLASS::CBNAME(double a, double b) { \
621 wxPyBeginBlockThreads(); \
622 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
623 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
624 wxPyEndBlockThreads(); \
626 PCLASS::CBNAME(a, b); \
628 void CLASS::base_##CBNAME(double a, double b) { \
629 PCLASS::CBNAME(a, b); \
632 //---------------------------------------------------------------------------
634 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
635 void CBNAME(double a, double b, int c, int d); \
636 void base_##CBNAME(double a, double b, int c, int d);
639 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
640 void CLASS::CBNAME(double a, double b, int c, int d) { \
642 wxPyBeginBlockThreads(); \
643 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
644 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
646 wxPyEndBlockThreads(); \
648 PCLASS::CBNAME(a, b, c, d); \
650 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
651 PCLASS::CBNAME(a, b, c, d); \
654 //---------------------------------------------------------------------------
656 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
657 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
658 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
661 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
662 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
664 wxPyBeginBlockThreads(); \
665 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
666 PyObject* obj = wxPyMake_wxObject(&a); \
667 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
670 wxPyEndBlockThreads(); \
672 PCLASS::CBNAME(a, b, c, d, e, f); \
674 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
675 PCLASS::CBNAME(a, b, c, d, e, f); \
678 //---------------------------------------------------------------------------
680 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
681 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
682 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
685 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
686 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
688 wxPyBeginBlockThreads(); \
690 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
691 PyObject* obj = wxPyMake_wxObject(&a); \
692 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
695 wxPyEndBlockThreads(); \
697 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
700 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
701 return PCLASS::CBNAME(a, b, c, d, e, f); \
704 //---------------------------------------------------------------------------
706 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
707 void CBNAME(bool a, double b, double c, int d, int e); \
708 void base_##CBNAME(bool a, double b, double c, int d, int e);
711 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
712 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
714 wxPyBeginBlockThreads(); \
715 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
716 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
718 wxPyEndBlockThreads(); \
720 PCLASS::CBNAME(a, b, c, d, e); \
722 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
723 PCLASS::CBNAME(a, b, c, d, e); \
726 //---------------------------------------------------------------------------
728 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
729 void CBNAME(wxDC& a, double b, double c, double d, double e); \
730 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
733 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
734 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
736 wxPyBeginBlockThreads(); \
737 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
738 PyObject* obj = wxPyMake_wxObject(&a); \
739 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
742 wxPyEndBlockThreads(); \
744 PCLASS::CBNAME(a, b, c, d, e); \
746 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
747 PCLASS::CBNAME(a, b, c, d, e); \
750 //---------------------------------------------------------------------------
752 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
753 void CBNAME(wxDC& a, bool b); \
754 void base_##CBNAME(wxDC& a, bool b);
757 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
758 void CLASS::CBNAME(wxDC& a, bool b) { \
760 wxPyBeginBlockThreads(); \
761 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
762 PyObject* obj = wxPyMake_wxObject(&a); \
763 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
766 wxPyEndBlockThreads(); \
768 PCLASS::CBNAME(a, b); \
770 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
771 PCLASS::CBNAME(a, b); \
774 //---------------------------------------------------------------------------
776 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
777 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
778 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
781 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
782 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
785 wxPyBeginBlockThreads(); \
786 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
787 PyObject* obj = wxPyMake_wxObject(a); \
788 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
791 wxPyEndBlockThreads(); \
793 PCLASS::CBNAME(a, b, c, d, e, f); \
795 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
797 PCLASS::CBNAME(a, b, c, d, e, f); \
800 //---------------------------------------------------------------------------
802 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
803 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
804 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
807 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
808 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
810 wxPyBeginBlockThreads(); \
811 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
812 PyObject* obj = wxPyMake_wxObject(a); \
813 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
816 wxPyEndBlockThreads(); \
818 PCLASS::CBNAME(a, b, c, d, e); \
820 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
822 PCLASS::CBNAME(a, b, c, d, e); \
825 //---------------------------------------------------------------------------
827 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
828 void CBNAME(double a, double b, int c); \
829 void base_##CBNAME(double a, double b, int c);
832 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
833 void CLASS::CBNAME(double a, double b, int c) { \
835 wxPyBeginBlockThreads(); \
836 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
837 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
838 wxPyEndBlockThreads(); \
840 PCLASS::CBNAME(a, b, c); \
842 void CLASS::base_##CBNAME(double a, double b, int c) { \
843 PCLASS::CBNAME(a, b, c); \
846 //---------------------------------------------------------------------------
848 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
849 void CBNAME(bool a, double b, double c, int d); \
850 void base_##CBNAME(bool a, double b, double c, int d);
853 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
854 void CLASS::CBNAME(bool a, double b, double c, int d) { \
856 wxPyBeginBlockThreads(); \
857 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
858 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
859 wxPyEndBlockThreads(); \
861 PCLASS::CBNAME(a, b, c, d); \
863 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
864 PCLASS::CBNAME(a, b, c, d); \
867 //---------------------------------------------------------------------------
868 //---------------------------------------------------------------------------
870 #define DEC_PYCALLBACK__STRING(CBNAME) \
871 void CBNAME(const wxString& a); \
872 void base_##CBNAME(const wxString& a);
875 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
876 void CLASS::CBNAME(const wxString& a) { \
878 wxPyBeginBlockThreads(); \
879 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
880 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
881 wxPyEndBlockThreads(); \
885 void CLASS::base_##CBNAME(const wxString& a) { \
889 //---------------------------------------------------------------------------
891 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
892 bool CBNAME(const wxString& a); \
893 bool base_##CBNAME(const wxString& a);
896 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
897 bool CLASS::CBNAME(const wxString& a) { \
900 wxPyBeginBlockThreads(); \
901 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
902 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
903 wxPyEndBlockThreads(); \
905 rval = PCLASS::CBNAME(a); \
908 bool CLASS::base_##CBNAME(const wxString& a) { \
909 return PCLASS::CBNAME(a); \
912 //---------------------------------------------------------------------------
914 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
915 bool CBNAME(const wxString& a);
917 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
918 bool CLASS::CBNAME(const wxString& a) { \
920 wxPyBeginBlockThreads(); \
921 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
922 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
923 wxPyEndBlockThreads(); \
927 //---------------------------------------------------------------------------
929 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
930 wxString CBNAME(const wxString& a); \
932 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
933 wxString CLASS::CBNAME(const wxString& a) { \
935 wxPyBeginBlockThreads(); \
936 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
938 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
940 PyObject* str = PyObject_Str(ro); \
941 rval = PyString_AsString(str); \
942 Py_DECREF(ro); Py_DECREF(str); \
945 wxPyEndBlockThreads(); \
949 //---------------------------------------------------------------------------
951 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
952 wxString CBNAME(const wxString& a,int b); \
954 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
955 wxString CLASS::CBNAME(const wxString& a,int b) { \
957 wxPyBeginBlockThreads(); \
958 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
960 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
962 PyObject* str = PyObject_Str(ro); \
963 rval = PyString_AsString(str); \
964 Py_DECREF(ro); Py_DECREF(str); \
967 wxPyEndBlockThreads(); \
971 //---------------------------------------------------------------------------
973 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
974 bool CBNAME(const wxString& a, const wxString& b); \
975 bool base_##CBNAME(const wxString& a, const wxString& b);
978 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
979 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
982 wxPyBeginBlockThreads(); \
983 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
984 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
985 a.c_str(), b.c_str())); \
986 wxPyEndBlockThreads(); \
988 rval = PCLASS::CBNAME(a, b); \
991 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
992 return PCLASS::CBNAME(a, b); \
995 //---------------------------------------------------------------------------
997 #define DEC_PYCALLBACK_STRING_(CBNAME) \
999 wxString base_##CBNAME();
1002 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1003 wxString CLASS::CBNAME() { \
1006 wxPyBeginBlockThreads(); \
1007 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1009 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1011 PyObject* str = PyObject_Str(ro); \
1012 rval = PyString_AsString(str); \
1013 Py_DECREF(ro); Py_DECREF(str); \
1016 wxPyEndBlockThreads(); \
1018 rval = PCLASS::CBNAME(); \
1021 wxString CLASS::base_##CBNAME() { \
1022 return PCLASS::CBNAME(); \
1025 //---------------------------------------------------------------------------
1027 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1031 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1032 wxString CLASS::CBNAME() { \
1034 wxPyBeginBlockThreads(); \
1035 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1037 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1039 PyObject* str = PyObject_Str(ro); \
1040 rval = PyString_AsString(str); \
1041 Py_DECREF(ro); Py_DECREF(str); \
1044 wxPyEndBlockThreads(); \
1048 //---------------------------------------------------------------------------
1050 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1051 bool CBNAME(const wxHtmlTag& a); \
1054 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1055 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1057 wxPyBeginBlockThreads(); \
1058 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1059 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1060 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1063 wxPyEndBlockThreads(); \
1067 //---------------------------------------------------------------------------
1069 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1070 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1071 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1073 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1074 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1077 wxPyBeginBlockThreads(); \
1078 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1079 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1080 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1083 wxPyEndBlockThreads(); \
1085 PCLASS::CBNAME(cell, x, y); \
1087 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1088 PCLASS::CBNAME(cell, x, y); \
1092 //---------------------------------------------------------------------------
1094 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1095 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1096 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1098 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1099 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1101 wxPyBeginBlockThreads(); \
1102 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1103 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1104 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1105 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1109 wxPyEndBlockThreads(); \
1111 PCLASS::CBNAME(cell, x, y, e); \
1113 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1114 PCLASS::CBNAME(cell, x, y, e); \
1119 //---------------------------------------------------------------------------
1121 #define DEC_PYCALLBACK___pure(CBNAME) \
1125 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1126 void CLASS::CBNAME() { \
1127 wxPyBeginBlockThreads(); \
1128 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1129 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1130 wxPyEndBlockThreads(); \
1133 //---------------------------------------------------------------------------
1135 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1139 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1140 wxSize CLASS::CBNAME() { \
1142 wxPyBeginBlockThreads(); \
1143 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1146 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1148 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1153 wxPyEndBlockThreads(); \
1157 //---------------------------------------------------------------------------
1159 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1160 bool CBNAME(wxWindow* a); \
1161 bool base_##CBNAME(wxWindow* a);
1164 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1165 bool CLASS::CBNAME(wxWindow* a) { \
1168 wxPyBeginBlockThreads(); \
1169 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1170 PyObject* obj = wxPyMake_wxObject(a); \
1171 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1174 wxPyEndBlockThreads(); \
1176 rval = PCLASS::CBNAME(a); \
1179 bool CLASS::base_##CBNAME(wxWindow* a) { \
1180 return PCLASS::CBNAME(a); \
1183 //---------------------------------------------------------------------------
1185 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1187 bool base_##CBNAME();
1190 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1191 bool CLASS::CBNAME() { \
1194 wxPyBeginBlockThreads(); \
1195 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1196 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1197 wxPyEndBlockThreads(); \
1199 rval = PCLASS::CBNAME(); \
1202 bool CLASS::base_##CBNAME() { \
1203 return PCLASS::CBNAME(); \
1206 //---------------------------------------------------------------------------
1208 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1209 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1210 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1213 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1214 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1217 wxPyBeginBlockThreads(); \
1218 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1219 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1220 wxPyEndBlockThreads(); \
1222 rval = PCLASS::CBNAME(a, b, c); \
1223 return (wxDragResult)rval; \
1225 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1226 return PCLASS::CBNAME(a, b, c); \
1229 //---------------------------------------------------------------------------
1231 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1232 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1234 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1235 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1236 wxPyBeginBlockThreads(); \
1238 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1240 PyObject* obj = wxPyMake_wxObject(&a); \
1241 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1244 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1249 wxPyEndBlockThreads(); \
1253 //---------------------------------------------------------------------------
1255 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1256 bool CBNAME(wxDragResult a); \
1257 bool base_##CBNAME(wxDragResult a);
1260 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1261 bool CLASS::CBNAME(wxDragResult a) { \
1264 wxPyBeginBlockThreads(); \
1265 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1267 wxPyEndBlockThreads(); \
1269 rval = PCLASS::CBNAME(a); \
1272 bool CLASS::base_##CBNAME(wxDragResult a) { \
1273 return PCLASS::CBNAME(a); \
1276 //---------------------------------------------------------------------------
1278 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1279 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1282 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1283 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1284 wxPyBeginBlockThreads(); \
1286 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1287 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1288 wxPyEndBlockThreads(); \
1289 return (wxDragResult)rval; \
1292 //---------------------------------------------------------------------------
1294 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1295 bool CBNAME(int a, int b, const wxString& c);
1298 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1299 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1301 wxPyBeginBlockThreads(); \
1302 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1303 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1304 wxPyEndBlockThreads(); \
1308 //---------------------------------------------------------------------------
1310 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1312 size_t base_##CBNAME();
1315 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1316 size_t CLASS::CBNAME() { \
1319 wxPyBeginBlockThreads(); \
1320 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1321 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1322 wxPyEndBlockThreads(); \
1324 rval = PCLASS::CBNAME(); \
1327 size_t CLASS::base_##CBNAME() { \
1328 return PCLASS::CBNAME(); \
1331 //---------------------------------------------------------------------------
1333 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1334 wxDataFormat CBNAME(size_t a); \
1335 wxDataFormat base_##CBNAME(size_t a);
1338 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1339 wxDataFormat CLASS::CBNAME(size_t a) { \
1340 wxDataFormat rval=0; \
1342 wxPyBeginBlockThreads(); \
1343 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1345 wxDataFormat* ptr; \
1346 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1348 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1353 wxPyEndBlockThreads(); \
1355 rval = PCLASS::CBNAME(a); \
1358 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1359 return PCLASS::CBNAME(a); \
1362 //---------------------------------------------------------------------------
1364 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1365 void CBNAME(const Type& a); \
1366 void base_##CBNAME(const Type& a);
1369 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1370 void CLASS::CBNAME(const Type& a) { \
1372 wxPyBeginBlockThreads(); \
1373 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1374 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1375 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1378 wxPyEndBlockThreads(); \
1380 PCLASS::CBNAME(a); \
1382 void CLASS::base_##CBNAME(const Type& a) { \
1383 PCLASS::CBNAME(a); \
1387 //---------------------------------------------------------------------------
1389 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1390 void CBNAME(Type& a); \
1391 void base_##CBNAME(Type& a);
1394 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1395 void CLASS::CBNAME(Type& a) { \
1397 wxPyBeginBlockThreads(); \
1398 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1399 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1400 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1403 wxPyEndBlockThreads(); \
1405 PCLASS::CBNAME(a); \
1407 void CLASS::base_##CBNAME(Type& a) { \
1408 PCLASS::CBNAME(a); \
1411 //---------------------------------------------------------------------------
1413 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1414 bool CBNAME(Type& a); \
1415 bool base_##CBNAME(Type& a);
1418 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1419 bool CLASS::CBNAME(Type& a) { \
1422 wxPyBeginBlockThreads(); \
1423 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1424 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1425 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1428 wxPyEndBlockThreads(); \
1430 rv = PCLASS::CBNAME(a); \
1433 bool CLASS::base_##CBNAME(Type& a) { \
1434 return PCLASS::CBNAME(a); \
1437 //---------------------------------------------------------------------------
1439 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1440 wxString CBNAME(long a, long b) const; \
1441 wxString base_##CBNAME(long a, long b)const ;
1444 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1445 wxString CLASS::CBNAME(long a, long b) const { \
1448 wxPyBeginBlockThreads(); \
1449 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1451 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1453 PyObject* str = PyObject_Str(ro); \
1454 rval = PyString_AsString(str); \
1455 Py_DECREF(ro); Py_DECREF(str); \
1458 wxPyEndBlockThreads(); \
1460 rval = PCLASS::CBNAME(a,b); \
1463 wxString CLASS::base_##CBNAME(long a, long b) const { \
1464 return PCLASS::CBNAME(a,b); \
1467 //---------------------------------------------------------------------------
1469 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1470 int CBNAME(long a) const; \
1471 int base_##CBNAME(long a)const ;
1474 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1475 int CLASS::CBNAME(long a) const { \
1478 wxPyBeginBlockThreads(); \
1479 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1481 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1483 rval = PyInt_AsLong(ro); \
1487 wxPyEndBlockThreads(); \
1489 rval = PCLASS::CBNAME(a); \
1492 int CLASS::base_##CBNAME(long a) const { \
1493 return PCLASS::CBNAME(a); \
1497 //---------------------------------------------------------------------------
1499 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1500 wxListItemAttr* CBNAME(long a) const; \
1501 wxListItemAttr* base_##CBNAME(long a);
1504 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1505 wxListItemAttr *CLASS::CBNAME(long a) const { \
1506 wxListItemAttr *rval = NULL; \
1508 wxPyBeginBlockThreads(); \
1509 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1511 wxListItemAttr* ptr; \
1512 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1514 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1519 wxPyEndBlockThreads(); \
1521 rval = PCLASS::CBNAME(a); \
1524 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1525 return PCLASS::CBNAME(a); \
1528 //---------------------------------------------------------------------------
1530 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1531 bool CBNAME(wxMouseEvent& e); \
1532 bool base_##CBNAME(wxMouseEvent& e);
1534 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1535 bool CLASS::CBNAME(wxMouseEvent& e) { \
1538 wxPyBeginBlockThreads(); \
1539 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1541 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1542 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1544 rval = PyInt_AsLong(ro); \
1549 wxPyEndBlockThreads(); \
1551 return PCLASS::CBNAME(e); \
1554 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1555 return PCLASS::CBNAME(e); \
1559 //---------------------------------------------------------------------------