1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: Helper functions/classes for the wxPython extenaion module
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __wxp_helpers__
14 #define __wxp_helpers__
18 //----------------------------------------------------------------------
20 // if we want to handle threads and Python threads are available...
21 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
23 #define WXP_WITH_THREAD
24 #define wxPy_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
25 #define wxPy_END_ALLOW_THREADS Py_END_ALLOW_THREADS
27 #else // no Python threads...
28 #undef WXP_WITH_THREAD
29 #define wxPy_BEGIN_ALLOW_THREADS
30 #define wxPy_END_ALLOW_THREADS
34 //---------------------------------------------------------------------------
36 typedef unsigned char byte
;
39 class wxPyApp
: public wxApp
47 extern wxPyApp
*wxPythonApp
;
49 //----------------------------------------------------------------------
52 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
55 //extern PyObject* wxPython_dict;
56 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
58 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
60 PyObject
* wxPyConstructObject(void* ptr
,
61 const char* className
,
63 PyObject
* wxPyConstructObject(void* ptr
,
64 const char* className
,
67 PyObject
* wxPyClassExists(const char* className
);
68 PyObject
* wxPyMake_wxObject(wxObject
* source
);
69 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
71 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
72 long wxPyGetWinHandle(wxWindow
* win
);
74 //----------------------------------------------------------------------
77 PyThreadState
* newState
;
78 PyThreadState
* prevState
;
80 wxPyTState() : newState(NULL
), prevState(NULL
) {}
84 wxPyTState
* wxPyBeginBlockThreads();
85 void wxPyEndBlockThreads(wxPyTState
* state
);
88 //----------------------------------------------------------------------
89 // Handle wxInputStreams by Joerg Baumann
90 // See stream.i for implementations
92 // list class for return list of strings, e.g. readlines()
93 WX_DECLARE_LIST(wxString
, wxStringPtrList
);
96 // C++ class wxPyInputStream to act as base for python class wxInputStream
97 // Use it in python like a python file object
98 class wxPyInputStream
{
100 // underlying wxInputStream
104 wxPyInputStream(wxInputStream
* wxi_
) : wxi(wxi_
) {}
107 // python file object interface for input files (most of it)
111 wxString
* read(int size
=-1);
112 wxString
* readline(int size
=-1);
113 wxStringPtrList
* readlines(int sizehint
=-1);
114 void seek(int offset
, int whence
=0);
119 void truncate(int size=-1);
120 void write(wxString data);
121 void writelines(wxStringPtrList);
126 //----------------------------------------------------------------------
127 // These are helpers used by the typemaps
129 byte
* byte_LIST_helper(PyObject
* source
);
130 int* int_LIST_helper(PyObject
* source
);
131 long* long_LIST_helper(PyObject
* source
);
132 char** string_LIST_helper(PyObject
* source
);
133 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
134 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
135 wxString
* wxString_LIST_helper(PyObject
* source
);
136 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
137 wxPen
** wxPen_LIST_helper(PyObject
* source
);
139 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
140 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
141 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
142 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
143 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
145 #if PYTHON_API_VERSION < 1009
146 #define PySequence_Fast_GET_ITEM(o, i) \
147 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
150 bool _2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
151 bool _4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
154 //----------------------------------------------------------------------
157 extern "C" void SWIG_MakePtr(char *, void *, char *);
158 extern "C" char *SWIG_GetPtr(char *, void **, char *);
159 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
164 # pragma warning(disable:4800)
165 # pragma warning(disable:4190)
168 //----------------------------------------------------------------------
170 class wxPyCallback
: public wxObject
{
171 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
173 wxPyCallback(PyObject
* func
);
174 wxPyCallback(const wxPyCallback
& other
);
177 void EventThunker(wxEvent
& event
);
182 //---------------------------------------------------------------------------
184 class wxPyTimer
: public wxTimer
{
186 wxPyTimer(PyObject
* callback
);
195 //---------------------------------------------------------------------------
196 //---------------------------------------------------------------------------
197 // These Event classes can be derived from in Python and passed through the
198 // event system without loosing anything. They do this by keeping a reference
199 // to themselves and some special case handling in wxPyCallback::EventThunker.
202 class wxPyEvtSelfRef
{
207 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
208 PyObject
* GetSelf() const;
216 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
217 DECLARE_DYNAMIC_CLASS(wxPyEvent
)
222 void CopyObject(wxObject
& dest
) const;
226 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
227 DECLARE_DYNAMIC_CLASS(wxPyCommandEvent
)
229 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
232 void CopyObject(wxObject
& dest
) const;
236 //---------------------------------------------------------------------------
237 // Export a C API in a struct. Other modules will be able to load this from
238 // the wxc module and will then have safe access to these functions, even if
239 // in another shared library.
241 class wxPyCallbackHelper
;
245 void (*p_SWIG_MakePtr
)(char*, void*, char*);
246 char* (*p_SWIG_GetPtr
)(char*, void**, char*);
247 char* (*p_SWIG_GetPtrObj
)(PyObject
*, void**, char*);
248 void (*p_SWIG_RegisterMapping
)(char*, char*, void *(*cast
)(void *));
249 void (*p_SWIG_addvarlink
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
250 PyObject
* (*p_SWIG_newvarlink
)(void);
252 wxPyTState
* (*p_wxPyBeginBlockThreads
)();
253 void (*p_wxPyEndBlockThreads
)(wxPyTState
* state
);
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
);
281 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
285 #ifdef wxPyUSE_EXPORT
286 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
; // Each module needs one, but may not use it.
289 //---------------------------------------------------------------------------
290 // This class holds an instance of a Python Shadow Class object and assists
291 // with looking up and invoking Python callback methods from C++ virtual
292 // method redirections. For all classes which have virtuals which should be
293 // overridable in wxPython, a new subclass is created that contains a
294 // wxPyCallbackHelper.
297 class wxPyCallbackHelper
{
299 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
301 wxPyCallbackHelper() {
308 ~wxPyCallbackHelper() {
309 #ifdef wxPyUSE_EXPORT
310 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
312 wxPyCBH_delete(this);
316 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
317 bool findCallback(const char* name
) const;
318 int callCallback(PyObject
* argTuple
) const;
319 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
324 PyObject
* m_lastFound
;
327 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
331 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
332 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
333 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
334 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
335 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
339 //----------------------------------------------------------------------
341 class wxPyUserData
: public wxObject
{
343 wxPyUserData(PyObject
* obj
) {
349 #ifdef wxPyUSE_EXPORT
350 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
352 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
354 wxPyTState
* state
= wxPyBeginBlockThreads();
356 wxPyEndBlockThreads(state
);
364 class wxPyClientData
: public wxClientData
{
366 wxPyClientData(PyObject
* obj
) {
372 #ifdef wxPyUSE_EXPORT
373 wxPyTState
* state
= wxPyCoreAPIPtr
->p_wxPyBeginBlockThreads();
375 wxPyCoreAPIPtr
->p_wxPyEndBlockThreads(state
);
377 wxPyTState
* state
= wxPyBeginBlockThreads();
379 wxPyEndBlockThreads(state
);
387 //---------------------------------------------------------------------------
388 // These macros are used to implement the virtual methods that should
389 // redirect to a Python method if one exists. The names designate the
390 // return type, if any, as well as any parameter types.
391 //---------------------------------------------------------------------------
394 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
395 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
397 private: wxPyCallbackHelper m_myInst
399 //---------------------------------------------------------------------------
401 #define DEC_PYCALLBACK__(CBNAME) \
403 void base_##CBNAME();
406 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
407 void CLASS::CBNAME() { \
409 wxPyTState* state = wxPyBeginBlockThreads(); \
410 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
411 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
412 wxPyEndBlockThreads(state); \
416 void CLASS::base_##CBNAME() { \
420 //---------------------------------------------------------------------------
422 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
423 bool CBNAME(int a, int b); \
424 bool base_##CBNAME(int a, int b);
427 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
428 bool CLASS::CBNAME(int a, int b) { \
429 bool rval=FALSE, found; \
430 wxPyTState* state = wxPyBeginBlockThreads(); \
431 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
432 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
433 wxPyEndBlockThreads(state); \
435 rval = PCLASS::CBNAME(a,b); \
438 bool CLASS::base_##CBNAME(int a, int b) { \
439 return PCLASS::CBNAME(a,b); \
442 //---------------------------------------------------------------------------
444 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
445 void CBNAME(int a, int b); \
446 void base_##CBNAME(int a, int b);
449 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
450 void CLASS::CBNAME(int a, int b) { \
452 wxPyTState* state = wxPyBeginBlockThreads(); \
453 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
454 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
455 wxPyEndBlockThreads(state); \
457 PCLASS::CBNAME(a,b); \
459 void CLASS::base_##CBNAME(int a, int b) { \
460 PCLASS::CBNAME(a,b); \
463 //---------------------------------------------------------------------------
465 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
466 bool CBNAME(int a); \
467 bool base_##CBNAME(int a);
470 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
471 bool CLASS::CBNAME(int a) { \
472 bool rval=FALSE, found; \
473 wxPyTState* state = wxPyBeginBlockThreads(); \
474 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
475 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
476 wxPyEndBlockThreads(state); \
478 rval = PCLASS::CBNAME(a); \
481 bool CLASS::base_##CBNAME(int a) { \
482 return PCLASS::CBNAME(a); \
485 //---------------------------------------------------------------------------
487 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
491 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
492 bool CLASS::CBNAME(int a) { \
494 wxPyTState* state = wxPyBeginBlockThreads(); \
495 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
496 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
498 wxPyEndBlockThreads(state); \
503 //---------------------------------------------------------------------------
505 #define DEC_PYCALLBACK__DC(CBNAME) \
506 void CBNAME(wxDC& a); \
507 void base_##CBNAME(wxDC& a);
510 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
511 void CLASS::CBNAME(wxDC& a) { \
513 wxPyTState* state = wxPyBeginBlockThreads(); \
514 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
515 PyObject* obj = wxPyMake_wxObject(&a); \
516 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
519 wxPyEndBlockThreads(state); \
523 void CLASS::base_##CBNAME(wxDC& a) { \
529 //---------------------------------------------------------------------------
531 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
532 void CBNAME(wxDC& a, bool b); \
533 void base_##CBNAME(wxDC& a, bool b);
536 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
537 void CLASS::CBNAME(wxDC& a, bool b) { \
539 wxPyTState* state = wxPyBeginBlockThreads(); \
540 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
541 PyObject* obj = wxPyMake_wxObject(&a); \
542 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
545 wxPyEndBlockThreads(state); \
547 PCLASS::CBNAME(a, b); \
549 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
550 PCLASS::CBNAME(a, b); \
553 //---------------------------------------------------------------------------
555 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
556 void CBNAME(wxDC& a, bool b); \
557 void base_##CBNAME(wxDC& a, bool b);
560 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
561 void CLASS::CBNAME(wxDC& a, bool b) { \
563 wxPyTState* state = wxPyBeginBlockThreads(); \
564 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
565 PyObject* obj = wxPyMake_wxObject(&a); \
566 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
569 wxPyEndBlockThreads(state); \
571 PCLASS::CBNAME(a, b); \
573 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
574 PCLASS::CBNAME(a, b); \
577 //---------------------------------------------------------------------------
579 #define DEC_PYCALLBACK__2DBL(CBNAME) \
580 void CBNAME(double a, double b); \
581 void base_##CBNAME(double a, double b);
584 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
585 void CLASS::CBNAME(double a, double b) { \
587 wxPyTState* state = wxPyBeginBlockThreads(); \
588 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
589 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
590 wxPyEndBlockThreads(state); \
592 PCLASS::CBNAME(a, b); \
594 void CLASS::base_##CBNAME(double a, double b) { \
595 PCLASS::CBNAME(a, b); \
598 //---------------------------------------------------------------------------
600 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
601 void CBNAME(double a, double b, int c, int d); \
602 void base_##CBNAME(double a, double b, int c, int d);
605 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
606 void CLASS::CBNAME(double a, double b, int c, int d) { \
608 wxPyTState* state = wxPyBeginBlockThreads(); \
609 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
610 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
612 wxPyEndBlockThreads(state); \
614 PCLASS::CBNAME(a, b, c, d); \
616 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
617 PCLASS::CBNAME(a, b, c, d); \
620 //---------------------------------------------------------------------------
622 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
623 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
624 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
627 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
628 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
630 wxPyTState* state = wxPyBeginBlockThreads(); \
631 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
632 PyObject* obj = wxPyMake_wxObject(&a); \
633 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
636 wxPyEndBlockThreads(state); \
638 PCLASS::CBNAME(a, b, c, d, e, f); \
640 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
641 PCLASS::CBNAME(a, b, c, d, e, f); \
644 //---------------------------------------------------------------------------
646 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
647 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
648 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
651 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
652 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
654 wxPyTState* state = wxPyBeginBlockThreads(); \
656 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
657 PyObject* obj = wxPyMake_wxObject(&a); \
658 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
661 wxPyEndBlockThreads(state); \
663 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
666 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
667 return PCLASS::CBNAME(a, b, c, d, e, f); \
670 //---------------------------------------------------------------------------
672 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
673 void CBNAME(bool a, double b, double c, int d, int e); \
674 void base_##CBNAME(bool a, double b, double c, int d, int e);
677 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
678 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
680 wxPyTState* state = wxPyBeginBlockThreads(); \
681 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
682 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
684 wxPyEndBlockThreads(state); \
686 PCLASS::CBNAME(a, b, c, d, e); \
688 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
689 PCLASS::CBNAME(a, b, c, d, e); \
692 //---------------------------------------------------------------------------
694 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
695 void CBNAME(wxDC& a, double b, double c, double d, double e); \
696 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
699 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
700 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
702 wxPyTState* state = wxPyBeginBlockThreads(); \
703 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
704 PyObject* obj = wxPyMake_wxObject(&a); \
705 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
708 wxPyEndBlockThreads(state); \
710 PCLASS::CBNAME(a, b, c, d, e); \
712 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
713 PCLASS::CBNAME(a, b, c, d, e); \
716 //---------------------------------------------------------------------------
718 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
719 void CBNAME(wxDC& a, bool b); \
720 void base_##CBNAME(wxDC& a, bool b);
723 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
724 void CLASS::CBNAME(wxDC& a, bool b) { \
726 wxPyTState* state = wxPyBeginBlockThreads(); \
727 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
728 PyObject* obj = wxPyMake_wxObject(&a); \
729 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
732 wxPyEndBlockThreads(state); \
734 PCLASS::CBNAME(a, b); \
736 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
737 PCLASS::CBNAME(a, b); \
740 //---------------------------------------------------------------------------
742 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
743 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
744 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
747 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
748 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
751 wxPyTState* state = wxPyBeginBlockThreads(); \
752 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
753 PyObject* obj = wxPyMake_wxObject(a); \
754 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
757 wxPyEndBlockThreads(state); \
759 PCLASS::CBNAME(a, b, c, d, e, f); \
761 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
763 PCLASS::CBNAME(a, b, c, d, e, f); \
766 //---------------------------------------------------------------------------
768 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
769 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
770 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
773 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
774 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
776 wxPyTState* state = wxPyBeginBlockThreads(); \
777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
778 PyObject* obj = wxPyMake_wxObject(a); \
779 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
782 wxPyEndBlockThreads(state); \
784 PCLASS::CBNAME(a, b, c, d, e); \
786 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
788 PCLASS::CBNAME(a, b, c, d, e); \
791 //---------------------------------------------------------------------------
793 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
794 void CBNAME(double a, double b, int c); \
795 void base_##CBNAME(double a, double b, int c);
798 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
799 void CLASS::CBNAME(double a, double b, int c) { \
801 wxPyTState* state = wxPyBeginBlockThreads(); \
802 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
803 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
804 wxPyEndBlockThreads(state); \
806 PCLASS::CBNAME(a, b, c); \
808 void CLASS::base_##CBNAME(double a, double b, int c) { \
809 PCLASS::CBNAME(a, b, c); \
812 //---------------------------------------------------------------------------
814 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
815 void CBNAME(bool a, double b, double c, int d); \
816 void base_##CBNAME(bool a, double b, double c, int d);
819 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
820 void CLASS::CBNAME(bool a, double b, double c, int d) { \
822 wxPyTState* state = wxPyBeginBlockThreads(); \
823 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
824 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
825 wxPyEndBlockThreads(state); \
827 PCLASS::CBNAME(a, b, c, d); \
829 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
830 PCLASS::CBNAME(a, b, c, d); \
833 //---------------------------------------------------------------------------
834 //---------------------------------------------------------------------------
836 #define DEC_PYCALLBACK__STRING(CBNAME) \
837 void CBNAME(const wxString& a); \
838 void base_##CBNAME(const wxString& a);
841 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
842 void CLASS::CBNAME(const wxString& a) { \
844 wxPyTState* state = wxPyBeginBlockThreads(); \
845 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
846 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
847 wxPyEndBlockThreads(state); \
851 void CLASS::base_##CBNAME(const wxString& a) { \
855 //---------------------------------------------------------------------------
857 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
858 bool CBNAME(const wxString& a); \
859 bool base_##CBNAME(const wxString& a);
862 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
863 bool CLASS::CBNAME(const wxString& a) { \
866 wxPyTState* state = wxPyBeginBlockThreads(); \
867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
868 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str()));\
869 wxPyEndBlockThreads(state); \
871 rval = PCLASS::CBNAME(a); \
874 bool CLASS::base_##CBNAME(const wxString& a) { \
875 return PCLASS::CBNAME(a); \
878 //---------------------------------------------------------------------------
880 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
881 bool CBNAME(const wxString& a);
883 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
884 bool CLASS::CBNAME(const wxString& a) { \
886 wxPyTState* state = wxPyBeginBlockThreads(); \
887 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
888 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(s)", a.c_str())); \
889 wxPyEndBlockThreads(state); \
893 //---------------------------------------------------------------------------
895 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
896 wxString CBNAME(const wxString& a); \
898 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
899 wxString CLASS::CBNAME(const wxString& a) { \
901 wxPyTState* state = wxPyBeginBlockThreads(); \
902 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
904 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(s)", a.c_str()));\
906 PyObject* str = PyObject_Str(ro); \
907 rval = PyString_AsString(str); \
908 Py_DECREF(ro); Py_DECREF(str); \
911 wxPyEndBlockThreads(state); \
915 //---------------------------------------------------------------------------
917 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
918 wxString CBNAME(const wxString& a,int b); \
920 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
921 wxString CLASS::CBNAME(const wxString& a,int b) { \
923 wxPyTState* state = wxPyBeginBlockThreads(); \
924 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
926 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(si)", a.c_str(),b)); \
928 PyObject* str = PyObject_Str(ro); \
929 rval = PyString_AsString(str); \
930 Py_DECREF(ro); Py_DECREF(str); \
933 wxPyEndBlockThreads(state); \
937 //---------------------------------------------------------------------------
939 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
940 bool CBNAME(const wxString& a, const wxString& b); \
941 bool base_##CBNAME(const wxString& a, const wxString& b);
944 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
945 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
948 wxPyTState* state = wxPyBeginBlockThreads(); \
949 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
950 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ss)", \
951 a.c_str(), b.c_str())); \
952 wxPyEndBlockThreads(state); \
954 rval = PCLASS::CBNAME(a, b); \
957 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
958 return PCLASS::CBNAME(a, b); \
961 //---------------------------------------------------------------------------
963 #define DEC_PYCALLBACK_STRING_(CBNAME) \
965 wxString base_##CBNAME();
968 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
969 wxString CLASS::CBNAME() { \
972 wxPyTState* state = wxPyBeginBlockThreads(); \
973 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
975 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
977 PyObject* str = PyObject_Str(ro); \
978 rval = PyString_AsString(str); \
979 Py_DECREF(ro); Py_DECREF(str); \
982 wxPyEndBlockThreads(state); \
984 rval = PCLASS::CBNAME(); \
987 wxString CLASS::base_##CBNAME() { \
988 return PCLASS::CBNAME(); \
991 //---------------------------------------------------------------------------
993 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
997 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
998 wxString CLASS::CBNAME() { \
1000 wxPyTState* state = wxPyBeginBlockThreads(); \
1001 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1003 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1005 PyObject* str = PyObject_Str(ro); \
1006 rval = PyString_AsString(str); \
1007 Py_DECREF(ro); Py_DECREF(str); \
1010 wxPyEndBlockThreads(state); \
1014 //---------------------------------------------------------------------------
1016 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1017 bool CBNAME(const wxHtmlTag& a); \
1020 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1021 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1023 wxPyTState* state = wxPyBeginBlockThreads(); \
1024 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1025 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1026 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1029 wxPyEndBlockThreads(state); \
1033 //---------------------------------------------------------------------------
1035 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1036 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1037 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1039 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1040 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1043 wxPyTState* state = wxPyBeginBlockThreads(); \
1044 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1045 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1046 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1049 wxPyEndBlockThreads(state); \
1051 PCLASS::CBNAME(cell, x, y); \
1053 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1054 PCLASS::CBNAME(cell, x, y); \
1058 //---------------------------------------------------------------------------
1060 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1061 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1062 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1064 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1065 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1067 wxPyTState* state = wxPyBeginBlockThreads(); \
1068 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1069 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1070 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1071 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1075 wxPyEndBlockThreads(state); \
1077 PCLASS::CBNAME(cell, x, y, e); \
1079 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1080 PCLASS::CBNAME(cell, x, y, e); \
1085 //---------------------------------------------------------------------------
1087 #define DEC_PYCALLBACK___pure(CBNAME) \
1091 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1092 void CLASS::CBNAME() { \
1093 wxPyTState* state = wxPyBeginBlockThreads(); \
1094 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1095 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1096 wxPyEndBlockThreads(state); \
1099 //---------------------------------------------------------------------------
1101 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1105 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1106 wxSize CLASS::CBNAME() { \
1108 wxPyTState* state = wxPyBeginBlockThreads(); \
1109 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1112 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1114 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1119 wxPyEndBlockThreads(state); \
1123 //---------------------------------------------------------------------------
1125 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1126 bool CBNAME(wxWindow* a); \
1127 bool base_##CBNAME(wxWindow* a);
1130 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1131 bool CLASS::CBNAME(wxWindow* a) { \
1134 wxPyTState* state = wxPyBeginBlockThreads(); \
1135 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1136 PyObject* obj = wxPyMake_wxObject(a); \
1137 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1140 wxPyEndBlockThreads(state); \
1142 rval = PCLASS::CBNAME(a); \
1145 bool CLASS::base_##CBNAME(wxWindow* a) { \
1146 return PCLASS::CBNAME(a); \
1149 //---------------------------------------------------------------------------
1151 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1153 bool base_##CBNAME();
1156 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1157 bool CLASS::CBNAME() { \
1160 wxPyTState* state = wxPyBeginBlockThreads(); \
1161 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1162 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1163 wxPyEndBlockThreads(state); \
1165 rval = PCLASS::CBNAME(); \
1168 bool CLASS::base_##CBNAME() { \
1169 return PCLASS::CBNAME(); \
1172 //---------------------------------------------------------------------------
1174 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1175 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1176 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1179 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1180 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1183 wxPyTState* state = wxPyBeginBlockThreads(); \
1184 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1185 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1186 wxPyEndBlockThreads(state); \
1188 rval = PCLASS::CBNAME(a, b, c); \
1189 return (wxDragResult)rval; \
1191 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1192 return PCLASS::CBNAME(a, b, c); \
1195 //---------------------------------------------------------------------------
1197 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1198 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1200 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1201 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1202 wxPyTState* state = wxPyBeginBlockThreads(); \
1204 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1206 PyObject* obj = wxPyMake_wxObject(&a); \
1207 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Os)",\
1210 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1215 wxPyEndBlockThreads(state); \
1219 //---------------------------------------------------------------------------
1221 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1222 bool CBNAME(wxDragResult a); \
1223 bool base_##CBNAME(wxDragResult a);
1226 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1227 bool CLASS::CBNAME(wxDragResult a) { \
1230 wxPyTState* state = wxPyBeginBlockThreads(); \
1231 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1232 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1233 wxPyEndBlockThreads(state); \
1235 rval = PCLASS::CBNAME(a); \
1238 bool CLASS::base_##CBNAME(wxDragResult a) { \
1239 return PCLASS::CBNAME(a); \
1242 //---------------------------------------------------------------------------
1244 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1245 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1248 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1249 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1250 wxPyTState* state = wxPyBeginBlockThreads(); \
1252 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1253 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1254 wxPyEndBlockThreads(state); \
1255 return (wxDragResult)rval; \
1258 //---------------------------------------------------------------------------
1260 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1261 bool CBNAME(int a, int b, const wxString& c);
1264 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1265 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1267 wxPyTState* state = wxPyBeginBlockThreads(); \
1268 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1269 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iis)",a,b,c.c_str()));\
1270 wxPyEndBlockThreads(state); \
1274 //---------------------------------------------------------------------------
1276 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1278 size_t base_##CBNAME();
1281 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1282 size_t CLASS::CBNAME() { \
1285 wxPyTState* state = wxPyBeginBlockThreads(); \
1286 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1287 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1288 wxPyEndBlockThreads(state); \
1290 rval = PCLASS::CBNAME(); \
1293 size_t CLASS::base_##CBNAME() { \
1294 return PCLASS::CBNAME(); \
1297 //---------------------------------------------------------------------------
1299 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1300 wxDataFormat CBNAME(size_t a); \
1301 wxDataFormat base_##CBNAME(size_t a);
1304 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1305 wxDataFormat CLASS::CBNAME(size_t a) { \
1306 wxDataFormat rval=0; \
1308 wxPyTState* state = wxPyBeginBlockThreads(); \
1309 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1311 wxDataFormat* ptr; \
1312 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1314 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1319 wxPyEndBlockThreads(state); \
1321 rval = PCLASS::CBNAME(a); \
1324 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1325 return PCLASS::CBNAME(a); \
1328 //---------------------------------------------------------------------------
1330 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1331 void CBNAME(const Type& a); \
1332 void base_##CBNAME(const Type& a);
1335 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1336 void CLASS::CBNAME(const Type& a) { \
1338 wxPyTState* state = wxPyBeginBlockThreads(); \
1339 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1340 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1341 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1344 wxPyEndBlockThreads(state); \
1346 PCLASS::CBNAME(a); \
1348 void CLASS::base_##CBNAME(const Type& a) { \
1349 PCLASS::CBNAME(a); \
1353 //---------------------------------------------------------------------------
1355 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1356 void CBNAME(Type& a); \
1357 void base_##CBNAME(Type& a);
1360 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1361 void CLASS::CBNAME(Type& a) { \
1363 wxPyTState* state = wxPyBeginBlockThreads(); \
1364 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1365 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1366 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1369 wxPyEndBlockThreads(state); \
1371 PCLASS::CBNAME(a); \
1373 void CLASS::base_##CBNAME(Type& a) { \
1374 PCLASS::CBNAME(a); \
1377 //---------------------------------------------------------------------------
1379 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1380 bool CBNAME(Type& a); \
1381 bool base_##CBNAME(Type& a);
1384 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1385 bool CLASS::CBNAME(Type& a) { \
1388 wxPyTState* state = wxPyBeginBlockThreads(); \
1389 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1390 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1391 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1394 wxPyEndBlockThreads(state); \
1396 rv = PCLASS::CBNAME(a); \
1399 bool CLASS::base_##CBNAME(Type& a) { \
1400 return PCLASS::CBNAME(a); \
1403 //---------------------------------------------------------------------------
1405 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1406 wxString CBNAME(long a, long b) const; \
1407 wxString base_##CBNAME(long a, long b)const ;
1410 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1411 wxString CLASS::CBNAME(long a, long b) const { \
1414 wxPyTState* state = wxPyBeginBlockThreads(); \
1415 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1417 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1419 PyObject* str = PyObject_Str(ro); \
1420 rval = PyString_AsString(str); \
1421 Py_DECREF(ro); Py_DECREF(str); \
1424 wxPyEndBlockThreads(state); \
1426 rval = PCLASS::CBNAME(a,b); \
1429 wxString CLASS::base_##CBNAME(long a, long b) const { \
1430 return PCLASS::CBNAME(a,b); \
1433 //---------------------------------------------------------------------------
1435 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1436 int CBNAME(long a) const; \
1437 int base_##CBNAME(long a)const ;
1440 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1441 int CLASS::CBNAME(long a) const { \
1444 wxPyTState* state = wxPyBeginBlockThreads(); \
1445 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1447 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1449 rval = PyInt_AsLong(ro); \
1453 wxPyEndBlockThreads(state); \
1455 rval = PCLASS::CBNAME(a); \
1458 int CLASS::base_##CBNAME(long a) const { \
1459 return PCLASS::CBNAME(a); \
1463 //---------------------------------------------------------------------------
1465 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1466 wxListItemAttr* CBNAME(long a) const; \
1467 wxListItemAttr* base_##CBNAME(long a);
1470 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1471 wxListItemAttr *CLASS::CBNAME(long a) const { \
1472 wxListItemAttr *rval = NULL; \
1474 wxPyTState* state = wxPyBeginBlockThreads(); \
1475 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1477 wxListItemAttr* ptr; \
1478 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1480 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1485 wxPyEndBlockThreads(state); \
1487 rval = PCLASS::CBNAME(a); \
1490 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1491 return PCLASS::CBNAME(a); \
1494 //---------------------------------------------------------------------------
1496 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1497 bool CBNAME(wxMouseEvent& e); \
1498 bool base_##CBNAME(wxMouseEvent& e);
1500 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1501 bool CLASS::CBNAME(wxMouseEvent& e) { \
1504 wxPyTState* state = wxPyBeginBlockThreads(); \
1505 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1507 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1508 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1510 rval = PyInt_AsLong(ro); \
1515 wxPyEndBlockThreads(state); \
1517 return PCLASS::CBNAME(e); \
1520 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1521 return PCLASS::CBNAME(e); \
1525 //---------------------------------------------------------------------------