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
);
148 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
150 //----------------------------------------------------------------------
153 extern "C" void SWIG_MakePtr(char *, void *, char *);
154 extern "C" char *SWIG_GetPtr(char *, void **, char *);
155 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
160 # pragma warning(disable:4800)
161 # pragma warning(disable:4190)
164 //----------------------------------------------------------------------
166 class wxPyCallback
: public wxObject
{
167 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
169 wxPyCallback(PyObject
* func
);
170 wxPyCallback(const wxPyCallback
& other
);
173 void EventThunker(wxEvent
& event
);
178 //---------------------------------------------------------------------------
180 class wxPyTimer
: public wxTimer
{
182 wxPyTimer(PyObject
* callback
);
191 //---------------------------------------------------------------------------
192 //---------------------------------------------------------------------------
193 // These Event classes can be derived from in Python and passed through the
194 // event system without loosing anything. They do this by keeping a reference
195 // to themselves and some special case handling in wxPyCallback::EventThunker.
198 class wxPyEvtSelfRef
{
203 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
204 PyObject
* GetSelf() const;
212 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
213 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
216 wxPyEvent(const wxPyEvent
& evt
);
219 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
223 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
224 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
226 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
227 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
230 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
234 //---------------------------------------------------------------------------
235 // Export a C API in a struct. Other modules will be able to load this from
236 // the wxc module and will then have safe access to these functions, even if
237 // in another shared library.
239 class wxPyCallbackHelper
;
243 void (*p_SWIG_MakePtr
)(char*, void*, char*);
244 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
245 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
246 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
247 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
248 PyObject
* (*p_SWIG_newvarlink
)(void);
250 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
251 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
252 void (*p_wxPyBeginBlockThreads
)();
253 void (*p_wxPyEndBlockThreads
)();
255 PyObject
* (*p_wxPyConstructObject
)(void *, const char *, int);
256 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
258 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
259 int* (*p_int_LIST_helper
)(PyObject
* source
);
260 long* (*p_long_LIST_helper
)(PyObject
* source
);
261 char** (*p_string_LIST_helper
)(PyObject
* source
);
262 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
263 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
264 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
265 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
267 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
268 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
269 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
270 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
271 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
273 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
274 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
275 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
276 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
277 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
279 PyObject
* (*p_wxPyClassExists
)(const char* className
);
280 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
281 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
282 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
283 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
286 #ifdef wxPyUSE_EXPORT
287 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
290 //---------------------------------------------------------------------------
291 // This class holds an instance of a Python Shadow Class object and assists
292 // with looking up and invoking Python callback methods from C++ virtual
293 // method redirections. For all classes which have virtuals which should be
294 // overridable in wxPython, a new subclass is created that contains a
295 // wxPyCallbackHelper.
298 class wxPyCallbackHelper
{
300 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
302 wxPyCallbackHelper() {
309 ~wxPyCallbackHelper() {
310 #ifdef wxPyUSE_EXPORT
311 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
313 wxPyCBH_delete(this);
317 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
318 bool findCallback(const char* name
) const;
319 int callCallback(PyObject
* argTuple
) const;
320 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
325 PyObject
* m_lastFound
;
328 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
332 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
333 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
334 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
335 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
336 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
340 //----------------------------------------------------------------------
342 class wxPyUserData
: public wxObject
{
344 wxPyUserData(PyObject
* obj
) {
350 #ifdef wxPyUSE_EXPORT
351 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
353 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
355 wxPyBeginBlockThreads();
357 wxPyEndBlockThreads();
365 class wxPyClientData
: public wxClientData
{
367 wxPyClientData(PyObject
* obj
) {
373 #ifdef wxPyUSE_EXPORT
374 wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
376 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads();
378 wxPyBeginBlockThreads();
380 wxPyEndBlockThreads();
388 //---------------------------------------------------------------------------
389 // These macros are used to implement the virtual methods that should
390 // redirect to a Python method if one exists. The names designate the
391 // return type, if any, as well as any parameter types.
392 //---------------------------------------------------------------------------
395 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
396 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
398 private: wxPyCallbackHelper m_myInst
400 //---------------------------------------------------------------------------
402 #define DEC_PYCALLBACK__(CBNAME) \
404 void base_##CBNAME();
407 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
408 void CLASS::CBNAME() { \
410 wxPyBeginBlockThreads(); \
411 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
412 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
413 wxPyEndBlockThreads(); \
417 void CLASS::base_##CBNAME() { \
421 //---------------------------------------------------------------------------
423 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
424 bool CBNAME(int a, int b); \
425 bool base_##CBNAME(int a, int b);
428 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
429 bool CLASS::CBNAME(int a, int b) { \
430 bool rval=FALSE, found; \
431 wxPyBeginBlockThreads(); \
432 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
433 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
434 wxPyEndBlockThreads(); \
436 rval = PCLASS::CBNAME(a,b); \
439 bool CLASS::base_##CBNAME(int a, int b) { \
440 return PCLASS::CBNAME(a,b); \
443 //---------------------------------------------------------------------------
445 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
446 void CBNAME(int a, int b); \
447 void base_##CBNAME(int a, int b);
450 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
451 void CLASS::CBNAME(int a, int b) { \
453 wxPyBeginBlockThreads(); \
454 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
455 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
456 wxPyEndBlockThreads(); \
458 PCLASS::CBNAME(a,b); \
460 void CLASS::base_##CBNAME(int a, int b) { \
461 PCLASS::CBNAME(a,b); \
464 //---------------------------------------------------------------------------
466 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
467 bool CBNAME(int a); \
468 bool base_##CBNAME(int a);
471 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
472 bool CLASS::CBNAME(int a) { \
473 bool rval=FALSE, found; \
474 wxPyBeginBlockThreads(); \
475 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
476 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
477 wxPyEndBlockThreads(); \
479 rval = PCLASS::CBNAME(a); \
482 bool CLASS::base_##CBNAME(int a) { \
483 return PCLASS::CBNAME(a); \
486 //---------------------------------------------------------------------------
488 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
492 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
493 bool CLASS::CBNAME(int a) { \
495 wxPyBeginBlockThreads(); \
496 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
497 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
499 wxPyEndBlockThreads(); \
504 //---------------------------------------------------------------------------
506 #define DEC_PYCALLBACK__DC(CBNAME) \
507 void CBNAME(wxDC& a); \
508 void base_##CBNAME(wxDC& a);
511 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
512 void CLASS::CBNAME(wxDC& a) { \
514 wxPyBeginBlockThreads(); \
515 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
516 PyObject* obj = wxPyMake_wxObject(&a); \
517 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
520 wxPyEndBlockThreads(); \
524 void CLASS::base_##CBNAME(wxDC& a) { \
530 //---------------------------------------------------------------------------
532 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
533 void CBNAME(wxDC& a, bool b); \
534 void base_##CBNAME(wxDC& a, bool b);
537 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
538 void CLASS::CBNAME(wxDC& a, bool b) { \
540 wxPyBeginBlockThreads(); \
541 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
542 PyObject* obj = wxPyMake_wxObject(&a); \
543 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
546 wxPyEndBlockThreads(); \
548 PCLASS::CBNAME(a, b); \
550 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
551 PCLASS::CBNAME(a, b); \
554 //---------------------------------------------------------------------------
556 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
557 void CBNAME(wxDC& a, bool b); \
558 void base_##CBNAME(wxDC& a, bool b);
561 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
562 void CLASS::CBNAME(wxDC& a, bool b) { \
564 wxPyBeginBlockThreads(); \
565 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
566 PyObject* obj = wxPyMake_wxObject(&a); \
567 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
570 wxPyEndBlockThreads(); \
572 PCLASS::CBNAME(a, b); \
574 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
575 PCLASS::CBNAME(a, b); \
578 //---------------------------------------------------------------------------
580 #define DEC_PYCALLBACK__2DBL(CBNAME) \
581 void CBNAME(double a, double b); \
582 void base_##CBNAME(double a, double b);
585 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
586 void CLASS::CBNAME(double a, double b) { \
588 wxPyBeginBlockThreads(); \
589 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
590 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
591 wxPyEndBlockThreads(); \
593 PCLASS::CBNAME(a, b); \
595 void CLASS::base_##CBNAME(double a, double b) { \
596 PCLASS::CBNAME(a, b); \
599 //---------------------------------------------------------------------------
601 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
602 void CBNAME(double a, double b, int c, int d); \
603 void base_##CBNAME(double a, double b, int c, int d);
606 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
607 void CLASS::CBNAME(double a, double b, int c, int d) { \
609 wxPyBeginBlockThreads(); \
610 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
611 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
613 wxPyEndBlockThreads(); \
615 PCLASS::CBNAME(a, b, c, d); \
617 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
618 PCLASS::CBNAME(a, b, c, d); \
621 //---------------------------------------------------------------------------
623 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
624 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
625 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
628 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
629 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
631 wxPyBeginBlockThreads(); \
632 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
633 PyObject* obj = wxPyMake_wxObject(&a); \
634 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
637 wxPyEndBlockThreads(); \
639 PCLASS::CBNAME(a, b, c, d, e, f); \
641 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
642 PCLASS::CBNAME(a, b, c, d, e, f); \
645 //---------------------------------------------------------------------------
647 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
648 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
649 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
652 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
653 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
655 wxPyBeginBlockThreads(); \
657 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
658 PyObject* obj = wxPyMake_wxObject(&a); \
659 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
662 wxPyEndBlockThreads(); \
664 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
667 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
668 return PCLASS::CBNAME(a, b, c, d, e, f); \
671 //---------------------------------------------------------------------------
673 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
674 void CBNAME(bool a, double b, double c, int d, int e); \
675 void base_##CBNAME(bool a, double b, double c, int d, int e);
678 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
679 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
681 wxPyBeginBlockThreads(); \
682 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
683 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
685 wxPyEndBlockThreads(); \
687 PCLASS::CBNAME(a, b, c, d, e); \
689 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
690 PCLASS::CBNAME(a, b, c, d, e); \
693 //---------------------------------------------------------------------------
695 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
696 void CBNAME(wxDC& a, double b, double c, double d, double e); \
697 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
700 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
701 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
703 wxPyBeginBlockThreads(); \
704 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
705 PyObject* obj = wxPyMake_wxObject(&a); \
706 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
709 wxPyEndBlockThreads(); \
711 PCLASS::CBNAME(a, b, c, d, e); \
713 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
714 PCLASS::CBNAME(a, b, c, d, e); \
717 //---------------------------------------------------------------------------
719 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
720 void CBNAME(wxDC& a, bool b); \
721 void base_##CBNAME(wxDC& a, bool b);
724 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
725 void CLASS::CBNAME(wxDC& a, bool b) { \
727 wxPyBeginBlockThreads(); \
728 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
729 PyObject* obj = wxPyMake_wxObject(&a); \
730 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
733 wxPyEndBlockThreads(); \
735 PCLASS::CBNAME(a, b); \
737 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
738 PCLASS::CBNAME(a, b); \
741 //---------------------------------------------------------------------------
743 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
744 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
745 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
748 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
749 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
752 wxPyBeginBlockThreads(); \
753 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
754 PyObject* obj = wxPyMake_wxObject(a); \
755 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
758 wxPyEndBlockThreads(); \
760 PCLASS::CBNAME(a, b, c, d, e, f); \
762 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
764 PCLASS::CBNAME(a, b, c, d, e, f); \
767 //---------------------------------------------------------------------------
769 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
770 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
771 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
774 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
775 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
777 wxPyBeginBlockThreads(); \
778 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
779 PyObject* obj = wxPyMake_wxObject(a); \
780 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
783 wxPyEndBlockThreads(); \
785 PCLASS::CBNAME(a, b, c, d, e); \
787 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
789 PCLASS::CBNAME(a, b, c, d, e); \
792 //---------------------------------------------------------------------------
794 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
795 void CBNAME(double a, double b, int c); \
796 void base_##CBNAME(double a, double b, int c);
799 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
800 void CLASS::CBNAME(double a, double b, int c) { \
802 wxPyBeginBlockThreads(); \
803 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
804 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
805 wxPyEndBlockThreads(); \
807 PCLASS::CBNAME(a, b, c); \
809 void CLASS::base_##CBNAME(double a, double b, int c) { \
810 PCLASS::CBNAME(a, b, c); \
813 //---------------------------------------------------------------------------
815 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
816 void CBNAME(bool a, double b, double c, int d); \
817 void base_##CBNAME(bool a, double b, double c, int d);
820 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
821 void CLASS::CBNAME(bool a, double b, double c, int d) { \
823 wxPyBeginBlockThreads(); \
824 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
825 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
826 wxPyEndBlockThreads(); \
828 PCLASS::CBNAME(a, b, c, d); \
830 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
831 PCLASS::CBNAME(a, b, c, d); \
834 //---------------------------------------------------------------------------
835 //---------------------------------------------------------------------------
837 #define DEC_PYCALLBACK__STRING(CBNAME) \
838 void CBNAME(const wxString& a); \
839 void base_##CBNAME(const wxString& a);
842 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
843 void CLASS::CBNAME(const wxString& a) { \
845 wxPyBeginBlockThreads(); \
846 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
847 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
848 wxPyEndBlockThreads(); \
852 void CLASS::base_##CBNAME(const wxString& a) { \
856 //---------------------------------------------------------------------------
858 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
859 bool CBNAME(const wxString& a); \
860 bool base_##CBNAME(const wxString& a);
863 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
864 bool CLASS::CBNAME(const wxString& a) { \
867 wxPyBeginBlockThreads(); \
868 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
869 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
870 wxPyEndBlockThreads(); \
872 rval = PCLASS::CBNAME(a); \
875 bool CLASS::base_##CBNAME(const wxString& a) { \
876 return PCLASS::CBNAME(a); \
879 //---------------------------------------------------------------------------
881 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
882 bool CBNAME(const wxString& a);
884 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
885 bool CLASS::CBNAME(const wxString& a) { \
887 wxPyBeginBlockThreads(); \
888 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
889 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
890 wxPyEndBlockThreads(); \
894 //---------------------------------------------------------------------------
896 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
897 wxString CBNAME(const wxString& a); \
899 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
900 wxString CLASS::CBNAME(const wxString& a) { \
902 wxPyBeginBlockThreads(); \
903 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
905 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
907 PyObject* str = PyObject_Str(ro); \
908 rval = PyString_AsString(str); \
909 Py_DECREF(ro); Py_DECREF(str); \
912 wxPyEndBlockThreads(); \
916 //---------------------------------------------------------------------------
918 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
919 wxString CBNAME(const wxString& a,int b); \
921 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
922 wxString CLASS::CBNAME(const wxString& a,int b) { \
924 wxPyBeginBlockThreads(); \
925 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
927 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
929 PyObject* str = PyObject_Str(ro); \
930 rval = PyString_AsString(str); \
931 Py_DECREF(ro); Py_DECREF(str); \
934 wxPyEndBlockThreads(); \
938 //---------------------------------------------------------------------------
940 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
941 bool CBNAME(const wxString& a, const wxString& b); \
942 bool base_##CBNAME(const wxString& a, const wxString& b);
945 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
946 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
949 wxPyBeginBlockThreads(); \
950 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
951 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
952 a.c_str(), b.c_str())); \
953 wxPyEndBlockThreads(); \
955 rval = PCLASS::CBNAME(a, b); \
958 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
959 return PCLASS::CBNAME(a, b); \
962 //---------------------------------------------------------------------------
964 #define DEC_PYCALLBACK_STRING_(CBNAME) \
966 wxString base_##CBNAME();
969 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
970 wxString CLASS::CBNAME() { \
973 wxPyBeginBlockThreads(); \
974 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
976 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
978 PyObject* str = PyObject_Str(ro); \
979 rval = PyString_AsString(str); \
980 Py_DECREF(ro); Py_DECREF(str); \
983 wxPyEndBlockThreads(); \
985 rval = PCLASS::CBNAME(); \
988 wxString CLASS::base_##CBNAME() { \
989 return PCLASS::CBNAME(); \
992 //---------------------------------------------------------------------------
994 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
998 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
999 wxString CLASS::CBNAME() { \
1001 wxPyBeginBlockThreads(); \
1002 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1004 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1006 PyObject* str = PyObject_Str(ro); \
1007 rval = PyString_AsString(str); \
1008 Py_DECREF(ro); Py_DECREF(str); \
1011 wxPyEndBlockThreads(); \
1015 //---------------------------------------------------------------------------
1017 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1018 bool CBNAME(const wxHtmlTag& a); \
1021 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1022 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1024 wxPyBeginBlockThreads(); \
1025 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1026 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1027 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1030 wxPyEndBlockThreads(); \
1034 //---------------------------------------------------------------------------
1036 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1037 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1038 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1040 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1041 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1044 wxPyBeginBlockThreads(); \
1045 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1046 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1047 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1050 wxPyEndBlockThreads(); \
1052 PCLASS::CBNAME(cell, x, y); \
1054 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1055 PCLASS::CBNAME(cell, x, y); \
1059 //---------------------------------------------------------------------------
1061 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1062 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1063 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1065 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1066 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1068 wxPyBeginBlockThreads(); \
1069 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1070 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1071 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1072 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1076 wxPyEndBlockThreads(); \
1078 PCLASS::CBNAME(cell, x, y, e); \
1080 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1081 PCLASS::CBNAME(cell, x, y, e); \
1086 //---------------------------------------------------------------------------
1088 #define DEC_PYCALLBACK___pure(CBNAME) \
1092 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1093 void CLASS::CBNAME() { \
1094 wxPyBeginBlockThreads(); \
1095 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1096 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1097 wxPyEndBlockThreads(); \
1100 //---------------------------------------------------------------------------
1102 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1106 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1107 wxSize CLASS::CBNAME() { \
1109 wxPyBeginBlockThreads(); \
1110 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1113 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1115 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1120 wxPyEndBlockThreads(); \
1124 //---------------------------------------------------------------------------
1126 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1127 bool CBNAME(wxWindow* a); \
1128 bool base_##CBNAME(wxWindow* a);
1131 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1132 bool CLASS::CBNAME(wxWindow* a) { \
1135 wxPyBeginBlockThreads(); \
1136 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1137 PyObject* obj = wxPyMake_wxObject(a); \
1138 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1141 wxPyEndBlockThreads(); \
1143 rval = PCLASS::CBNAME(a); \
1146 bool CLASS::base_##CBNAME(wxWindow* a) { \
1147 return PCLASS::CBNAME(a); \
1150 //---------------------------------------------------------------------------
1152 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1154 bool base_##CBNAME();
1157 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1158 bool CLASS::CBNAME() { \
1161 wxPyBeginBlockThreads(); \
1162 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1163 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1164 wxPyEndBlockThreads(); \
1166 rval = PCLASS::CBNAME(); \
1169 bool CLASS::base_##CBNAME() { \
1170 return PCLASS::CBNAME(); \
1173 //---------------------------------------------------------------------------
1175 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1176 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1177 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1180 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1181 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1184 wxPyBeginBlockThreads(); \
1185 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1186 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1187 wxPyEndBlockThreads(); \
1189 rval = PCLASS::CBNAME(a, b, c); \
1190 return (wxDragResult)rval; \
1192 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1193 return PCLASS::CBNAME(a, b, c); \
1196 //---------------------------------------------------------------------------
1198 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1199 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1201 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1202 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1203 wxPyBeginBlockThreads(); \
1205 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1207 PyObject* obj = wxPyMake_wxObject(&a); \
1208 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1211 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1216 wxPyEndBlockThreads(); \
1220 //---------------------------------------------------------------------------
1222 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1223 bool CBNAME(wxDragResult a); \
1224 bool base_##CBNAME(wxDragResult a);
1227 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1228 bool CLASS::CBNAME(wxDragResult a) { \
1231 wxPyBeginBlockThreads(); \
1232 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1233 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1234 wxPyEndBlockThreads(); \
1236 rval = PCLASS::CBNAME(a); \
1239 bool CLASS::base_##CBNAME(wxDragResult a) { \
1240 return PCLASS::CBNAME(a); \
1243 //---------------------------------------------------------------------------
1245 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1246 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1249 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1250 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1251 wxPyBeginBlockThreads(); \
1253 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1254 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1255 wxPyEndBlockThreads(); \
1256 return (wxDragResult)rval; \
1259 //---------------------------------------------------------------------------
1261 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1262 bool CBNAME(int a, int b, const wxString& c);
1265 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1266 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1268 wxPyBeginBlockThreads(); \
1269 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1270 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1271 wxPyEndBlockThreads(); \
1275 //---------------------------------------------------------------------------
1277 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1279 size_t base_##CBNAME();
1282 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1283 size_t CLASS::CBNAME() { \
1286 wxPyBeginBlockThreads(); \
1287 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1288 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1289 wxPyEndBlockThreads(); \
1291 rval = PCLASS::CBNAME(); \
1294 size_t CLASS::base_##CBNAME() { \
1295 return PCLASS::CBNAME(); \
1298 //---------------------------------------------------------------------------
1300 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1301 wxDataFormat CBNAME(size_t a); \
1302 wxDataFormat base_##CBNAME(size_t a);
1305 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1306 wxDataFormat CLASS::CBNAME(size_t a) { \
1307 wxDataFormat rval=0; \
1309 wxPyBeginBlockThreads(); \
1310 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1312 wxDataFormat* ptr; \
1313 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1315 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1320 wxPyEndBlockThreads(); \
1322 rval = PCLASS::CBNAME(a); \
1325 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1326 return PCLASS::CBNAME(a); \
1329 //---------------------------------------------------------------------------
1331 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1332 void CBNAME(const Type& a); \
1333 void base_##CBNAME(const Type& a);
1336 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1337 void CLASS::CBNAME(const Type& a) { \
1339 wxPyBeginBlockThreads(); \
1340 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1341 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1342 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1345 wxPyEndBlockThreads(); \
1347 PCLASS::CBNAME(a); \
1349 void CLASS::base_##CBNAME(const Type& a) { \
1350 PCLASS::CBNAME(a); \
1354 //---------------------------------------------------------------------------
1356 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1357 void CBNAME(Type& a); \
1358 void base_##CBNAME(Type& a);
1361 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1362 void CLASS::CBNAME(Type& a) { \
1364 wxPyBeginBlockThreads(); \
1365 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1366 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1367 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1370 wxPyEndBlockThreads(); \
1372 PCLASS::CBNAME(a); \
1374 void CLASS::base_##CBNAME(Type& a) { \
1375 PCLASS::CBNAME(a); \
1378 //---------------------------------------------------------------------------
1380 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1381 bool CBNAME(Type& a); \
1382 bool base_##CBNAME(Type& a);
1385 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1386 bool CLASS::CBNAME(Type& a) { \
1389 wxPyBeginBlockThreads(); \
1390 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1391 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1392 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1395 wxPyEndBlockThreads(); \
1397 rv = PCLASS::CBNAME(a); \
1400 bool CLASS::base_##CBNAME(Type& a) { \
1401 return PCLASS::CBNAME(a); \
1404 //---------------------------------------------------------------------------
1406 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1407 wxString CBNAME(long a, long b) const; \
1408 wxString base_##CBNAME(long a, long b)const ;
1411 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1412 wxString CLASS::CBNAME(long a, long b) const { \
1415 wxPyBeginBlockThreads(); \
1416 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1418 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1420 PyObject* str = PyObject_Str(ro); \
1421 rval = PyString_AsString(str); \
1422 Py_DECREF(ro); Py_DECREF(str); \
1425 wxPyEndBlockThreads(); \
1427 rval = PCLASS::CBNAME(a,b); \
1430 wxString CLASS::base_##CBNAME(long a, long b) const { \
1431 return PCLASS::CBNAME(a,b); \
1434 //---------------------------------------------------------------------------
1436 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1437 int CBNAME(long a) const; \
1438 int base_##CBNAME(long a)const ;
1441 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1442 int CLASS::CBNAME(long a) const { \
1445 wxPyBeginBlockThreads(); \
1446 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1448 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1450 rval = PyInt_AsLong(ro); \
1454 wxPyEndBlockThreads(); \
1456 rval = PCLASS::CBNAME(a); \
1459 int CLASS::base_##CBNAME(long a) const { \
1460 return PCLASS::CBNAME(a); \
1464 //---------------------------------------------------------------------------
1466 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1467 wxListItemAttr* CBNAME(long a) const; \
1468 wxListItemAttr* base_##CBNAME(long a);
1471 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1472 wxListItemAttr *CLASS::CBNAME(long a) const { \
1473 wxListItemAttr *rval = NULL; \
1475 wxPyBeginBlockThreads(); \
1476 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1478 wxListItemAttr* ptr; \
1479 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1481 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1486 wxPyEndBlockThreads(); \
1488 rval = PCLASS::CBNAME(a); \
1491 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1492 return PCLASS::CBNAME(a); \
1495 //---------------------------------------------------------------------------
1497 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1498 bool CBNAME(wxMouseEvent& e); \
1499 bool base_##CBNAME(wxMouseEvent& e);
1501 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1502 bool CLASS::CBNAME(wxMouseEvent& e) { \
1505 wxPyBeginBlockThreads(); \
1506 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1508 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1509 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1511 rval = PyInt_AsLong(ro); \
1516 wxPyEndBlockThreads(); \
1518 return PCLASS::CBNAME(e); \
1521 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1522 return PCLASS::CBNAME(e); \
1526 //---------------------------------------------------------------------------