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;
187 bool GetCloned() const { return m_cloned
; }
195 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
196 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
198 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
199 wxPyEvent(const wxPyEvent
& evt
);
202 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
206 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
207 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
209 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
210 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
213 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
218 //----------------------------------------------------------------------
219 // Forward decalre a few things used in the exported API
220 class wxPyClientData
;
222 class wxPyOORClientData
;
223 class wxPyCBInputStream
;
225 void wxPyClientData_dtor(wxPyClientData
* self
);
226 void wxPyUserData_dtor(wxPyUserData
* self
);
227 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
228 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
231 //---------------------------------------------------------------------------
232 // Export a C API in a struct. Other modules will be able to load this from
233 // the wxc module and will then have safe access to these functions, even if
234 // in another shared library.
236 class wxPyCallbackHelper
;
239 // Make SunCC happy and make typedef's for these that are extern "C"
240 typedef void (*p_SWIG_MakePtr_t
)(char*, void*, char*);
241 typedef char* (*p_SWIG_GetPtr_t
)(char*, void**, char*);
242 typedef char* (*p_SWIG_GetPtrObj_t
)(PyObject
*, void**, char*);
243 typedef void (*p_SWIG_RegisterMapping_t
)(char*, char*, void *(*cast
)(void *));
244 typedef void (*p_SWIG_addvarlink_t
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
245 typedef PyObject
* (*p_SWIG_newvarlink_t
)(void);
250 p_SWIG_MakePtr_t p_SWIG_MakePtr
;
251 p_SWIG_GetPtr_t p_SWIG_GetPtr
;
252 p_SWIG_GetPtrObj_t p_SWIG_GetPtrObj
;
253 p_SWIG_RegisterMapping_t p_SWIG_RegisterMapping
;
254 p_SWIG_addvarlink_t p_SWIG_addvarlink
;
255 p_SWIG_newvarlink_t p_SWIG_newvarlink
;
257 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
258 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
259 void (*p_wxPyBeginBlockThreads
)();
260 void (*p_wxPyEndBlockThreads
)();
262 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
263 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
265 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
266 wxString (*p_Py2wxString
)(PyObject
* source
);
267 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
269 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
270 int* (*p_int_LIST_helper
)(PyObject
* source
);
271 long* (*p_long_LIST_helper
)(PyObject
* source
);
272 char** (*p_string_LIST_helper
)(PyObject
* source
);
273 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
274 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
275 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
276 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
278 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
279 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
280 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
281 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
282 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
283 bool (*p_wxPoint2DDouble_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
285 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
286 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
287 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
288 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
289 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
291 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
292 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
293 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
294 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
295 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
296 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
298 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
299 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
300 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
302 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
306 #ifdef wxPyUSE_EXPORT
307 // Notice that this is static, not extern. This is by design, each module
308 // needs one, but doesn't have to use it.
309 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
313 //---------------------------------------------------------------------------
316 class wxPyUserData
: public wxObject
{
318 wxPyUserData(PyObject
* obj
) {
324 #ifdef wxPyUSE_EXPORT
325 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
327 wxPyUserData_dtor(this);
334 class wxPyClientData
: public wxClientData
{
336 wxPyClientData(PyObject
* obj
) {
342 #ifdef wxPyUSE_EXPORT
343 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
345 wxPyClientData_dtor(this);
352 class wxPyOORClientData
: public wxPyClientData
{
354 wxPyOORClientData(PyObject
* obj
)
355 : wxPyClientData(obj
) {}
357 ~wxPyOORClientData() {
358 #ifdef wxPyUSE_EXPORT
359 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
361 wxPyOORClientData_dtor(this);
366 //---------------------------------------------------------------------------
367 // This class holds an instance of a Python Shadow Class object and assists
368 // with looking up and invoking Python callback methods from C++ virtual
369 // method redirections. For all classes which have virtuals which should be
370 // overridable in wxPython, a new subclass is created that contains a
371 // wxPyCallbackHelper.
374 class wxPyCallbackHelper
{
376 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
378 wxPyCallbackHelper() {
385 ~wxPyCallbackHelper() {
386 #ifdef wxPyUSE_EXPORT
387 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
389 wxPyCBH_delete(this);
393 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
394 bool findCallback(const char* name
) const;
395 int callCallback(PyObject
* argTuple
) const;
396 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
401 PyObject
* m_lastFound
;
404 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
408 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
409 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
410 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
411 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
412 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
417 //---------------------------------------------------------------------------
419 // This is used in C++ classes that need to be able to make callback to
420 // "overloaded" python methods
423 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
424 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
426 private: wxPyCallbackHelper m_myInst
429 //---------------------------------------------------------------------------
432 wxPYAPP_ASSERT_SUPPRESS
= 1,
433 wxPYAPP_ASSERT_EXCEPTION
= 2,
434 wxPYAPP_ASSERT_DIALOG
= 4,
435 wxPYAPP_ASSERT_LOG
= 8
438 class wxPyApp
: public wxApp
440 DECLARE_ABSTRACT_CLASS(wxPyApp
);
448 int GetAssertMode() { return m_assertMode
; }
449 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
451 virtual bool OnInitGui();
452 virtual int OnExit();
454 virtual void OnAssert(const wxChar
*file
,
459 // virtual int FilterEvent(wxEvent& event); // This one too????
462 static bool GetMacDefaultEncodingIsPC();
463 static bool GetMacSupportPCMenuShortcuts();
464 static long GetMacAboutMenuItemId();
465 static long GetMacPreferencesMenuItemId();
466 static long GetMacExitMenuItemId();
467 static wxString
GetMacHelpMenuTitleName();
469 static void SetMacDefaultEncodingIsPC(bool val
);
470 static void SetMacSupportPCMenuShortcuts(bool val
);
471 static void SetMacAboutMenuItemId(long val
);
472 static void SetMacPreferencesMenuItemId(long val
);
473 static void SetMacExitMenuItemId(long val
);
474 static void SetMacHelpMenuTitleName(const wxString
& val
);
481 extern wxPyApp
*wxPythonApp
;
484 //----------------------------------------------------------------------
485 // These macros are used to implement the virtual methods that should
486 // redirect to a Python method if one exists. The names designate the
487 // return type, if any, as well as any parameter types.
488 //---------------------------------------------------------------------------
490 #define DEC_PYCALLBACK__(CBNAME) \
495 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
496 void CLASS::CBNAME() { \
498 wxPyBeginBlockThreads(); \
499 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
500 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
501 wxPyEndBlockThreads(); \
505 void CLASS::base_##CBNAME() { \
509 //---------------------------------------------------------------------------
511 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
512 bool CBNAME(int a, int b); \
513 bool base_##CBNAME(int a, int b)
516 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
517 bool CLASS::CBNAME(int a, int b) { \
518 bool rval=FALSE, found; \
519 wxPyBeginBlockThreads(); \
520 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
521 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
522 wxPyEndBlockThreads(); \
524 rval = PCLASS::CBNAME(a,b); \
527 bool CLASS::base_##CBNAME(int a, int b) { \
528 return PCLASS::CBNAME(a,b); \
531 //---------------------------------------------------------------------------
533 #define DEC_PYCALLBACK_VOID_(CBNAME) \
538 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
539 void CLASS::CBNAME() { \
541 wxPyBeginBlockThreads(); \
542 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
543 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
544 wxPyEndBlockThreads(); \
548 void CLASS::base_##CBNAME() { \
552 //---------------------------------------------------------------------------
554 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
555 void CBNAME(int a, int b); \
556 void base_##CBNAME(int a, int b)
559 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
560 void CLASS::CBNAME(int a, int b) { \
562 wxPyBeginBlockThreads(); \
563 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
564 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
565 wxPyEndBlockThreads(); \
567 PCLASS::CBNAME(a,b); \
569 void CLASS::base_##CBNAME(int a, int b) { \
570 PCLASS::CBNAME(a,b); \
573 //---------------------------------------------------------------------------
575 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
576 void CBNAME(int a); \
577 void base_##CBNAME(int a)
580 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
581 void CLASS::CBNAME(int a) { \
583 wxPyBeginBlockThreads(); \
584 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
585 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
586 wxPyEndBlockThreads(); \
590 void CLASS::base_##CBNAME(int a) { \
594 //---------------------------------------------------------------------------
596 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
597 void CBNAME(int a, int b, int c, int d); \
598 void base_##CBNAME(int a, int b, int c, int d)
601 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
602 void CLASS::CBNAME(int a, int b, int c, int d) { \
604 wxPyBeginBlockThreads(); \
605 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
606 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
607 wxPyEndBlockThreads(); \
609 PCLASS::CBNAME(a,b,c,d); \
611 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
612 PCLASS::CBNAME(a,b,c,d); \
615 //---------------------------------------------------------------------------
616 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
617 void CBNAME(int a, int b, int c, int d, int e); \
618 void base_##CBNAME(int a, int b, int c, int d, int e)
621 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
622 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
624 wxPyBeginBlockThreads(); \
625 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
626 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
627 wxPyEndBlockThreads(); \
629 PCLASS::CBNAME(a,b,c,d,e); \
631 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
632 PCLASS::CBNAME(a,b,c,d,e); \
635 //---------------------------------------------------------------------------
637 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
638 void CBNAME(int* a, int* b) const; \
639 void base_##CBNAME(int* a, int* b) const
642 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
643 void CLASS::CBNAME(int* a, int* b) const { \
644 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
646 wxPyBeginBlockThreads(); \
647 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
649 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
651 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
652 PyObject* o1 = PySequence_GetItem(ro, 0); \
653 PyObject* o2 = PySequence_GetItem(ro, 1); \
654 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
655 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
658 PyErr_SetString(PyExc_TypeError, errmsg); \
663 PyErr_SetString(PyExc_TypeError, errmsg); \
668 wxPyEndBlockThreads(); \
670 PCLASS::CBNAME(a,b); \
672 void CLASS::base_##CBNAME(int* a, int* b) const { \
673 PCLASS::CBNAME(a,b); \
677 //---------------------------------------------------------------------------
679 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
680 wxSize CBNAME() const; \
681 wxSize base_##CBNAME() const
684 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
685 wxSize CLASS::CBNAME() const { \
686 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
687 bool found; wxSize rval(0,0); \
688 wxPyBeginBlockThreads(); \
689 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
691 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
693 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
694 PyObject* o1 = PySequence_GetItem(ro, 0); \
695 PyObject* o2 = PySequence_GetItem(ro, 1); \
696 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
697 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
700 PyErr_SetString(PyExc_TypeError, errmsg); \
705 PyErr_SetString(PyExc_TypeError, errmsg); \
710 wxPyEndBlockThreads(); \
712 return PCLASS::CBNAME(); \
716 wxSize CLASS::base_##CBNAME() const { \
717 return PCLASS::CBNAME(); \
721 //---------------------------------------------------------------------------
723 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
724 bool CBNAME(bool a); \
725 bool base_##CBNAME(bool a)
728 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
729 bool CLASS::CBNAME(bool a) { \
730 bool rval=FALSE, found; \
731 wxPyBeginBlockThreads(); \
732 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
733 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
734 wxPyEndBlockThreads(); \
736 rval = PCLASS::CBNAME(a); \
739 bool CLASS::base_##CBNAME(bool a) { \
740 return PCLASS::CBNAME(a); \
743 //---------------------------------------------------------------------------
745 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
746 bool CBNAME(int a); \
747 bool base_##CBNAME(int a)
750 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
751 bool CLASS::CBNAME(int a) { \
752 bool rval=FALSE, found; \
753 wxPyBeginBlockThreads(); \
754 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
755 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
756 wxPyEndBlockThreads(); \
758 rval = PCLASS::CBNAME(a); \
761 bool CLASS::base_##CBNAME(int a) { \
762 return PCLASS::CBNAME(a); \
765 //---------------------------------------------------------------------------
767 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
771 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
772 bool CLASS::CBNAME(int a) { \
774 wxPyBeginBlockThreads(); \
775 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
776 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
778 wxPyEndBlockThreads(); \
783 //---------------------------------------------------------------------------
785 #define DEC_PYCALLBACK__DC(CBNAME) \
786 void CBNAME(wxDC& a); \
787 void base_##CBNAME(wxDC& a)
790 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
791 void CLASS::CBNAME(wxDC& a) { \
793 wxPyBeginBlockThreads(); \
794 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
795 PyObject* obj = wxPyMake_wxObject(&a); \
796 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
799 wxPyEndBlockThreads(); \
803 void CLASS::base_##CBNAME(wxDC& a) { \
809 //---------------------------------------------------------------------------
811 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
812 void CBNAME(wxDC& a, bool b); \
813 void base_##CBNAME(wxDC& a, bool b)
816 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
817 void CLASS::CBNAME(wxDC& a, bool b) { \
819 wxPyBeginBlockThreads(); \
820 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
821 PyObject* obj = wxPyMake_wxObject(&a); \
822 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
825 wxPyEndBlockThreads(); \
827 PCLASS::CBNAME(a, b); \
829 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
830 PCLASS::CBNAME(a, b); \
833 //---------------------------------------------------------------------------
835 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
836 void CBNAME(wxDC& a, bool b); \
837 void base_##CBNAME(wxDC& a, bool b)
840 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
841 void CLASS::CBNAME(wxDC& a, bool b) { \
843 wxPyBeginBlockThreads(); \
844 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
845 PyObject* obj = wxPyMake_wxObject(&a); \
846 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
849 wxPyEndBlockThreads(); \
851 PCLASS::CBNAME(a, b); \
853 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
854 PCLASS::CBNAME(a, b); \
857 //---------------------------------------------------------------------------
859 #define DEC_PYCALLBACK__2DBL(CBNAME) \
860 void CBNAME(double a, double b); \
861 void base_##CBNAME(double a, double b)
864 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
865 void CLASS::CBNAME(double a, double b) { \
867 wxPyBeginBlockThreads(); \
868 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
869 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
870 wxPyEndBlockThreads(); \
872 PCLASS::CBNAME(a, b); \
874 void CLASS::base_##CBNAME(double a, double b) { \
875 PCLASS::CBNAME(a, b); \
878 //---------------------------------------------------------------------------
880 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
881 void CBNAME(double a, double b, int c, int d); \
882 void base_##CBNAME(double a, double b, int c, int d)
885 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
886 void CLASS::CBNAME(double a, double b, int c, int d) { \
888 wxPyBeginBlockThreads(); \
889 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
890 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
892 wxPyEndBlockThreads(); \
894 PCLASS::CBNAME(a, b, c, d); \
896 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
897 PCLASS::CBNAME(a, b, c, d); \
900 //---------------------------------------------------------------------------
902 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
903 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
904 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
907 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
908 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
910 wxPyBeginBlockThreads(); \
911 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
912 PyObject* obj = wxPyMake_wxObject(&a); \
913 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
916 wxPyEndBlockThreads(); \
918 PCLASS::CBNAME(a, b, c, d, e, f); \
920 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
921 PCLASS::CBNAME(a, b, c, d, e, f); \
924 //---------------------------------------------------------------------------
926 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
927 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
928 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
931 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
932 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
934 wxPyBeginBlockThreads(); \
936 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
937 PyObject* obj = wxPyMake_wxObject(&a); \
938 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
941 wxPyEndBlockThreads(); \
943 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
946 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
947 return PCLASS::CBNAME(a, b, c, d, e, f); \
950 //---------------------------------------------------------------------------
952 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
953 void CBNAME(bool a, double b, double c, int d, int e); \
954 void base_##CBNAME(bool a, double b, double c, int d, int e)
957 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
958 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
960 wxPyBeginBlockThreads(); \
961 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
962 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
964 wxPyEndBlockThreads(); \
966 PCLASS::CBNAME(a, b, c, d, e); \
968 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
969 PCLASS::CBNAME(a, b, c, d, e); \
972 //---------------------------------------------------------------------------
974 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
975 void CBNAME(wxDC& a, double b, double c, double d, double e); \
976 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
979 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
980 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
982 wxPyBeginBlockThreads(); \
983 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
984 PyObject* obj = wxPyMake_wxObject(&a); \
985 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
988 wxPyEndBlockThreads(); \
990 PCLASS::CBNAME(a, b, c, d, e); \
992 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
993 PCLASS::CBNAME(a, b, c, d, e); \
996 //---------------------------------------------------------------------------
998 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
999 void CBNAME(wxDC& a, bool b); \
1000 void base_##CBNAME(wxDC& a, bool b)
1003 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1004 void CLASS::CBNAME(wxDC& a, bool b) { \
1006 wxPyBeginBlockThreads(); \
1007 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1008 PyObject* obj = wxPyMake_wxObject(&a); \
1009 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1012 wxPyEndBlockThreads(); \
1014 PCLASS::CBNAME(a, b); \
1016 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1017 PCLASS::CBNAME(a, b); \
1020 //---------------------------------------------------------------------------
1022 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1023 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1024 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1027 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1028 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1031 wxPyBeginBlockThreads(); \
1032 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1033 PyObject* obj = wxPyMake_wxObject(a); \
1034 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1037 wxPyEndBlockThreads(); \
1039 PCLASS::CBNAME(a, b, c, d, e, f); \
1041 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1043 PCLASS::CBNAME(a, b, c, d, e, f); \
1046 //---------------------------------------------------------------------------
1048 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1049 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1050 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1053 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1054 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1056 wxPyBeginBlockThreads(); \
1057 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1058 PyObject* obj = wxPyMake_wxObject(a); \
1059 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1062 wxPyEndBlockThreads(); \
1064 PCLASS::CBNAME(a, b, c, d, e); \
1066 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1068 PCLASS::CBNAME(a, b, c, d, e); \
1071 //---------------------------------------------------------------------------
1073 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1074 void CBNAME(double a, double b, int c); \
1075 void base_##CBNAME(double a, double b, int c)
1078 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1079 void CLASS::CBNAME(double a, double b, int c) { \
1081 wxPyBeginBlockThreads(); \
1082 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1083 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1084 wxPyEndBlockThreads(); \
1086 PCLASS::CBNAME(a, b, c); \
1088 void CLASS::base_##CBNAME(double a, double b, int c) { \
1089 PCLASS::CBNAME(a, b, c); \
1092 //---------------------------------------------------------------------------
1094 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1095 void CBNAME(bool a, double b, double c, int d); \
1096 void base_##CBNAME(bool a, double b, double c, int d)
1099 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1100 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1102 wxPyBeginBlockThreads(); \
1103 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1104 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1105 wxPyEndBlockThreads(); \
1107 PCLASS::CBNAME(a, b, c, d); \
1109 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1110 PCLASS::CBNAME(a, b, c, d); \
1113 //---------------------------------------------------------------------------
1114 //---------------------------------------------------------------------------
1116 #define DEC_PYCALLBACK__STRING(CBNAME) \
1117 void CBNAME(const wxString& a); \
1118 void base_##CBNAME(const wxString& a)
1120 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1121 void CLASS::CBNAME(const wxString& a) { \
1123 wxPyBeginBlockThreads(); \
1124 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1125 PyObject* s = wx2PyString(a); \
1126 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1129 wxPyEndBlockThreads(); \
1131 PCLASS::CBNAME(a); \
1133 void CLASS::base_##CBNAME(const wxString& a) { \
1134 PCLASS::CBNAME(a); \
1137 //---------------------------------------------------------------------------
1139 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1140 bool CBNAME(const wxString& a); \
1141 bool base_##CBNAME(const wxString& a)
1143 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1144 bool CLASS::CBNAME(const wxString& a) { \
1147 wxPyBeginBlockThreads(); \
1148 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1149 PyObject* s = wx2PyString(a); \
1150 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1153 wxPyEndBlockThreads(); \
1155 rval = PCLASS::CBNAME(a); \
1158 bool CLASS::base_##CBNAME(const wxString& a) { \
1159 return PCLASS::CBNAME(a); \
1162 //---------------------------------------------------------------------------
1164 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1165 bool CBNAME(const wxString& a)
1167 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1168 bool CLASS::CBNAME(const wxString& a) { \
1170 wxPyBeginBlockThreads(); \
1171 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1172 PyObject* s = wx2PyString(a); \
1173 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1176 wxPyEndBlockThreads(); \
1180 //---------------------------------------------------------------------------
1182 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1183 wxString CBNAME(const wxString& a)
1185 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1186 wxString CLASS::CBNAME(const wxString& a) { \
1188 wxPyBeginBlockThreads(); \
1189 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1191 PyObject* s = wx2PyString(a); \
1192 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1195 rval = Py2wxString(ro); \
1199 wxPyEndBlockThreads(); \
1203 //---------------------------------------------------------------------------
1205 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1206 wxString CBNAME(const wxString& a); \
1207 wxString base_##CBNAME(const wxString& a)
1209 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1210 wxString CLASS::CBNAME(const wxString& a) { \
1213 wxPyBeginBlockThreads(); \
1214 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1216 PyObject* s = wx2PyString(a); \
1217 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1220 rval = Py2wxString(ro); \
1225 rval = PCLASS::CBNAME(a); \
1226 wxPyEndBlockThreads(); \
1230 //---------------------------------------------------------------------------
1232 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1233 wxString CBNAME(const wxString& a,int b)
1235 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1236 wxString CLASS::CBNAME(const wxString& a,int b) { \
1238 wxPyBeginBlockThreads(); \
1239 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1241 PyObject* s = wx2PyString(a); \
1242 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1245 rval = Py2wxString(ro); \
1249 wxPyEndBlockThreads(); \
1253 //---------------------------------------------------------------------------
1255 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1256 bool CBNAME(const wxString& a, const wxString& b); \
1257 bool base_##CBNAME(const wxString& a, const wxString& b)
1259 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1260 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1263 wxPyBeginBlockThreads(); \
1264 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1265 PyObject* s1 = wx2PyString(a); \
1266 PyObject* s2 = wx2PyString(b); \
1267 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1271 wxPyEndBlockThreads(); \
1273 rval = PCLASS::CBNAME(a, b); \
1276 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1277 return PCLASS::CBNAME(a, b); \
1280 //---------------------------------------------------------------------------
1282 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1283 wxString CBNAME(); \
1284 wxString base_##CBNAME()
1286 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1287 wxString CLASS::CBNAME() { \
1290 wxPyBeginBlockThreads(); \
1291 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1293 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1295 rval = Py2wxString(ro); \
1299 wxPyEndBlockThreads(); \
1301 rval = PCLASS::CBNAME(); \
1304 wxString CLASS::base_##CBNAME() { \
1305 return PCLASS::CBNAME(); \
1308 //---------------------------------------------------------------------------
1310 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1311 wxString CBNAME() const; \
1312 wxString base_##CBNAME() const;
1314 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1315 wxString CLASS::CBNAME() const { \
1318 wxPyBeginBlockThreads(); \
1319 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1321 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1323 rval = Py2wxString(ro); \
1327 wxPyEndBlockThreads(); \
1329 rval = PCLASS::CBNAME(); \
1332 wxString CLASS::base_##CBNAME() const { \
1333 return PCLASS::CBNAME(); \
1336 //---------------------------------------------------------------------------
1338 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1341 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1342 wxString CLASS::CBNAME() { \
1344 wxPyBeginBlockThreads(); \
1345 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1347 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1349 rval = Py2wxString(ro); \
1353 wxPyEndBlockThreads(); \
1357 //---------------------------------------------------------------------------
1359 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1360 wxString CBNAME() const;
1362 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1363 wxString CLASS::CBNAME() const { \
1365 wxPyBeginBlockThreads(); \
1366 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1368 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1370 rval = Py2wxString(ro); \
1374 wxPyEndBlockThreads(); \
1378 //---------------------------------------------------------------------------
1380 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1381 bool CBNAME(const wxHtmlTag& a)
1384 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1385 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1387 wxPyBeginBlockThreads(); \
1388 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1389 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1390 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1393 wxPyEndBlockThreads(); \
1397 //---------------------------------------------------------------------------
1399 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1400 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1401 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1403 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1404 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1406 wxPyBeginBlockThreads(); \
1407 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1408 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1409 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1412 wxPyEndBlockThreads(); \
1414 PCLASS::CBNAME(cell, x, y); \
1416 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1417 PCLASS::CBNAME(cell, x, y); \
1421 //---------------------------------------------------------------------------
1423 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1424 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1425 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1427 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1428 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1430 wxPyBeginBlockThreads(); \
1431 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1432 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1433 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1434 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1438 wxPyEndBlockThreads(); \
1440 PCLASS::CBNAME(cell, x, y, e); \
1442 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1443 PCLASS::CBNAME(cell, x, y, e); \
1448 //---------------------------------------------------------------------------
1450 #define DEC_PYCALLBACK___pure(CBNAME) \
1454 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1455 void CLASS::CBNAME() { \
1456 wxPyBeginBlockThreads(); \
1457 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1458 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1459 wxPyEndBlockThreads(); \
1462 //---------------------------------------------------------------------------
1464 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1468 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1469 wxSize CLASS::CBNAME() { \
1470 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1472 wxPyBeginBlockThreads(); \
1473 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1476 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1478 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1480 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1481 PyObject* o1 = PySequence_GetItem(ro, 0); \
1482 PyObject* o2 = PySequence_GetItem(ro, 1); \
1483 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1484 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1486 PyErr_SetString(PyExc_TypeError, errmsg); \
1491 PyErr_SetString(PyExc_TypeError, errmsg); \
1496 wxPyEndBlockThreads(); \
1500 //---------------------------------------------------------------------------
1502 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1503 bool CBNAME(wxWindow* a); \
1504 bool base_##CBNAME(wxWindow* a)
1507 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1508 bool CLASS::CBNAME(wxWindow* a) { \
1511 wxPyBeginBlockThreads(); \
1512 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1513 PyObject* obj = wxPyMake_wxObject(a); \
1514 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1517 wxPyEndBlockThreads(); \
1519 rval = PCLASS::CBNAME(a); \
1522 bool CLASS::base_##CBNAME(wxWindow* a) { \
1523 return PCLASS::CBNAME(a); \
1526 //---------------------------------------------------------------------------
1528 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1529 bool CBNAME(wxWindow* a, wxDC& b); \
1530 bool base_##CBNAME(wxWindow* a, wxDC& b)
1533 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1534 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1537 wxPyBeginBlockThreads(); \
1538 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1539 PyObject* win = wxPyMake_wxObject(a); \
1540 PyObject* dc = wxPyMake_wxObject(&b); \
1541 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1545 wxPyEndBlockThreads(); \
1547 rval = PCLASS::CBNAME(a, b); \
1550 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1551 return PCLASS::CBNAME(a, b); \
1554 //---------------------------------------------------------------------------
1556 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1557 void CBNAME(wxWindowBase* a); \
1558 void base_##CBNAME(wxWindowBase* a)
1561 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1562 void CLASS::CBNAME(wxWindowBase* a) { \
1564 wxPyBeginBlockThreads(); \
1565 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1566 PyObject* obj = wxPyMake_wxObject(a); \
1567 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1570 wxPyEndBlockThreads(); \
1572 PCLASS::CBNAME(a); \
1574 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1575 PCLASS::CBNAME(a); \
1578 //---------------------------------------------------------------------------
1580 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1582 bool base_##CBNAME()
1585 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1586 bool CLASS::CBNAME() { \
1589 wxPyBeginBlockThreads(); \
1590 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1591 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1592 wxPyEndBlockThreads(); \
1594 rval = PCLASS::CBNAME(); \
1597 bool CLASS::base_##CBNAME() { \
1598 return PCLASS::CBNAME(); \
1601 //---------------------------------------------------------------------------
1603 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1604 bool CBNAME() const; \
1605 bool base_##CBNAME() const
1608 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1609 bool CLASS::CBNAME() const { \
1612 wxPyBeginBlockThreads(); \
1613 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1614 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1615 wxPyEndBlockThreads(); \
1617 rval = PCLASS::CBNAME(); \
1620 bool CLASS::base_##CBNAME() const { \
1621 return PCLASS::CBNAME(); \
1624 //---------------------------------------------------------------------------
1626 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1627 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1628 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1631 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1632 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1635 wxPyBeginBlockThreads(); \
1636 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1637 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1638 wxPyEndBlockThreads(); \
1640 rval = PCLASS::CBNAME(a, b, c); \
1641 return (wxDragResult)rval; \
1643 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1644 return PCLASS::CBNAME(a, b, c); \
1647 //---------------------------------------------------------------------------
1649 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1650 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1652 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1653 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1654 wxPyBeginBlockThreads(); \
1656 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1658 PyObject* obj = wxPyMake_wxObject(&a); \
1659 PyObject* s = wx2PyString(b); \
1660 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1663 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1669 wxPyEndBlockThreads(); \
1673 //---------------------------------------------------------------------------
1675 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1676 bool CBNAME(wxDragResult a); \
1677 bool base_##CBNAME(wxDragResult a)
1680 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1681 bool CLASS::CBNAME(wxDragResult a) { \
1684 wxPyBeginBlockThreads(); \
1685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1686 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1687 wxPyEndBlockThreads(); \
1689 rval = PCLASS::CBNAME(a); \
1692 bool CLASS::base_##CBNAME(wxDragResult a) { \
1693 return PCLASS::CBNAME(a); \
1696 //---------------------------------------------------------------------------
1698 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1699 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1702 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1703 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1704 wxPyBeginBlockThreads(); \
1706 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1707 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1708 wxPyEndBlockThreads(); \
1709 return (wxDragResult)rval; \
1712 //---------------------------------------------------------------------------
1714 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1715 bool CBNAME(int a, int b, const wxString& c)
1717 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1718 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1720 wxPyBeginBlockThreads(); \
1721 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1722 PyObject* s = wx2PyString(c); \
1723 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1726 wxPyEndBlockThreads(); \
1730 //---------------------------------------------------------------------------
1732 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1734 size_t base_##CBNAME()
1737 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1738 size_t CLASS::CBNAME() { \
1741 wxPyBeginBlockThreads(); \
1742 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1743 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1744 wxPyEndBlockThreads(); \
1746 rval = PCLASS::CBNAME(); \
1749 size_t CLASS::base_##CBNAME() { \
1750 return PCLASS::CBNAME(); \
1753 //---------------------------------------------------------------------------
1755 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1756 wxDataFormat CBNAME(size_t a); \
1757 wxDataFormat base_##CBNAME(size_t a)
1760 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1761 wxDataFormat CLASS::CBNAME(size_t a) { \
1762 wxDataFormat rval=0; \
1764 wxPyBeginBlockThreads(); \
1765 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1767 wxDataFormat* ptr; \
1768 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1770 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1775 wxPyEndBlockThreads(); \
1777 rval = PCLASS::CBNAME(a); \
1780 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1781 return PCLASS::CBNAME(a); \
1784 //---------------------------------------------------------------------------
1786 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1787 void CBNAME(const Type& a); \
1788 void base_##CBNAME(const Type& a)
1791 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1792 void CLASS::CBNAME(const Type& a) { \
1794 wxPyBeginBlockThreads(); \
1795 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1796 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1797 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1800 wxPyEndBlockThreads(); \
1802 PCLASS::CBNAME(a); \
1804 void CLASS::base_##CBNAME(const Type& a) { \
1805 PCLASS::CBNAME(a); \
1809 //---------------------------------------------------------------------------
1811 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1812 void CBNAME(Type& a); \
1813 void base_##CBNAME(Type& a)
1816 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1817 void CLASS::CBNAME(Type& a) { \
1819 wxPyBeginBlockThreads(); \
1820 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1821 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1822 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1825 wxPyEndBlockThreads(); \
1827 PCLASS::CBNAME(a); \
1829 void CLASS::base_##CBNAME(Type& a) { \
1830 PCLASS::CBNAME(a); \
1833 //---------------------------------------------------------------------------
1835 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1836 bool CBNAME(Type& a); \
1837 bool base_##CBNAME(Type& a)
1840 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1841 bool CLASS::CBNAME(Type& a) { \
1844 wxPyBeginBlockThreads(); \
1845 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1846 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1847 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1850 wxPyEndBlockThreads(); \
1852 rv = PCLASS::CBNAME(a); \
1855 bool CLASS::base_##CBNAME(Type& a) { \
1856 return PCLASS::CBNAME(a); \
1859 //---------------------------------------------------------------------------
1861 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1862 bool CBNAME(Type& a)
1865 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1866 bool CLASS::CBNAME(Type& a) { \
1868 wxPyBeginBlockThreads(); \
1869 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1870 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1871 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1874 wxPyEndBlockThreads(); \
1878 //---------------------------------------------------------------------------
1880 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1881 wxString CBNAME(long a, long b) const; \
1882 wxString base_##CBNAME(long a, long b) const
1884 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1885 wxString CLASS::CBNAME(long a, long b) const { \
1888 wxPyBeginBlockThreads(); \
1889 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1891 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1893 rval = Py2wxString(ro); \
1897 wxPyEndBlockThreads(); \
1899 rval = PCLASS::CBNAME(a,b); \
1902 wxString CLASS::base_##CBNAME(long a, long b) const { \
1903 return PCLASS::CBNAME(a,b); \
1906 //---------------------------------------------------------------------------
1908 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1909 int CBNAME(long a) const; \
1910 int base_##CBNAME(long a) const
1913 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1914 int CLASS::CBNAME(long a) const { \
1917 wxPyBeginBlockThreads(); \
1918 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1920 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1922 rval = PyInt_AsLong(ro); \
1926 wxPyEndBlockThreads(); \
1928 rval = PCLASS::CBNAME(a); \
1931 int CLASS::base_##CBNAME(long a) const { \
1932 return PCLASS::CBNAME(a); \
1936 //---------------------------------------------------------------------------
1938 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1939 wxListItemAttr* CBNAME(long a) const; \
1940 wxListItemAttr* base_##CBNAME(long a) const
1943 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1944 wxListItemAttr *CLASS::CBNAME(long a) const { \
1945 wxListItemAttr *rval = NULL; \
1947 wxPyBeginBlockThreads(); \
1948 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1950 wxListItemAttr* ptr; \
1951 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1953 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1958 wxPyEndBlockThreads(); \
1960 rval = PCLASS::CBNAME(a); \
1963 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
1964 return PCLASS::CBNAME(a); \
1967 //---------------------------------------------------------------------------
1969 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1970 bool CBNAME(wxMouseEvent& e); \
1971 bool base_##CBNAME(wxMouseEvent& e)
1973 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1974 bool CLASS::CBNAME(wxMouseEvent& e) { \
1977 wxPyBeginBlockThreads(); \
1978 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1980 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1981 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1983 rval = PyInt_AsLong(ro); \
1988 wxPyEndBlockThreads(); \
1990 return PCLASS::CBNAME(e); \
1993 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1994 return PCLASS::CBNAME(e); \
1998 //---------------------------------------------------------------------------
2000 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2001 wxWizardPage* CBNAME() const
2003 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2004 wxWizardPage* CLASS::CBNAME() const { \
2005 wxWizardPage* rv = NULL; \
2006 wxPyBeginBlockThreads(); \
2007 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2009 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2011 SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
2015 wxPyEndBlockThreads(); \
2019 //---------------------------------------------------------------------------
2021 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2022 wxBitmap CBNAME() const
2024 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2025 wxBitmap CLASS::CBNAME() const { \
2027 wxPyBeginBlockThreads(); \
2028 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2031 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2033 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
2038 wxPyEndBlockThreads(); \
2042 //---------------------------------------------------------------------------
2044 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2047 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2048 wxObject* CLASS::CBNAME() { \
2049 wxObject* rv = NULL; \
2050 wxPyBeginBlockThreads(); \
2051 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2053 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2055 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2059 wxPyEndBlockThreads(); \
2063 //---------------------------------------------------------------------------
2065 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2066 wxObject* CBNAME(const wxString& a)
2068 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2069 wxObject* CLASS::CBNAME(const wxString& a) { \
2070 wxObject* rv = NULL; \
2071 wxPyBeginBlockThreads(); \
2072 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2073 PyObject* so = wx2PyString(a); \
2075 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2077 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2082 wxPyEndBlockThreads(); \
2086 //---------------------------------------------------------------------------
2088 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2089 bool CBNAME(wxXmlNode* a)
2092 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2093 bool CLASS::CBNAME(wxXmlNode* a) { \
2095 wxPyBeginBlockThreads(); \
2096 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2097 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2098 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2101 wxPyEndBlockThreads(); \
2105 //---------------------------------------------------------------------------