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 GetMacSupportPCMenuShortcuts();
463 static long GetMacAboutMenuItemId();
464 static long GetMacPreferencesMenuItemId();
465 static long GetMacExitMenuItemId();
466 static wxString
GetMacHelpMenuTitleName();
468 static void SetMacSupportPCMenuShortcuts(bool val
);
469 static void SetMacAboutMenuItemId(long val
);
470 static void SetMacPreferencesMenuItemId(long val
);
471 static void SetMacExitMenuItemId(long val
);
472 static void SetMacHelpMenuTitleName(const wxString
& val
);
479 extern wxPyApp
*wxPythonApp
;
482 //----------------------------------------------------------------------
483 // These macros are used to implement the virtual methods that should
484 // redirect to a Python method if one exists. The names designate the
485 // return type, if any, as well as any parameter types.
486 //---------------------------------------------------------------------------
488 #define DEC_PYCALLBACK__(CBNAME) \
493 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
494 void CLASS::CBNAME() { \
496 wxPyBeginBlockThreads(); \
497 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
498 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
499 wxPyEndBlockThreads(); \
503 void CLASS::base_##CBNAME() { \
507 //---------------------------------------------------------------------------
509 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
510 bool CBNAME(int a, int b); \
511 bool base_##CBNAME(int a, int b)
514 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
515 bool CLASS::CBNAME(int a, int b) { \
516 bool rval=FALSE, found; \
517 wxPyBeginBlockThreads(); \
518 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
519 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
520 wxPyEndBlockThreads(); \
522 rval = PCLASS::CBNAME(a,b); \
525 bool CLASS::base_##CBNAME(int a, int b) { \
526 return PCLASS::CBNAME(a,b); \
529 //---------------------------------------------------------------------------
531 #define DEC_PYCALLBACK_VOID_(CBNAME) \
536 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
537 void CLASS::CBNAME() { \
539 wxPyBeginBlockThreads(); \
540 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
541 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
542 wxPyEndBlockThreads(); \
546 void CLASS::base_##CBNAME() { \
550 //---------------------------------------------------------------------------
552 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
553 void CBNAME(int a, int b); \
554 void base_##CBNAME(int a, int b)
557 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
558 void CLASS::CBNAME(int a, int b) { \
560 wxPyBeginBlockThreads(); \
561 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
562 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
563 wxPyEndBlockThreads(); \
565 PCLASS::CBNAME(a,b); \
567 void CLASS::base_##CBNAME(int a, int b) { \
568 PCLASS::CBNAME(a,b); \
571 //---------------------------------------------------------------------------
573 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
574 void CBNAME(int a); \
575 void base_##CBNAME(int a)
578 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
579 void CLASS::CBNAME(int a) { \
581 wxPyBeginBlockThreads(); \
582 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
583 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
584 wxPyEndBlockThreads(); \
588 void CLASS::base_##CBNAME(int a) { \
592 //---------------------------------------------------------------------------
594 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
595 void CBNAME(int a, int b, int c, int d); \
596 void base_##CBNAME(int a, int b, int c, int d)
599 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
600 void CLASS::CBNAME(int a, int b, int c, int d) { \
602 wxPyBeginBlockThreads(); \
603 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
604 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
605 wxPyEndBlockThreads(); \
607 PCLASS::CBNAME(a,b,c,d); \
609 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
610 PCLASS::CBNAME(a,b,c,d); \
613 //---------------------------------------------------------------------------
614 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
615 void CBNAME(int a, int b, int c, int d, int e); \
616 void base_##CBNAME(int a, int b, int c, int d, int e)
619 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
620 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
622 wxPyBeginBlockThreads(); \
623 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
624 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
625 wxPyEndBlockThreads(); \
627 PCLASS::CBNAME(a,b,c,d,e); \
629 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
630 PCLASS::CBNAME(a,b,c,d,e); \
633 //---------------------------------------------------------------------------
635 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
636 void CBNAME(int* a, int* b) const; \
637 void base_##CBNAME(int* a, int* b) const
640 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
641 void CLASS::CBNAME(int* a, int* b) const { \
642 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
644 wxPyBeginBlockThreads(); \
645 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
647 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
649 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
650 PyObject* o1 = PySequence_GetItem(ro, 0); \
651 PyObject* o2 = PySequence_GetItem(ro, 1); \
652 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
653 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
656 PyErr_SetString(PyExc_TypeError, errmsg); \
661 PyErr_SetString(PyExc_TypeError, errmsg); \
666 wxPyEndBlockThreads(); \
668 PCLASS::CBNAME(a,b); \
670 void CLASS::base_##CBNAME(int* a, int* b) const { \
671 PCLASS::CBNAME(a,b); \
675 //---------------------------------------------------------------------------
677 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
678 wxSize CBNAME() const; \
679 wxSize base_##CBNAME() const
682 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
683 wxSize CLASS::CBNAME() const { \
684 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
685 bool found; wxSize rval(0,0); \
686 wxPyBeginBlockThreads(); \
687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
689 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
691 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
692 PyObject* o1 = PySequence_GetItem(ro, 0); \
693 PyObject* o2 = PySequence_GetItem(ro, 1); \
694 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
695 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
698 PyErr_SetString(PyExc_TypeError, errmsg); \
703 PyErr_SetString(PyExc_TypeError, errmsg); \
708 wxPyEndBlockThreads(); \
710 return PCLASS::CBNAME(); \
714 wxSize CLASS::base_##CBNAME() const { \
715 return PCLASS::CBNAME(); \
719 //---------------------------------------------------------------------------
721 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
722 bool CBNAME(bool a); \
723 bool base_##CBNAME(bool a)
726 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
727 bool CLASS::CBNAME(bool a) { \
728 bool rval=FALSE, found; \
729 wxPyBeginBlockThreads(); \
730 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
731 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
732 wxPyEndBlockThreads(); \
734 rval = PCLASS::CBNAME(a); \
737 bool CLASS::base_##CBNAME(bool a) { \
738 return PCLASS::CBNAME(a); \
741 //---------------------------------------------------------------------------
743 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
744 bool CBNAME(int a); \
745 bool base_##CBNAME(int a)
748 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
749 bool CLASS::CBNAME(int a) { \
750 bool rval=FALSE, found; \
751 wxPyBeginBlockThreads(); \
752 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
753 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
754 wxPyEndBlockThreads(); \
756 rval = PCLASS::CBNAME(a); \
759 bool CLASS::base_##CBNAME(int a) { \
760 return PCLASS::CBNAME(a); \
763 //---------------------------------------------------------------------------
765 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
769 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
770 bool CLASS::CBNAME(int a) { \
772 wxPyBeginBlockThreads(); \
773 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
774 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
776 wxPyEndBlockThreads(); \
781 //---------------------------------------------------------------------------
783 #define DEC_PYCALLBACK__DC(CBNAME) \
784 void CBNAME(wxDC& a); \
785 void base_##CBNAME(wxDC& a)
788 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
789 void CLASS::CBNAME(wxDC& a) { \
791 wxPyBeginBlockThreads(); \
792 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
793 PyObject* obj = wxPyMake_wxObject(&a); \
794 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
797 wxPyEndBlockThreads(); \
801 void CLASS::base_##CBNAME(wxDC& a) { \
807 //---------------------------------------------------------------------------
809 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
810 void CBNAME(wxDC& a, bool b); \
811 void base_##CBNAME(wxDC& a, bool b)
814 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
815 void CLASS::CBNAME(wxDC& a, bool b) { \
817 wxPyBeginBlockThreads(); \
818 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
819 PyObject* obj = wxPyMake_wxObject(&a); \
820 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
823 wxPyEndBlockThreads(); \
825 PCLASS::CBNAME(a, b); \
827 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
828 PCLASS::CBNAME(a, b); \
831 //---------------------------------------------------------------------------
833 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
834 void CBNAME(wxDC& a, bool b); \
835 void base_##CBNAME(wxDC& a, bool b)
838 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
839 void CLASS::CBNAME(wxDC& a, bool b) { \
841 wxPyBeginBlockThreads(); \
842 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
843 PyObject* obj = wxPyMake_wxObject(&a); \
844 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
847 wxPyEndBlockThreads(); \
849 PCLASS::CBNAME(a, b); \
851 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
852 PCLASS::CBNAME(a, b); \
855 //---------------------------------------------------------------------------
857 #define DEC_PYCALLBACK__2DBL(CBNAME) \
858 void CBNAME(double a, double b); \
859 void base_##CBNAME(double a, double b)
862 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
863 void CLASS::CBNAME(double a, double b) { \
865 wxPyBeginBlockThreads(); \
866 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
867 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
868 wxPyEndBlockThreads(); \
870 PCLASS::CBNAME(a, b); \
872 void CLASS::base_##CBNAME(double a, double b) { \
873 PCLASS::CBNAME(a, b); \
876 //---------------------------------------------------------------------------
878 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
879 void CBNAME(double a, double b, int c, int d); \
880 void base_##CBNAME(double a, double b, int c, int d)
883 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
884 void CLASS::CBNAME(double a, double b, int c, int d) { \
886 wxPyBeginBlockThreads(); \
887 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
888 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
890 wxPyEndBlockThreads(); \
892 PCLASS::CBNAME(a, b, c, d); \
894 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
895 PCLASS::CBNAME(a, b, c, d); \
898 //---------------------------------------------------------------------------
900 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
901 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
902 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
905 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
906 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
908 wxPyBeginBlockThreads(); \
909 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
910 PyObject* obj = wxPyMake_wxObject(&a); \
911 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
914 wxPyEndBlockThreads(); \
916 PCLASS::CBNAME(a, b, c, d, e, f); \
918 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
919 PCLASS::CBNAME(a, b, c, d, e, f); \
922 //---------------------------------------------------------------------------
924 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
925 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
926 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
929 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
930 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
932 wxPyBeginBlockThreads(); \
934 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
935 PyObject* obj = wxPyMake_wxObject(&a); \
936 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
939 wxPyEndBlockThreads(); \
941 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
944 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
945 return PCLASS::CBNAME(a, b, c, d, e, f); \
948 //---------------------------------------------------------------------------
950 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
951 void CBNAME(bool a, double b, double c, int d, int e); \
952 void base_##CBNAME(bool a, double b, double c, int d, int e)
955 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
956 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
958 wxPyBeginBlockThreads(); \
959 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
960 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
962 wxPyEndBlockThreads(); \
964 PCLASS::CBNAME(a, b, c, d, e); \
966 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
967 PCLASS::CBNAME(a, b, c, d, e); \
970 //---------------------------------------------------------------------------
972 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
973 void CBNAME(wxDC& a, double b, double c, double d, double e); \
974 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
977 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
978 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
980 wxPyBeginBlockThreads(); \
981 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
982 PyObject* obj = wxPyMake_wxObject(&a); \
983 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
986 wxPyEndBlockThreads(); \
988 PCLASS::CBNAME(a, b, c, d, e); \
990 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
991 PCLASS::CBNAME(a, b, c, d, e); \
994 //---------------------------------------------------------------------------
996 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
997 void CBNAME(wxDC& a, bool b); \
998 void base_##CBNAME(wxDC& a, bool b)
1001 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1002 void CLASS::CBNAME(wxDC& a, bool b) { \
1004 wxPyBeginBlockThreads(); \
1005 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1006 PyObject* obj = wxPyMake_wxObject(&a); \
1007 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1010 wxPyEndBlockThreads(); \
1012 PCLASS::CBNAME(a, b); \
1014 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1015 PCLASS::CBNAME(a, b); \
1018 //---------------------------------------------------------------------------
1020 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1021 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1022 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1025 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1026 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1029 wxPyBeginBlockThreads(); \
1030 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1031 PyObject* obj = wxPyMake_wxObject(a); \
1032 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1035 wxPyEndBlockThreads(); \
1037 PCLASS::CBNAME(a, b, c, d, e, f); \
1039 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1041 PCLASS::CBNAME(a, b, c, d, e, f); \
1044 //---------------------------------------------------------------------------
1046 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1047 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1048 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1051 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1052 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1054 wxPyBeginBlockThreads(); \
1055 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1056 PyObject* obj = wxPyMake_wxObject(a); \
1057 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1060 wxPyEndBlockThreads(); \
1062 PCLASS::CBNAME(a, b, c, d, e); \
1064 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1066 PCLASS::CBNAME(a, b, c, d, e); \
1069 //---------------------------------------------------------------------------
1071 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1072 void CBNAME(double a, double b, int c); \
1073 void base_##CBNAME(double a, double b, int c)
1076 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1077 void CLASS::CBNAME(double a, double b, int c) { \
1079 wxPyBeginBlockThreads(); \
1080 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1081 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1082 wxPyEndBlockThreads(); \
1084 PCLASS::CBNAME(a, b, c); \
1086 void CLASS::base_##CBNAME(double a, double b, int c) { \
1087 PCLASS::CBNAME(a, b, c); \
1090 //---------------------------------------------------------------------------
1092 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1093 void CBNAME(bool a, double b, double c, int d); \
1094 void base_##CBNAME(bool a, double b, double c, int d)
1097 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1098 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1100 wxPyBeginBlockThreads(); \
1101 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1102 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1103 wxPyEndBlockThreads(); \
1105 PCLASS::CBNAME(a, b, c, d); \
1107 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1108 PCLASS::CBNAME(a, b, c, d); \
1111 //---------------------------------------------------------------------------
1112 //---------------------------------------------------------------------------
1114 #define DEC_PYCALLBACK__STRING(CBNAME) \
1115 void CBNAME(const wxString& a); \
1116 void base_##CBNAME(const wxString& a)
1118 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1119 void CLASS::CBNAME(const wxString& a) { \
1121 wxPyBeginBlockThreads(); \
1122 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1123 PyObject* s = wx2PyString(a); \
1124 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1127 wxPyEndBlockThreads(); \
1129 PCLASS::CBNAME(a); \
1131 void CLASS::base_##CBNAME(const wxString& a) { \
1132 PCLASS::CBNAME(a); \
1135 //---------------------------------------------------------------------------
1137 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1138 bool CBNAME(const wxString& a); \
1139 bool base_##CBNAME(const wxString& a)
1141 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1142 bool CLASS::CBNAME(const wxString& a) { \
1145 wxPyBeginBlockThreads(); \
1146 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1147 PyObject* s = wx2PyString(a); \
1148 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1151 wxPyEndBlockThreads(); \
1153 rval = PCLASS::CBNAME(a); \
1156 bool CLASS::base_##CBNAME(const wxString& a) { \
1157 return PCLASS::CBNAME(a); \
1160 //---------------------------------------------------------------------------
1162 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1163 bool CBNAME(const wxString& a)
1165 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1166 bool CLASS::CBNAME(const wxString& a) { \
1168 wxPyBeginBlockThreads(); \
1169 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1170 PyObject* s = wx2PyString(a); \
1171 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1174 wxPyEndBlockThreads(); \
1178 //---------------------------------------------------------------------------
1180 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1181 wxString CBNAME(const wxString& a)
1183 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1184 wxString CLASS::CBNAME(const wxString& a) { \
1186 wxPyBeginBlockThreads(); \
1187 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1189 PyObject* s = wx2PyString(a); \
1190 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1193 rval = Py2wxString(ro); \
1197 wxPyEndBlockThreads(); \
1201 //---------------------------------------------------------------------------
1203 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1204 wxString CBNAME(const wxString& a); \
1205 wxString base_##CBNAME(const wxString& a)
1207 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1208 wxString CLASS::CBNAME(const wxString& a) { \
1211 wxPyBeginBlockThreads(); \
1212 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1214 PyObject* s = wx2PyString(a); \
1215 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1218 rval = Py2wxString(ro); \
1223 rval = PCLASS::CBNAME(a); \
1224 wxPyEndBlockThreads(); \
1228 //---------------------------------------------------------------------------
1230 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1231 wxString CBNAME(const wxString& a,int b)
1233 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1234 wxString CLASS::CBNAME(const wxString& a,int b) { \
1236 wxPyBeginBlockThreads(); \
1237 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1239 PyObject* s = wx2PyString(a); \
1240 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1243 rval = Py2wxString(ro); \
1247 wxPyEndBlockThreads(); \
1251 //---------------------------------------------------------------------------
1253 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1254 bool CBNAME(const wxString& a, const wxString& b); \
1255 bool base_##CBNAME(const wxString& a, const wxString& b)
1257 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1258 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1261 wxPyBeginBlockThreads(); \
1262 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1263 PyObject* s1 = wx2PyString(a); \
1264 PyObject* s2 = wx2PyString(b); \
1265 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1269 wxPyEndBlockThreads(); \
1271 rval = PCLASS::CBNAME(a, b); \
1274 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1275 return PCLASS::CBNAME(a, b); \
1278 //---------------------------------------------------------------------------
1280 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1281 wxString CBNAME(); \
1282 wxString base_##CBNAME()
1284 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1285 wxString CLASS::CBNAME() { \
1288 wxPyBeginBlockThreads(); \
1289 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1291 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1293 rval = Py2wxString(ro); \
1297 wxPyEndBlockThreads(); \
1299 rval = PCLASS::CBNAME(); \
1302 wxString CLASS::base_##CBNAME() { \
1303 return PCLASS::CBNAME(); \
1306 //---------------------------------------------------------------------------
1308 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1309 wxString CBNAME() const; \
1310 wxString base_##CBNAME() const;
1312 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1313 wxString CLASS::CBNAME() const { \
1316 wxPyBeginBlockThreads(); \
1317 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1319 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1321 rval = Py2wxString(ro); \
1325 wxPyEndBlockThreads(); \
1327 rval = PCLASS::CBNAME(); \
1330 wxString CLASS::base_##CBNAME() const { \
1331 return PCLASS::CBNAME(); \
1334 //---------------------------------------------------------------------------
1336 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1339 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1340 wxString CLASS::CBNAME() { \
1342 wxPyBeginBlockThreads(); \
1343 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1345 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1347 rval = Py2wxString(ro); \
1351 wxPyEndBlockThreads(); \
1355 //---------------------------------------------------------------------------
1357 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1358 wxString CBNAME() const;
1360 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1361 wxString CLASS::CBNAME() const { \
1363 wxPyBeginBlockThreads(); \
1364 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1366 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1368 rval = Py2wxString(ro); \
1372 wxPyEndBlockThreads(); \
1376 //---------------------------------------------------------------------------
1378 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1379 bool CBNAME(const wxHtmlTag& a)
1382 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1383 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1385 wxPyBeginBlockThreads(); \
1386 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1387 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1388 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1391 wxPyEndBlockThreads(); \
1395 //---------------------------------------------------------------------------
1397 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1398 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1399 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1401 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1402 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1404 wxPyBeginBlockThreads(); \
1405 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1406 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1407 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1410 wxPyEndBlockThreads(); \
1412 PCLASS::CBNAME(cell, x, y); \
1414 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1415 PCLASS::CBNAME(cell, x, y); \
1419 //---------------------------------------------------------------------------
1421 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1422 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1423 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1425 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1426 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1428 wxPyBeginBlockThreads(); \
1429 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1430 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1431 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1432 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1436 wxPyEndBlockThreads(); \
1438 PCLASS::CBNAME(cell, x, y, e); \
1440 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1441 PCLASS::CBNAME(cell, x, y, e); \
1446 //---------------------------------------------------------------------------
1448 #define DEC_PYCALLBACK___pure(CBNAME) \
1452 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1453 void CLASS::CBNAME() { \
1454 wxPyBeginBlockThreads(); \
1455 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1456 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1457 wxPyEndBlockThreads(); \
1460 //---------------------------------------------------------------------------
1462 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1466 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1467 wxSize CLASS::CBNAME() { \
1468 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1470 wxPyBeginBlockThreads(); \
1471 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1474 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1476 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1478 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1479 PyObject* o1 = PySequence_GetItem(ro, 0); \
1480 PyObject* o2 = PySequence_GetItem(ro, 1); \
1481 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1482 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1484 PyErr_SetString(PyExc_TypeError, errmsg); \
1489 PyErr_SetString(PyExc_TypeError, errmsg); \
1494 wxPyEndBlockThreads(); \
1498 //---------------------------------------------------------------------------
1500 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1501 bool CBNAME(wxWindow* a); \
1502 bool base_##CBNAME(wxWindow* a)
1505 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1506 bool CLASS::CBNAME(wxWindow* a) { \
1509 wxPyBeginBlockThreads(); \
1510 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1511 PyObject* obj = wxPyMake_wxObject(a); \
1512 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1515 wxPyEndBlockThreads(); \
1517 rval = PCLASS::CBNAME(a); \
1520 bool CLASS::base_##CBNAME(wxWindow* a) { \
1521 return PCLASS::CBNAME(a); \
1524 //---------------------------------------------------------------------------
1526 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1527 bool CBNAME(wxWindow* a, wxDC& b); \
1528 bool base_##CBNAME(wxWindow* a, wxDC& b)
1531 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1532 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1535 wxPyBeginBlockThreads(); \
1536 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1537 PyObject* win = wxPyMake_wxObject(a); \
1538 PyObject* dc = wxPyMake_wxObject(&b); \
1539 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1543 wxPyEndBlockThreads(); \
1545 rval = PCLASS::CBNAME(a, b); \
1548 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1549 return PCLASS::CBNAME(a, b); \
1552 //---------------------------------------------------------------------------
1554 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1555 void CBNAME(wxWindowBase* a); \
1556 void base_##CBNAME(wxWindowBase* a)
1559 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1560 void CLASS::CBNAME(wxWindowBase* a) { \
1562 wxPyBeginBlockThreads(); \
1563 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1564 PyObject* obj = wxPyMake_wxObject(a); \
1565 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1568 wxPyEndBlockThreads(); \
1570 PCLASS::CBNAME(a); \
1572 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1573 PCLASS::CBNAME(a); \
1576 //---------------------------------------------------------------------------
1578 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1580 bool base_##CBNAME()
1583 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1584 bool CLASS::CBNAME() { \
1587 wxPyBeginBlockThreads(); \
1588 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1589 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1590 wxPyEndBlockThreads(); \
1592 rval = PCLASS::CBNAME(); \
1595 bool CLASS::base_##CBNAME() { \
1596 return PCLASS::CBNAME(); \
1599 //---------------------------------------------------------------------------
1601 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1602 bool CBNAME() const; \
1603 bool base_##CBNAME() const
1606 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1607 bool CLASS::CBNAME() const { \
1610 wxPyBeginBlockThreads(); \
1611 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1612 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1613 wxPyEndBlockThreads(); \
1615 rval = PCLASS::CBNAME(); \
1618 bool CLASS::base_##CBNAME() const { \
1619 return PCLASS::CBNAME(); \
1622 //---------------------------------------------------------------------------
1624 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1625 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1626 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1629 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1630 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1633 wxPyBeginBlockThreads(); \
1634 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1635 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1636 wxPyEndBlockThreads(); \
1638 rval = PCLASS::CBNAME(a, b, c); \
1639 return (wxDragResult)rval; \
1641 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1642 return PCLASS::CBNAME(a, b, c); \
1645 //---------------------------------------------------------------------------
1647 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1648 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1650 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1651 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1652 wxPyBeginBlockThreads(); \
1654 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1656 PyObject* obj = wxPyMake_wxObject(&a); \
1657 PyObject* s = wx2PyString(b); \
1658 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1661 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1667 wxPyEndBlockThreads(); \
1671 //---------------------------------------------------------------------------
1673 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1674 bool CBNAME(wxDragResult a); \
1675 bool base_##CBNAME(wxDragResult a)
1678 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1679 bool CLASS::CBNAME(wxDragResult a) { \
1682 wxPyBeginBlockThreads(); \
1683 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1684 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1685 wxPyEndBlockThreads(); \
1687 rval = PCLASS::CBNAME(a); \
1690 bool CLASS::base_##CBNAME(wxDragResult a) { \
1691 return PCLASS::CBNAME(a); \
1694 //---------------------------------------------------------------------------
1696 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1697 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1700 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1701 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1702 wxPyBeginBlockThreads(); \
1704 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1705 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1706 wxPyEndBlockThreads(); \
1707 return (wxDragResult)rval; \
1710 //---------------------------------------------------------------------------
1712 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1713 bool CBNAME(int a, int b, const wxString& c)
1715 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1716 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1718 wxPyBeginBlockThreads(); \
1719 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1720 PyObject* s = wx2PyString(c); \
1721 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1724 wxPyEndBlockThreads(); \
1728 //---------------------------------------------------------------------------
1730 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1732 size_t base_##CBNAME()
1735 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1736 size_t CLASS::CBNAME() { \
1739 wxPyBeginBlockThreads(); \
1740 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1741 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1742 wxPyEndBlockThreads(); \
1744 rval = PCLASS::CBNAME(); \
1747 size_t CLASS::base_##CBNAME() { \
1748 return PCLASS::CBNAME(); \
1751 //---------------------------------------------------------------------------
1753 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1754 wxDataFormat CBNAME(size_t a); \
1755 wxDataFormat base_##CBNAME(size_t a)
1758 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1759 wxDataFormat CLASS::CBNAME(size_t a) { \
1760 wxDataFormat rval=0; \
1762 wxPyBeginBlockThreads(); \
1763 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1765 wxDataFormat* ptr; \
1766 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1768 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1773 wxPyEndBlockThreads(); \
1775 rval = PCLASS::CBNAME(a); \
1778 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1779 return PCLASS::CBNAME(a); \
1782 //---------------------------------------------------------------------------
1784 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1785 void CBNAME(const Type& a); \
1786 void base_##CBNAME(const Type& a)
1789 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1790 void CLASS::CBNAME(const Type& a) { \
1792 wxPyBeginBlockThreads(); \
1793 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1794 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1795 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1798 wxPyEndBlockThreads(); \
1800 PCLASS::CBNAME(a); \
1802 void CLASS::base_##CBNAME(const Type& a) { \
1803 PCLASS::CBNAME(a); \
1807 //---------------------------------------------------------------------------
1809 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1810 void CBNAME(Type& a); \
1811 void base_##CBNAME(Type& a)
1814 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1815 void CLASS::CBNAME(Type& a) { \
1817 wxPyBeginBlockThreads(); \
1818 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1819 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1820 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1823 wxPyEndBlockThreads(); \
1825 PCLASS::CBNAME(a); \
1827 void CLASS::base_##CBNAME(Type& a) { \
1828 PCLASS::CBNAME(a); \
1831 //---------------------------------------------------------------------------
1833 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1834 bool CBNAME(Type& a); \
1835 bool base_##CBNAME(Type& a)
1838 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1839 bool CLASS::CBNAME(Type& a) { \
1842 wxPyBeginBlockThreads(); \
1843 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1844 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1845 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1848 wxPyEndBlockThreads(); \
1850 rv = PCLASS::CBNAME(a); \
1853 bool CLASS::base_##CBNAME(Type& a) { \
1854 return PCLASS::CBNAME(a); \
1857 //---------------------------------------------------------------------------
1859 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1860 bool CBNAME(Type& a)
1863 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1864 bool CLASS::CBNAME(Type& a) { \
1866 wxPyBeginBlockThreads(); \
1867 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1868 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1869 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1872 wxPyEndBlockThreads(); \
1876 //---------------------------------------------------------------------------
1878 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1879 wxString CBNAME(long a, long b) const; \
1880 wxString base_##CBNAME(long a, long b) const
1882 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1883 wxString CLASS::CBNAME(long a, long b) const { \
1886 wxPyBeginBlockThreads(); \
1887 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1889 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1891 rval = Py2wxString(ro); \
1895 wxPyEndBlockThreads(); \
1897 rval = PCLASS::CBNAME(a,b); \
1900 wxString CLASS::base_##CBNAME(long a, long b) const { \
1901 return PCLASS::CBNAME(a,b); \
1904 //---------------------------------------------------------------------------
1906 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1907 int CBNAME(long a) const; \
1908 int base_##CBNAME(long a) const
1911 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1912 int CLASS::CBNAME(long a) const { \
1915 wxPyBeginBlockThreads(); \
1916 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1918 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1920 rval = PyInt_AsLong(ro); \
1924 wxPyEndBlockThreads(); \
1926 rval = PCLASS::CBNAME(a); \
1929 int CLASS::base_##CBNAME(long a) const { \
1930 return PCLASS::CBNAME(a); \
1934 //---------------------------------------------------------------------------
1936 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1937 wxListItemAttr* CBNAME(long a) const; \
1938 wxListItemAttr* base_##CBNAME(long a) const
1941 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1942 wxListItemAttr *CLASS::CBNAME(long a) const { \
1943 wxListItemAttr *rval = NULL; \
1945 wxPyBeginBlockThreads(); \
1946 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1948 wxListItemAttr* ptr; \
1949 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1951 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1956 wxPyEndBlockThreads(); \
1958 rval = PCLASS::CBNAME(a); \
1961 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
1962 return PCLASS::CBNAME(a); \
1965 //---------------------------------------------------------------------------
1967 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1968 bool CBNAME(wxMouseEvent& e); \
1969 bool base_##CBNAME(wxMouseEvent& e)
1971 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1972 bool CLASS::CBNAME(wxMouseEvent& e) { \
1975 wxPyBeginBlockThreads(); \
1976 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1978 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1979 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1981 rval = PyInt_AsLong(ro); \
1986 wxPyEndBlockThreads(); \
1988 return PCLASS::CBNAME(e); \
1991 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1992 return PCLASS::CBNAME(e); \
1996 //---------------------------------------------------------------------------
1998 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
1999 wxWizardPage* CBNAME() const
2001 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2002 wxWizardPage* CLASS::CBNAME() const { \
2003 wxWizardPage* rv = NULL; \
2004 wxPyBeginBlockThreads(); \
2005 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2007 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2009 SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
2013 wxPyEndBlockThreads(); \
2017 //---------------------------------------------------------------------------
2019 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2020 wxBitmap CBNAME() const
2022 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2023 wxBitmap CLASS::CBNAME() const { \
2025 wxPyBeginBlockThreads(); \
2026 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2029 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2031 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
2036 wxPyEndBlockThreads(); \
2040 //---------------------------------------------------------------------------
2042 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2045 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2046 wxObject* CLASS::CBNAME() { \
2047 wxObject* rv = NULL; \
2048 wxPyBeginBlockThreads(); \
2049 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2051 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2053 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2057 wxPyEndBlockThreads(); \
2061 //---------------------------------------------------------------------------
2063 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2064 wxObject* CBNAME(const wxString& a)
2066 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2067 wxObject* CLASS::CBNAME(const wxString& a) { \
2068 wxObject* rv = NULL; \
2069 wxPyBeginBlockThreads(); \
2070 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2071 PyObject* so = wx2PyString(a); \
2073 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2075 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2080 wxPyEndBlockThreads(); \
2084 //---------------------------------------------------------------------------
2086 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2087 bool CBNAME(wxXmlNode* a)
2090 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2091 bool CLASS::CBNAME(wxXmlNode* a) { \
2093 wxPyBeginBlockThreads(); \
2094 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2095 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2096 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2099 wxPyEndBlockThreads(); \
2103 //---------------------------------------------------------------------------
2105 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2106 wxCoord CBNAME(size_t a) const
2109 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2110 wxCoord CLASS::CBNAME(size_t a) const { \
2113 wxPyBeginBlockThreads(); \
2114 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2115 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2117 wxPyEndBlockThreads(); \
2121 //---------------------------------------------------------------------------
2123 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2124 void CBNAME(size_t a, size_t b) const; \
2125 void base_##CBNAME(size_t a, size_t b) const
2128 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2129 void CLASS::CBNAME(size_t a, size_t b) const { \
2131 wxPyBeginBlockThreads(); \
2132 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2133 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2134 wxPyEndBlockThreads(); \
2136 PCLASS::CBNAME(a,b); \
2138 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2139 PCLASS::CBNAME(a,b); \
2142 //---------------------------------------------------------------------------
2144 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2145 wxCoord CBNAME() const; \
2146 wxCoord base_##CBNAME() const
2149 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2150 wxCoord CLASS::CBNAME() const { \
2153 wxPyBeginBlockThreads(); \
2154 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2155 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2156 wxPyEndBlockThreads(); \
2158 rval = PCLASS::CBNAME(); \
2161 wxCoord CLASS::base_##CBNAME() const { \
2162 return PCLASS::CBNAME(); \
2165 //---------------------------------------------------------------------------
2167 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2168 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2171 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2172 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2174 wxPyBeginBlockThreads(); \
2175 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2176 PyObject* obj = wxPyMake_wxObject(&a); \
2177 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2178 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2181 wxPyEndBlockThreads(); \
2184 //---------------------------------------------------------------------------
2186 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2187 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2188 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2191 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2192 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2194 wxPyBeginBlockThreads(); \
2195 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2196 PyObject* obj = wxPyMake_wxObject(&a); \
2197 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2198 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2201 wxPyEndBlockThreads(); \
2203 PCLASS::CBNAME(a,b,c); \
2205 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2206 PCLASS::CBNAME(a,b,c); \
2209 //---------------------------------------------------------------------------
2212 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2213 wxString CBNAME(size_t a) const; \
2214 wxString base_##CBNAME(size_t a) const
2216 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2217 wxString CLASS::CBNAME(size_t a) const { \
2220 wxPyBeginBlockThreads(); \
2221 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2223 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2225 rval = Py2wxString(ro); \
2229 wxPyEndBlockThreads(); \
2231 rval = PCLASS::CBNAME(a); \
2234 wxString CLASS::base_##CBNAME(size_t a) const { \
2235 return PCLASS::CBNAME(a); \
2238 //---------------------------------------------------------------------------
2240 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2241 wxString CBNAME(size_t a) const
2243 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2244 wxString CLASS::CBNAME(size_t a) const { \
2247 wxPyBeginBlockThreads(); \
2248 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2250 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2252 rval = Py2wxString(ro); \
2256 wxPyEndBlockThreads(); \
2260 //---------------------------------------------------------------------------