1 ////////////////////////////////////////////////////////////////////////////
3 // Purpose: Helper functions/classes for the wxPython extension module
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef __wxp_helpers__
14 #define __wxp_helpers__
17 #include <wx/geometry.h>
19 //---------------------------------------------------------------------------
21 typedef unsigned char byte
;
23 void __wxPreStart(PyObject
*);
24 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
27 //extern PyObject* wxPython_dict;
28 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
30 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
32 PyObject
* wxPyConstructObject(void* ptr
,
33 const wxString
& className
,
35 PyObject
* wxPyConstructObject(void* ptr
,
36 const wxString
& className
,
40 PyObject
* wx2PyString(const wxString
& src
);
41 wxString
Py2wxString(PyObject
* source
);
43 PyObject
* wxPyClassExists(const wxString
& className
);
44 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=TRUE
);
45 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
46 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
48 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
49 long wxPyGetWinHandle(wxWindow
* win
);
51 void wxPy_ReinitStockObjects();
54 //----------------------------------------------------------------------
56 // if we want to handle threads and Python threads are available...
57 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
58 #define WXP_WITH_THREAD
59 #else // no Python threads...
60 #undef WXP_WITH_THREAD
65 PyThreadState
* wxPyBeginAllowThreads();
66 void wxPyEndAllowThreads(PyThreadState
* state
);
69 void wxPyBeginBlockThreads();
70 void wxPyEndBlockThreads();
72 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
74 //----------------------------------------------------------------------
75 // These are helpers used by the typemaps
77 wxString
* wxString_in_helper(PyObject
* source
);
79 byte
* byte_LIST_helper(PyObject
* source
);
80 int* int_LIST_helper(PyObject
* source
);
81 long* long_LIST_helper(PyObject
* source
);
82 char** string_LIST_helper(PyObject
* source
);
83 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
84 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
85 wxString
* wxString_LIST_helper(PyObject
* source
);
86 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
87 wxPen
** wxPen_LIST_helper(PyObject
* source
);
89 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
90 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
91 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
92 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
93 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
95 bool wxPoint2DDouble_helper(PyObject
* source
, wxPoint2DDouble
** obj
);
98 //----------------------------------------------------------------------
99 // Other helpful stuff
101 #if PYTHON_API_VERSION < 1009
102 #define PySequence_Fast_GET_ITEM(o, i) \
103 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
106 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
107 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
110 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
111 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
113 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
114 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
115 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
117 //----------------------------------------------------------------------
118 // functions used by the DrawXXXList enhancements added to wxDC
120 typedef bool (*wxPyDrawListOp_t
)(wxDC
& dc
, PyObject
* coords
);
121 PyObject
* wxPyDrawXXXList(wxDC
& dc
, wxPyDrawListOp_t doDraw
,
122 PyObject
* pyCoords
, PyObject
* pyPens
, PyObject
* pyBrushes
);
123 bool wxPyDrawXXXPoint(wxDC
& dc
, PyObject
* coords
);
124 bool wxPyDrawXXXLine(wxDC
& dc
, PyObject
* coords
);
125 bool wxPyDrawXXXRectangle(wxDC
& dc
, PyObject
* coords
);
126 bool wxPyDrawXXXEllipse(wxDC
& dc
, PyObject
* coords
);
127 bool wxPyDrawXXXPolygon(wxDC
& dc
, PyObject
* coords
);
129 PyObject
* wxPyDrawTextList(wxDC
& dc
, PyObject
* textList
, PyObject
* pyPoints
,
130 PyObject
* foregroundList
, PyObject
* backgroundList
);
132 //----------------------------------------------------------------------
135 extern "C" void SWIG_MakePtr(char *, void *, char *);
136 extern "C" char *SWIG_GetPtr(char *, void **, char *);
137 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
142 # pragma warning(disable:4800)
143 # pragma warning(disable:4190)
146 //----------------------------------------------------------------------
148 class wxPyCallback
: public wxObject
{
149 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
151 wxPyCallback(PyObject
* func
);
152 wxPyCallback(const wxPyCallback
& other
);
155 void EventThunker(wxEvent
& event
);
160 //---------------------------------------------------------------------------
162 class wxPyTimer
: public wxTimer
{
164 wxPyTimer(PyObject
* callback
);
173 //---------------------------------------------------------------------------
174 //---------------------------------------------------------------------------
175 // These Event classes can be derived from in Python and passed through the
176 // event system without loosing anything. They do this by keeping a reference
177 // to themselves and some special case handling in wxPyCallback::EventThunker.
180 class wxPyEvtSelfRef
{
185 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
186 PyObject
* GetSelf() const;
194 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
195 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
198 wxPyEvent(const wxPyEvent
& evt
);
201 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
205 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
206 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
208 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
209 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
212 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
217 //----------------------------------------------------------------------
218 // Forward decalre a few things used in the exported API
219 class wxPyClientData
;
221 class wxPyOORClientData
;
222 class wxPyCBInputStream
;
224 void wxPyClientData_dtor(wxPyClientData
* self
);
225 void wxPyUserData_dtor(wxPyUserData
* self
);
226 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
227 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
230 //---------------------------------------------------------------------------
231 // Export a C API in a struct. Other modules will be able to load this from
232 // the wxc module and will then have safe access to these functions, even if
233 // in another shared library.
235 class wxPyCallbackHelper
;
238 // Make SunCC happy and make typedef's for these that are extern "C"
239 typedef void (*p_SWIG_MakePtr_t
)(char*, void*, char*);
240 typedef char* (*p_SWIG_GetPtr_t
)(char*, void**, char*);
241 typedef char* (*p_SWIG_GetPtrObj_t
)(PyObject
*, void**, char*);
242 typedef void (*p_SWIG_RegisterMapping_t
)(char*, char*, void *(*cast
)(void *));
243 typedef void (*p_SWIG_addvarlink_t
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
244 typedef PyObject
* (*p_SWIG_newvarlink_t
)(void);
249 p_SWIG_MakePtr_t p_SWIG_MakePtr
;
250 p_SWIG_GetPtr_t p_SWIG_GetPtr
;
251 p_SWIG_GetPtrObj_t p_SWIG_GetPtrObj
;
252 p_SWIG_RegisterMapping_t p_SWIG_RegisterMapping
;
253 p_SWIG_addvarlink_t p_SWIG_addvarlink
;
254 p_SWIG_newvarlink_t p_SWIG_newvarlink
;
256 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
257 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
258 void (*p_wxPyBeginBlockThreads
)();
259 void (*p_wxPyEndBlockThreads
)();
261 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
262 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
264 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
265 wxString (*p_Py2wxString
)(PyObject
* source
);
266 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
268 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
269 int* (*p_int_LIST_helper
)(PyObject
* source
);
270 long* (*p_long_LIST_helper
)(PyObject
* source
);
271 char** (*p_string_LIST_helper
)(PyObject
* source
);
272 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
273 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
274 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
275 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
277 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
278 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
279 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
280 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
281 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
282 bool (*p_wxPoint2DDouble_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
284 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
285 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
286 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
287 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
288 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
290 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
291 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
292 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
293 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
294 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
295 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
297 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
298 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
299 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
301 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
305 #ifdef wxPyUSE_EXPORT
306 // Notice that this is static, not extern. This is by design, each module
307 // needs one, but doesn't have to use it.
308 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
312 //---------------------------------------------------------------------------
315 class wxPyUserData
: public wxObject
{
317 wxPyUserData(PyObject
* obj
) {
323 #ifdef wxPyUSE_EXPORT
324 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
326 wxPyUserData_dtor(this);
333 class wxPyClientData
: public wxClientData
{
335 wxPyClientData(PyObject
* obj
) {
341 #ifdef wxPyUSE_EXPORT
342 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
344 wxPyClientData_dtor(this);
351 class wxPyOORClientData
: public wxPyClientData
{
353 wxPyOORClientData(PyObject
* obj
)
354 : wxPyClientData(obj
) {}
356 ~wxPyOORClientData() {
357 #ifdef wxPyUSE_EXPORT
358 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
360 wxPyOORClientData_dtor(this);
365 //---------------------------------------------------------------------------
366 // This class holds an instance of a Python Shadow Class object and assists
367 // with looking up and invoking Python callback methods from C++ virtual
368 // method redirections. For all classes which have virtuals which should be
369 // overridable in wxPython, a new subclass is created that contains a
370 // wxPyCallbackHelper.
373 class wxPyCallbackHelper
{
375 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
377 wxPyCallbackHelper() {
384 ~wxPyCallbackHelper() {
385 #ifdef wxPyUSE_EXPORT
386 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
388 wxPyCBH_delete(this);
392 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
393 bool findCallback(const char* name
) const;
394 int callCallback(PyObject
* argTuple
) const;
395 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
400 PyObject
* m_lastFound
;
403 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
407 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
408 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
409 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
410 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
411 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
416 //---------------------------------------------------------------------------
418 // This is used in C++ classes that need to be able to make callback to
419 // "overloaded" python methods
422 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
423 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
425 private: wxPyCallbackHelper m_myInst
428 //---------------------------------------------------------------------------
431 wxPYAPP_ASSERT_SUPPRESS
= 1,
432 wxPYAPP_ASSERT_EXCEPTION
= 2,
433 wxPYAPP_ASSERT_DIALOG
= 4,
434 wxPYAPP_ASSERT_LOG
= 8
437 class wxPyApp
: public wxApp
439 DECLARE_ABSTRACT_CLASS(wxPyApp
);
447 int GetAssertMode() { return m_assertMode
; }
448 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
450 virtual bool OnInitGui();
451 virtual int OnExit();
453 virtual void OnAssert(const wxChar
*file
,
458 // virtual int FilterEvent(wxEvent& event); // This one too????
461 static bool GetMacDefaultEncodingIsPC();
462 static bool GetMacSupportPCMenuShortcuts();
463 static long GetMacAboutMenuItemId();
464 static long GetMacPreferencesMenuItemId();
465 static long GetMacExitMenuItemId();
466 static wxString
GetMacHelpMenuTitleName();
468 static void SetMacDefaultEncodingIsPC(bool val
);
469 static void SetMacSupportPCMenuShortcuts(bool val
);
470 static void SetMacAboutMenuItemId(long val
);
471 static void SetMacPreferencesMenuItemId(long val
);
472 static void SetMacExitMenuItemId(long val
);
473 static void SetMacHelpMenuTitleName(const wxString
& val
);
480 extern wxPyApp
*wxPythonApp
;
483 //----------------------------------------------------------------------
484 // These macros are used to implement the virtual methods that should
485 // redirect to a Python method if one exists. The names designate the
486 // return type, if any, as well as any parameter types.
487 //---------------------------------------------------------------------------
489 #define DEC_PYCALLBACK__(CBNAME) \
494 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
495 void CLASS::CBNAME() { \
497 wxPyBeginBlockThreads(); \
498 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
499 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
500 wxPyEndBlockThreads(); \
504 void CLASS::base_##CBNAME() { \
508 //---------------------------------------------------------------------------
510 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
511 bool CBNAME(int a, int b); \
512 bool base_##CBNAME(int a, int b)
515 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
516 bool CLASS::CBNAME(int a, int b) { \
517 bool rval=FALSE, found; \
518 wxPyBeginBlockThreads(); \
519 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
520 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
521 wxPyEndBlockThreads(); \
523 rval = PCLASS::CBNAME(a,b); \
526 bool CLASS::base_##CBNAME(int a, int b) { \
527 return PCLASS::CBNAME(a,b); \
530 //---------------------------------------------------------------------------
532 #define DEC_PYCALLBACK_VOID_(CBNAME) \
537 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
538 void CLASS::CBNAME() { \
540 wxPyBeginBlockThreads(); \
541 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
542 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
543 wxPyEndBlockThreads(); \
547 void CLASS::base_##CBNAME() { \
551 //---------------------------------------------------------------------------
553 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
554 void CBNAME(int a, int b); \
555 void base_##CBNAME(int a, int b)
558 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
559 void CLASS::CBNAME(int a, int b) { \
561 wxPyBeginBlockThreads(); \
562 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
563 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
564 wxPyEndBlockThreads(); \
566 PCLASS::CBNAME(a,b); \
568 void CLASS::base_##CBNAME(int a, int b) { \
569 PCLASS::CBNAME(a,b); \
572 //---------------------------------------------------------------------------
574 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
575 void CBNAME(int a); \
576 void base_##CBNAME(int a)
579 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
580 void CLASS::CBNAME(int a) { \
582 wxPyBeginBlockThreads(); \
583 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
584 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
585 wxPyEndBlockThreads(); \
589 void CLASS::base_##CBNAME(int a) { \
593 //---------------------------------------------------------------------------
595 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
596 void CBNAME(int a, int b, int c, int d); \
597 void base_##CBNAME(int a, int b, int c, int d)
600 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
601 void CLASS::CBNAME(int a, int b, int c, int d) { \
603 wxPyBeginBlockThreads(); \
604 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
605 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
606 wxPyEndBlockThreads(); \
608 PCLASS::CBNAME(a,b,c,d); \
610 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
611 PCLASS::CBNAME(a,b,c,d); \
614 //---------------------------------------------------------------------------
615 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
616 void CBNAME(int a, int b, int c, int d, int e); \
617 void base_##CBNAME(int a, int b, int c, int d, int e)
620 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
621 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
623 wxPyBeginBlockThreads(); \
624 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
625 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
626 wxPyEndBlockThreads(); \
628 PCLASS::CBNAME(a,b,c,d,e); \
630 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
631 PCLASS::CBNAME(a,b,c,d,e); \
634 //---------------------------------------------------------------------------
636 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
637 void CBNAME(int* a, int* b) const; \
638 void base_##CBNAME(int* a, int* b) const
641 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
642 void CLASS::CBNAME(int* a, int* b) const { \
643 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
645 wxPyBeginBlockThreads(); \
646 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
648 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
650 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
651 PyObject* o1 = PySequence_GetItem(ro, 0); \
652 PyObject* o2 = PySequence_GetItem(ro, 1); \
653 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
654 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
657 PyErr_SetString(PyExc_TypeError, errmsg); \
662 PyErr_SetString(PyExc_TypeError, errmsg); \
667 wxPyEndBlockThreads(); \
669 PCLASS::CBNAME(a,b); \
671 void CLASS::base_##CBNAME(int* a, int* b) const { \
672 PCLASS::CBNAME(a,b); \
676 //---------------------------------------------------------------------------
678 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
679 wxSize CBNAME() const; \
680 wxSize base_##CBNAME() const
683 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
684 wxSize CLASS::CBNAME() const { \
685 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
686 bool found; wxSize rval(0,0); \
687 wxPyBeginBlockThreads(); \
688 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
690 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
692 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
693 PyObject* o1 = PySequence_GetItem(ro, 0); \
694 PyObject* o2 = PySequence_GetItem(ro, 1); \
695 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
696 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
699 PyErr_SetString(PyExc_TypeError, errmsg); \
704 PyErr_SetString(PyExc_TypeError, errmsg); \
709 wxPyEndBlockThreads(); \
711 return PCLASS::CBNAME(); \
715 wxSize CLASS::base_##CBNAME() const { \
716 return PCLASS::CBNAME(); \
720 //---------------------------------------------------------------------------
722 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
723 bool CBNAME(bool a); \
724 bool base_##CBNAME(bool a)
727 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
728 bool CLASS::CBNAME(bool a) { \
729 bool rval=FALSE, found; \
730 wxPyBeginBlockThreads(); \
731 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
732 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
733 wxPyEndBlockThreads(); \
735 rval = PCLASS::CBNAME(a); \
738 bool CLASS::base_##CBNAME(bool a) { \
739 return PCLASS::CBNAME(a); \
742 //---------------------------------------------------------------------------
744 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
745 bool CBNAME(int a); \
746 bool base_##CBNAME(int a)
749 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
750 bool CLASS::CBNAME(int a) { \
751 bool rval=FALSE, found; \
752 wxPyBeginBlockThreads(); \
753 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
754 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
755 wxPyEndBlockThreads(); \
757 rval = PCLASS::CBNAME(a); \
760 bool CLASS::base_##CBNAME(int a) { \
761 return PCLASS::CBNAME(a); \
764 //---------------------------------------------------------------------------
766 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
770 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
771 bool CLASS::CBNAME(int a) { \
773 wxPyBeginBlockThreads(); \
774 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
775 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
777 wxPyEndBlockThreads(); \
782 //---------------------------------------------------------------------------
784 #define DEC_PYCALLBACK__DC(CBNAME) \
785 void CBNAME(wxDC& a); \
786 void base_##CBNAME(wxDC& a)
789 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
790 void CLASS::CBNAME(wxDC& a) { \
792 wxPyBeginBlockThreads(); \
793 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
794 PyObject* obj = wxPyMake_wxObject(&a); \
795 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
798 wxPyEndBlockThreads(); \
802 void CLASS::base_##CBNAME(wxDC& a) { \
808 //---------------------------------------------------------------------------
810 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
811 void CBNAME(wxDC& a, bool b); \
812 void base_##CBNAME(wxDC& a, bool b)
815 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
816 void CLASS::CBNAME(wxDC& a, bool b) { \
818 wxPyBeginBlockThreads(); \
819 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
820 PyObject* obj = wxPyMake_wxObject(&a); \
821 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
824 wxPyEndBlockThreads(); \
826 PCLASS::CBNAME(a, b); \
828 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
829 PCLASS::CBNAME(a, b); \
832 //---------------------------------------------------------------------------
834 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
835 void CBNAME(wxDC& a, bool b); \
836 void base_##CBNAME(wxDC& a, bool b)
839 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
840 void CLASS::CBNAME(wxDC& a, bool b) { \
842 wxPyBeginBlockThreads(); \
843 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
844 PyObject* obj = wxPyMake_wxObject(&a); \
845 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
848 wxPyEndBlockThreads(); \
850 PCLASS::CBNAME(a, b); \
852 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
853 PCLASS::CBNAME(a, b); \
856 //---------------------------------------------------------------------------
858 #define DEC_PYCALLBACK__2DBL(CBNAME) \
859 void CBNAME(double a, double b); \
860 void base_##CBNAME(double a, double b)
863 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
864 void CLASS::CBNAME(double a, double b) { \
866 wxPyBeginBlockThreads(); \
867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
868 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
869 wxPyEndBlockThreads(); \
871 PCLASS::CBNAME(a, b); \
873 void CLASS::base_##CBNAME(double a, double b) { \
874 PCLASS::CBNAME(a, b); \
877 //---------------------------------------------------------------------------
879 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
880 void CBNAME(double a, double b, int c, int d); \
881 void base_##CBNAME(double a, double b, int c, int d)
884 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
885 void CLASS::CBNAME(double a, double b, int c, int d) { \
887 wxPyBeginBlockThreads(); \
888 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
889 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
891 wxPyEndBlockThreads(); \
893 PCLASS::CBNAME(a, b, c, d); \
895 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
896 PCLASS::CBNAME(a, b, c, d); \
899 //---------------------------------------------------------------------------
901 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
902 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
903 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
906 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
907 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
909 wxPyBeginBlockThreads(); \
910 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
911 PyObject* obj = wxPyMake_wxObject(&a); \
912 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
915 wxPyEndBlockThreads(); \
917 PCLASS::CBNAME(a, b, c, d, e, f); \
919 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
920 PCLASS::CBNAME(a, b, c, d, e, f); \
923 //---------------------------------------------------------------------------
925 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
926 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
927 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
930 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
931 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
933 wxPyBeginBlockThreads(); \
935 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
936 PyObject* obj = wxPyMake_wxObject(&a); \
937 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
940 wxPyEndBlockThreads(); \
942 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
945 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
946 return PCLASS::CBNAME(a, b, c, d, e, f); \
949 //---------------------------------------------------------------------------
951 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
952 void CBNAME(bool a, double b, double c, int d, int e); \
953 void base_##CBNAME(bool a, double b, double c, int d, int e)
956 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
957 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
959 wxPyBeginBlockThreads(); \
960 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
961 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
963 wxPyEndBlockThreads(); \
965 PCLASS::CBNAME(a, b, c, d, e); \
967 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
968 PCLASS::CBNAME(a, b, c, d, e); \
971 //---------------------------------------------------------------------------
973 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
974 void CBNAME(wxDC& a, double b, double c, double d, double e); \
975 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
978 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
979 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
981 wxPyBeginBlockThreads(); \
982 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
983 PyObject* obj = wxPyMake_wxObject(&a); \
984 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
987 wxPyEndBlockThreads(); \
989 PCLASS::CBNAME(a, b, c, d, e); \
991 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
992 PCLASS::CBNAME(a, b, c, d, e); \
995 //---------------------------------------------------------------------------
997 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
998 void CBNAME(wxDC& a, bool b); \
999 void base_##CBNAME(wxDC& a, bool b)
1002 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1003 void CLASS::CBNAME(wxDC& a, bool b) { \
1005 wxPyBeginBlockThreads(); \
1006 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1007 PyObject* obj = wxPyMake_wxObject(&a); \
1008 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1011 wxPyEndBlockThreads(); \
1013 PCLASS::CBNAME(a, b); \
1015 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1016 PCLASS::CBNAME(a, b); \
1019 //---------------------------------------------------------------------------
1021 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1022 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1023 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1026 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1027 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1030 wxPyBeginBlockThreads(); \
1031 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1032 PyObject* obj = wxPyMake_wxObject(a); \
1033 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1036 wxPyEndBlockThreads(); \
1038 PCLASS::CBNAME(a, b, c, d, e, f); \
1040 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1042 PCLASS::CBNAME(a, b, c, d, e, f); \
1045 //---------------------------------------------------------------------------
1047 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1048 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1049 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1052 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1053 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1055 wxPyBeginBlockThreads(); \
1056 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1057 PyObject* obj = wxPyMake_wxObject(a); \
1058 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1061 wxPyEndBlockThreads(); \
1063 PCLASS::CBNAME(a, b, c, d, e); \
1065 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1067 PCLASS::CBNAME(a, b, c, d, e); \
1070 //---------------------------------------------------------------------------
1072 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1073 void CBNAME(double a, double b, int c); \
1074 void base_##CBNAME(double a, double b, int c)
1077 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1078 void CLASS::CBNAME(double a, double b, int c) { \
1080 wxPyBeginBlockThreads(); \
1081 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1082 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1083 wxPyEndBlockThreads(); \
1085 PCLASS::CBNAME(a, b, c); \
1087 void CLASS::base_##CBNAME(double a, double b, int c) { \
1088 PCLASS::CBNAME(a, b, c); \
1091 //---------------------------------------------------------------------------
1093 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1094 void CBNAME(bool a, double b, double c, int d); \
1095 void base_##CBNAME(bool a, double b, double c, int d)
1098 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1099 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1101 wxPyBeginBlockThreads(); \
1102 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1103 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1104 wxPyEndBlockThreads(); \
1106 PCLASS::CBNAME(a, b, c, d); \
1108 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1109 PCLASS::CBNAME(a, b, c, d); \
1112 //---------------------------------------------------------------------------
1113 //---------------------------------------------------------------------------
1115 #define DEC_PYCALLBACK__STRING(CBNAME) \
1116 void CBNAME(const wxString& a); \
1117 void base_##CBNAME(const wxString& a)
1119 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1120 void CLASS::CBNAME(const wxString& a) { \
1122 wxPyBeginBlockThreads(); \
1123 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1124 PyObject* s = wx2PyString(a); \
1125 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1128 wxPyEndBlockThreads(); \
1130 PCLASS::CBNAME(a); \
1132 void CLASS::base_##CBNAME(const wxString& a) { \
1133 PCLASS::CBNAME(a); \
1136 //---------------------------------------------------------------------------
1138 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1139 bool CBNAME(const wxString& a); \
1140 bool base_##CBNAME(const wxString& a)
1142 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1143 bool CLASS::CBNAME(const wxString& a) { \
1146 wxPyBeginBlockThreads(); \
1147 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1148 PyObject* s = wx2PyString(a); \
1149 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1152 wxPyEndBlockThreads(); \
1154 rval = PCLASS::CBNAME(a); \
1157 bool CLASS::base_##CBNAME(const wxString& a) { \
1158 return PCLASS::CBNAME(a); \
1161 //---------------------------------------------------------------------------
1163 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1164 bool CBNAME(const wxString& a)
1166 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1167 bool CLASS::CBNAME(const wxString& a) { \
1169 wxPyBeginBlockThreads(); \
1170 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1171 PyObject* s = wx2PyString(a); \
1172 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1175 wxPyEndBlockThreads(); \
1179 //---------------------------------------------------------------------------
1181 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1182 wxString CBNAME(const wxString& a)
1184 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1185 wxString CLASS::CBNAME(const wxString& a) { \
1187 wxPyBeginBlockThreads(); \
1188 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1190 PyObject* s = wx2PyString(a); \
1191 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1194 rval = Py2wxString(ro); \
1198 wxPyEndBlockThreads(); \
1202 //---------------------------------------------------------------------------
1204 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1205 wxString CBNAME(const wxString& a); \
1206 wxString base_##CBNAME(const wxString& a)
1208 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1209 wxString CLASS::CBNAME(const wxString& a) { \
1212 wxPyBeginBlockThreads(); \
1213 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1215 PyObject* s = wx2PyString(a); \
1216 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1219 rval = Py2wxString(ro); \
1224 rval = PCLASS::CBNAME(a); \
1225 wxPyEndBlockThreads(); \
1229 //---------------------------------------------------------------------------
1231 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1232 wxString CBNAME(const wxString& a,int b)
1234 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1235 wxString CLASS::CBNAME(const wxString& a,int b) { \
1237 wxPyBeginBlockThreads(); \
1238 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1240 PyObject* s = wx2PyString(a); \
1241 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1244 rval = Py2wxString(ro); \
1248 wxPyEndBlockThreads(); \
1252 //---------------------------------------------------------------------------
1254 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1255 bool CBNAME(const wxString& a, const wxString& b); \
1256 bool base_##CBNAME(const wxString& a, const wxString& b)
1258 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1259 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1262 wxPyBeginBlockThreads(); \
1263 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1264 PyObject* s1 = wx2PyString(a); \
1265 PyObject* s2 = wx2PyString(b); \
1266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1270 wxPyEndBlockThreads(); \
1272 rval = PCLASS::CBNAME(a, b); \
1275 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1276 return PCLASS::CBNAME(a, b); \
1279 //---------------------------------------------------------------------------
1281 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1282 wxString CBNAME(); \
1283 wxString base_##CBNAME()
1285 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1286 wxString CLASS::CBNAME() { \
1289 wxPyBeginBlockThreads(); \
1290 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1292 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1294 rval = Py2wxString(ro); \
1298 wxPyEndBlockThreads(); \
1300 rval = PCLASS::CBNAME(); \
1303 wxString CLASS::base_##CBNAME() { \
1304 return PCLASS::CBNAME(); \
1307 //---------------------------------------------------------------------------
1309 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1310 wxString CBNAME() const; \
1311 wxString base_##CBNAME() const;
1313 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1314 wxString CLASS::CBNAME() const { \
1317 wxPyBeginBlockThreads(); \
1318 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1320 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1322 rval = Py2wxString(ro); \
1326 wxPyEndBlockThreads(); \
1328 rval = PCLASS::CBNAME(); \
1331 wxString CLASS::base_##CBNAME() const { \
1332 return PCLASS::CBNAME(); \
1335 //---------------------------------------------------------------------------
1337 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1340 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1341 wxString CLASS::CBNAME() { \
1343 wxPyBeginBlockThreads(); \
1344 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1346 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1348 rval = Py2wxString(ro); \
1352 wxPyEndBlockThreads(); \
1356 //---------------------------------------------------------------------------
1358 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1359 wxString CBNAME() const;
1361 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1362 wxString CLASS::CBNAME() const { \
1364 wxPyBeginBlockThreads(); \
1365 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1367 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1369 rval = Py2wxString(ro); \
1373 wxPyEndBlockThreads(); \
1377 //---------------------------------------------------------------------------
1379 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1380 bool CBNAME(const wxHtmlTag& a)
1383 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1384 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1386 wxPyBeginBlockThreads(); \
1387 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1388 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1389 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1392 wxPyEndBlockThreads(); \
1396 //---------------------------------------------------------------------------
1398 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1399 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1400 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1402 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1403 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1405 wxPyBeginBlockThreads(); \
1406 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1407 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1408 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1411 wxPyEndBlockThreads(); \
1413 PCLASS::CBNAME(cell, x, y); \
1415 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1416 PCLASS::CBNAME(cell, x, y); \
1420 //---------------------------------------------------------------------------
1422 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1423 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1424 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1426 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1427 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1429 wxPyBeginBlockThreads(); \
1430 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1431 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1432 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1433 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1437 wxPyEndBlockThreads(); \
1439 PCLASS::CBNAME(cell, x, y, e); \
1441 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1442 PCLASS::CBNAME(cell, x, y, e); \
1447 //---------------------------------------------------------------------------
1449 #define DEC_PYCALLBACK___pure(CBNAME) \
1453 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1454 void CLASS::CBNAME() { \
1455 wxPyBeginBlockThreads(); \
1456 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1457 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1458 wxPyEndBlockThreads(); \
1461 //---------------------------------------------------------------------------
1463 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1467 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1468 wxSize CLASS::CBNAME() { \
1469 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1471 wxPyBeginBlockThreads(); \
1472 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1475 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1477 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1479 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1480 PyObject* o1 = PySequence_GetItem(ro, 0); \
1481 PyObject* o2 = PySequence_GetItem(ro, 1); \
1482 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1483 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1485 PyErr_SetString(PyExc_TypeError, errmsg); \
1490 PyErr_SetString(PyExc_TypeError, errmsg); \
1495 wxPyEndBlockThreads(); \
1499 //---------------------------------------------------------------------------
1501 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1502 bool CBNAME(wxWindow* a); \
1503 bool base_##CBNAME(wxWindow* a)
1506 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1507 bool CLASS::CBNAME(wxWindow* a) { \
1510 wxPyBeginBlockThreads(); \
1511 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1512 PyObject* obj = wxPyMake_wxObject(a); \
1513 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1516 wxPyEndBlockThreads(); \
1518 rval = PCLASS::CBNAME(a); \
1521 bool CLASS::base_##CBNAME(wxWindow* a) { \
1522 return PCLASS::CBNAME(a); \
1525 //---------------------------------------------------------------------------
1527 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1528 bool CBNAME(wxWindow* a, wxDC& b); \
1529 bool base_##CBNAME(wxWindow* a, wxDC& b)
1532 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1533 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1536 wxPyBeginBlockThreads(); \
1537 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1538 PyObject* win = wxPyMake_wxObject(a); \
1539 PyObject* dc = wxPyMake_wxObject(&b); \
1540 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1544 wxPyEndBlockThreads(); \
1546 rval = PCLASS::CBNAME(a, b); \
1549 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1550 return PCLASS::CBNAME(a, b); \
1553 //---------------------------------------------------------------------------
1555 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1556 void CBNAME(wxWindowBase* a); \
1557 void base_##CBNAME(wxWindowBase* a)
1560 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1561 void CLASS::CBNAME(wxWindowBase* a) { \
1563 wxPyBeginBlockThreads(); \
1564 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1565 PyObject* obj = wxPyMake_wxObject(a); \
1566 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1569 wxPyEndBlockThreads(); \
1571 PCLASS::CBNAME(a); \
1573 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1574 PCLASS::CBNAME(a); \
1577 //---------------------------------------------------------------------------
1579 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1581 bool base_##CBNAME()
1584 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1585 bool CLASS::CBNAME() { \
1588 wxPyBeginBlockThreads(); \
1589 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1590 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1591 wxPyEndBlockThreads(); \
1593 rval = PCLASS::CBNAME(); \
1596 bool CLASS::base_##CBNAME() { \
1597 return PCLASS::CBNAME(); \
1600 //---------------------------------------------------------------------------
1602 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1603 bool CBNAME() const; \
1604 bool base_##CBNAME() const
1607 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1608 bool CLASS::CBNAME() const { \
1611 wxPyBeginBlockThreads(); \
1612 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1613 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1614 wxPyEndBlockThreads(); \
1616 rval = PCLASS::CBNAME(); \
1619 bool CLASS::base_##CBNAME() const { \
1620 return PCLASS::CBNAME(); \
1623 //---------------------------------------------------------------------------
1625 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1626 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1627 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1630 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1631 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1634 wxPyBeginBlockThreads(); \
1635 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1636 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1637 wxPyEndBlockThreads(); \
1639 rval = PCLASS::CBNAME(a, b, c); \
1640 return (wxDragResult)rval; \
1642 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1643 return PCLASS::CBNAME(a, b, c); \
1646 //---------------------------------------------------------------------------
1648 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1649 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1651 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1652 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1653 wxPyBeginBlockThreads(); \
1655 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1657 PyObject* obj = wxPyMake_wxObject(&a); \
1658 PyObject* s = wx2PyString(b); \
1659 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1662 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1668 wxPyEndBlockThreads(); \
1672 //---------------------------------------------------------------------------
1674 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1675 bool CBNAME(wxDragResult a); \
1676 bool base_##CBNAME(wxDragResult a)
1679 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1680 bool CLASS::CBNAME(wxDragResult a) { \
1683 wxPyBeginBlockThreads(); \
1684 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1685 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1686 wxPyEndBlockThreads(); \
1688 rval = PCLASS::CBNAME(a); \
1691 bool CLASS::base_##CBNAME(wxDragResult a) { \
1692 return PCLASS::CBNAME(a); \
1695 //---------------------------------------------------------------------------
1697 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1698 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1701 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1702 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1703 wxPyBeginBlockThreads(); \
1705 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1706 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1707 wxPyEndBlockThreads(); \
1708 return (wxDragResult)rval; \
1711 //---------------------------------------------------------------------------
1713 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1714 bool CBNAME(int a, int b, const wxString& c)
1716 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1717 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1719 wxPyBeginBlockThreads(); \
1720 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1721 PyObject* s = wx2PyString(c); \
1722 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1725 wxPyEndBlockThreads(); \
1729 //---------------------------------------------------------------------------
1731 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1733 size_t base_##CBNAME()
1736 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1737 size_t CLASS::CBNAME() { \
1740 wxPyBeginBlockThreads(); \
1741 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1742 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1743 wxPyEndBlockThreads(); \
1745 rval = PCLASS::CBNAME(); \
1748 size_t CLASS::base_##CBNAME() { \
1749 return PCLASS::CBNAME(); \
1752 //---------------------------------------------------------------------------
1754 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1755 wxDataFormat CBNAME(size_t a); \
1756 wxDataFormat base_##CBNAME(size_t a)
1759 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1760 wxDataFormat CLASS::CBNAME(size_t a) { \
1761 wxDataFormat rval=0; \
1763 wxPyBeginBlockThreads(); \
1764 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1766 wxDataFormat* ptr; \
1767 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1769 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1774 wxPyEndBlockThreads(); \
1776 rval = PCLASS::CBNAME(a); \
1779 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1780 return PCLASS::CBNAME(a); \
1783 //---------------------------------------------------------------------------
1785 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1786 void CBNAME(const Type& a); \
1787 void base_##CBNAME(const Type& a)
1790 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1791 void CLASS::CBNAME(const Type& a) { \
1793 wxPyBeginBlockThreads(); \
1794 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1795 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1796 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1799 wxPyEndBlockThreads(); \
1801 PCLASS::CBNAME(a); \
1803 void CLASS::base_##CBNAME(const Type& a) { \
1804 PCLASS::CBNAME(a); \
1808 //---------------------------------------------------------------------------
1810 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1811 void CBNAME(Type& a); \
1812 void base_##CBNAME(Type& a)
1815 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1816 void CLASS::CBNAME(Type& a) { \
1818 wxPyBeginBlockThreads(); \
1819 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1820 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1821 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1824 wxPyEndBlockThreads(); \
1826 PCLASS::CBNAME(a); \
1828 void CLASS::base_##CBNAME(Type& a) { \
1829 PCLASS::CBNAME(a); \
1832 //---------------------------------------------------------------------------
1834 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1835 bool CBNAME(Type& a); \
1836 bool base_##CBNAME(Type& a)
1839 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1840 bool CLASS::CBNAME(Type& a) { \
1843 wxPyBeginBlockThreads(); \
1844 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1845 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1846 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1849 wxPyEndBlockThreads(); \
1851 rv = PCLASS::CBNAME(a); \
1854 bool CLASS::base_##CBNAME(Type& a) { \
1855 return PCLASS::CBNAME(a); \
1858 //---------------------------------------------------------------------------
1860 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1861 bool CBNAME(Type& a)
1864 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1865 bool CLASS::CBNAME(Type& a) { \
1867 wxPyBeginBlockThreads(); \
1868 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1869 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1870 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1873 wxPyEndBlockThreads(); \
1877 //---------------------------------------------------------------------------
1879 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1880 wxString CBNAME(long a, long b) const; \
1881 wxString base_##CBNAME(long a, long b) const
1883 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1884 wxString CLASS::CBNAME(long a, long b) const { \
1887 wxPyBeginBlockThreads(); \
1888 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1890 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1892 rval = Py2wxString(ro); \
1896 wxPyEndBlockThreads(); \
1898 rval = PCLASS::CBNAME(a,b); \
1901 wxString CLASS::base_##CBNAME(long a, long b) const { \
1902 return PCLASS::CBNAME(a,b); \
1905 //---------------------------------------------------------------------------
1907 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1908 int CBNAME(long a) const; \
1909 int base_##CBNAME(long a) const
1912 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1913 int CLASS::CBNAME(long a) const { \
1916 wxPyBeginBlockThreads(); \
1917 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1919 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1921 rval = PyInt_AsLong(ro); \
1925 wxPyEndBlockThreads(); \
1927 rval = PCLASS::CBNAME(a); \
1930 int CLASS::base_##CBNAME(long a) const { \
1931 return PCLASS::CBNAME(a); \
1935 //---------------------------------------------------------------------------
1937 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1938 wxListItemAttr* CBNAME(long a) const; \
1939 wxListItemAttr* base_##CBNAME(long a) const
1942 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1943 wxListItemAttr *CLASS::CBNAME(long a) const { \
1944 wxListItemAttr *rval = NULL; \
1946 wxPyBeginBlockThreads(); \
1947 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1949 wxListItemAttr* ptr; \
1950 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1952 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1957 wxPyEndBlockThreads(); \
1959 rval = PCLASS::CBNAME(a); \
1962 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
1963 return PCLASS::CBNAME(a); \
1966 //---------------------------------------------------------------------------
1968 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1969 bool CBNAME(wxMouseEvent& e); \
1970 bool base_##CBNAME(wxMouseEvent& e)
1972 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1973 bool CLASS::CBNAME(wxMouseEvent& e) { \
1976 wxPyBeginBlockThreads(); \
1977 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1979 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1980 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1982 rval = PyInt_AsLong(ro); \
1987 wxPyEndBlockThreads(); \
1989 return PCLASS::CBNAME(e); \
1992 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1993 return PCLASS::CBNAME(e); \
1997 //---------------------------------------------------------------------------
1999 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2000 wxWizardPage* CBNAME() const
2002 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2003 wxWizardPage* CLASS::CBNAME() const { \
2004 wxWizardPage* rv = NULL; \
2005 wxPyBeginBlockThreads(); \
2006 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2008 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2010 SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
2014 wxPyEndBlockThreads(); \
2018 //---------------------------------------------------------------------------
2020 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2021 wxBitmap CBNAME() const
2023 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2024 wxBitmap CLASS::CBNAME() const { \
2026 wxPyBeginBlockThreads(); \
2027 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2030 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2032 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
2037 wxPyEndBlockThreads(); \
2041 //---------------------------------------------------------------------------
2043 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2046 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2047 wxObject* CLASS::CBNAME() { \
2048 wxObject* rv = NULL; \
2049 wxPyBeginBlockThreads(); \
2050 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2052 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2054 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2058 wxPyEndBlockThreads(); \
2062 //---------------------------------------------------------------------------
2064 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2065 wxObject* CBNAME(const wxString& a)
2067 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2068 wxObject* CLASS::CBNAME(const wxString& a) { \
2069 wxObject* rv = NULL; \
2070 wxPyBeginBlockThreads(); \
2071 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2072 PyObject* so = wx2PyString(a); \
2074 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2076 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2081 wxPyEndBlockThreads(); \
2085 //---------------------------------------------------------------------------
2087 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2088 bool CBNAME(wxXmlNode* a)
2091 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2092 bool CLASS::CBNAME(wxXmlNode* a) { \
2094 wxPyBeginBlockThreads(); \
2095 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2096 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2097 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2100 wxPyEndBlockThreads(); \
2104 //---------------------------------------------------------------------------