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 //---------------------------------------------------------------------------
20 #ifdef __WXMAC__ // avoid a bug in Carbon headers
23 //---------------------------------------------------------------------------
25 typedef unsigned char byte
;
27 void __wxPreStart(PyObject
*);
28 PyObject
* __wxStart(PyObject
*, PyObject
* args
);
31 //extern PyObject* wxPython_dict;
32 PyObject
* __wxSetDictionary(PyObject
*, PyObject
* args
);
34 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
36 PyObject
* wxPyConstructObject(void* ptr
,
37 const wxString
& className
,
39 PyObject
* wxPyConstructObject(void* ptr
,
40 const wxString
& className
,
44 PyObject
* wx2PyString(const wxString
& src
);
45 wxString
Py2wxString(PyObject
* source
);
47 PyObject
* wxPyClassExists(const wxString
& className
);
48 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=TRUE
);
49 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
50 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
52 PyObject
* wxPy_ConvertList(wxListBase
* list
, const char* className
);
53 long wxPyGetWinHandle(wxWindow
* win
);
55 void wxPy_ReinitStockObjects();
58 //----------------------------------------------------------------------
60 // if we want to handle threads and Python threads are available...
61 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
62 #define WXP_WITH_THREAD
63 #else // no Python threads...
64 #undef WXP_WITH_THREAD
69 PyThreadState
* wxPyBeginAllowThreads();
70 void wxPyEndAllowThreads(PyThreadState
* state
);
73 void wxPyBeginBlockThreads();
74 void wxPyEndBlockThreads();
76 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
78 //----------------------------------------------------------------------
79 // These are helpers used by the typemaps
81 wxString
* wxString_in_helper(PyObject
* source
);
83 byte
* byte_LIST_helper(PyObject
* source
);
84 int* int_LIST_helper(PyObject
* source
);
85 long* long_LIST_helper(PyObject
* source
);
86 char** string_LIST_helper(PyObject
* source
);
87 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
88 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
89 wxString
* wxString_LIST_helper(PyObject
* source
);
90 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
91 wxPen
** wxPen_LIST_helper(PyObject
* source
);
93 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
94 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
95 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
96 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
97 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
99 bool wxPoint2DDouble_helper(PyObject
* source
, wxPoint2DDouble
** obj
);
102 //----------------------------------------------------------------------
103 // Other helpful stuff
105 #if PYTHON_API_VERSION < 1009
106 #define PySequence_Fast_GET_ITEM(o, i) \
107 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
110 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
111 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
114 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
115 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
117 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
118 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
119 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
121 //----------------------------------------------------------------------
122 // functions used by the DrawXXXList enhancements added to wxDC
124 typedef bool (*wxPyDrawListOp_t
)(wxDC
& dc
, PyObject
* coords
);
125 PyObject
* wxPyDrawXXXList(wxDC
& dc
, wxPyDrawListOp_t doDraw
,
126 PyObject
* pyCoords
, PyObject
* pyPens
, PyObject
* pyBrushes
);
127 bool wxPyDrawXXXPoint(wxDC
& dc
, PyObject
* coords
);
128 bool wxPyDrawXXXLine(wxDC
& dc
, PyObject
* coords
);
129 bool wxPyDrawXXXRectangle(wxDC
& dc
, PyObject
* coords
);
130 bool wxPyDrawXXXEllipse(wxDC
& dc
, PyObject
* coords
);
131 bool wxPyDrawXXXPolygon(wxDC
& dc
, PyObject
* coords
);
133 PyObject
* wxPyDrawTextList(wxDC
& dc
, PyObject
* textList
, PyObject
* pyPoints
,
134 PyObject
* foregroundList
, PyObject
* backgroundList
);
136 //----------------------------------------------------------------------
139 extern "C" void SWIG_MakePtr(char *, void *, char *);
140 extern "C" char *SWIG_GetPtr(char *, void **, char *);
141 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
146 # pragma warning(disable:4800)
147 # pragma warning(disable:4190)
150 //----------------------------------------------------------------------
152 class wxPyCallback
: public wxObject
{
153 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
155 wxPyCallback(PyObject
* func
);
156 wxPyCallback(const wxPyCallback
& other
);
159 void EventThunker(wxEvent
& event
);
164 //---------------------------------------------------------------------------
166 class wxPyTimer
: public wxTimer
{
168 wxPyTimer(PyObject
* callback
);
177 //---------------------------------------------------------------------------
178 //---------------------------------------------------------------------------
179 // These Event classes can be derived from in Python and passed through the
180 // event system without loosing anything. They do this by keeping a reference
181 // to themselves and some special case handling in wxPyCallback::EventThunker.
184 class wxPyEvtSelfRef
{
189 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
190 PyObject
* GetSelf() const;
191 bool GetCloned() const { return m_cloned
; }
199 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
200 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
202 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
203 wxPyEvent(const wxPyEvent
& evt
);
206 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
210 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
211 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
213 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
214 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
217 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
222 //----------------------------------------------------------------------
223 // Forward decalre a few things used in the exported API
224 class wxPyClientData
;
226 class wxPyOORClientData
;
227 class wxPyCBInputStream
;
229 void wxPyClientData_dtor(wxPyClientData
* self
);
230 void wxPyUserData_dtor(wxPyUserData
* self
);
231 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
232 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
235 //---------------------------------------------------------------------------
236 // Export a C API in a struct. Other modules will be able to load this from
237 // the wxc module and will then have safe access to these functions, even if
238 // in another shared library.
240 class wxPyCallbackHelper
;
243 // Make SunCC happy and make typedef's for these that are extern "C"
244 typedef void (*p_SWIG_MakePtr_t
)(char*, void*, char*);
245 typedef char* (*p_SWIG_GetPtr_t
)(char*, void**, char*);
246 typedef char* (*p_SWIG_GetPtrObj_t
)(PyObject
*, void**, char*);
247 typedef void (*p_SWIG_RegisterMapping_t
)(char*, char*, void *(*cast
)(void *));
248 typedef void (*p_SWIG_addvarlink_t
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
249 typedef PyObject
* (*p_SWIG_newvarlink_t
)(void);
254 p_SWIG_MakePtr_t p_SWIG_MakePtr
;
255 p_SWIG_GetPtr_t p_SWIG_GetPtr
;
256 p_SWIG_GetPtrObj_t p_SWIG_GetPtrObj
;
257 p_SWIG_RegisterMapping_t p_SWIG_RegisterMapping
;
258 p_SWIG_addvarlink_t p_SWIG_addvarlink
;
259 p_SWIG_newvarlink_t p_SWIG_newvarlink
;
261 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
262 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
263 void (*p_wxPyBeginBlockThreads
)();
264 void (*p_wxPyEndBlockThreads
)();
266 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
267 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
269 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
270 wxString (*p_Py2wxString
)(PyObject
* source
);
271 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
273 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
274 int* (*p_int_LIST_helper
)(PyObject
* source
);
275 long* (*p_long_LIST_helper
)(PyObject
* source
);
276 char** (*p_string_LIST_helper
)(PyObject
* source
);
277 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
278 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
279 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
280 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
282 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
283 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
284 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
285 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
286 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
287 bool (*p_wxPoint2DDouble_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
289 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
290 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
291 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
292 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
293 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
295 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
296 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
297 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
298 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
299 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
300 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
302 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
303 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
304 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
306 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
310 #ifdef wxPyUSE_EXPORT
311 // Notice that this is static, not extern. This is by design, each module
312 // needs one, but doesn't have to use it.
313 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
317 //---------------------------------------------------------------------------
320 class wxPyUserData
: public wxObject
{
322 wxPyUserData(PyObject
* obj
) {
328 #ifdef wxPyUSE_EXPORT
329 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
331 wxPyUserData_dtor(this);
338 class wxPyClientData
: public wxClientData
{
340 wxPyClientData(PyObject
* obj
) {
346 #ifdef wxPyUSE_EXPORT
347 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
349 wxPyClientData_dtor(this);
356 class wxPyOORClientData
: public wxPyClientData
{
358 wxPyOORClientData(PyObject
* obj
)
359 : wxPyClientData(obj
) {}
361 ~wxPyOORClientData() {
362 #ifdef wxPyUSE_EXPORT
363 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
365 wxPyOORClientData_dtor(this);
370 //---------------------------------------------------------------------------
371 // This class holds an instance of a Python Shadow Class object and assists
372 // with looking up and invoking Python callback methods from C++ virtual
373 // method redirections. For all classes which have virtuals which should be
374 // overridable in wxPython, a new subclass is created that contains a
375 // wxPyCallbackHelper.
378 class wxPyCallbackHelper
{
380 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
382 wxPyCallbackHelper() {
389 ~wxPyCallbackHelper() {
390 #ifdef wxPyUSE_EXPORT
391 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
393 wxPyCBH_delete(this);
397 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
398 bool findCallback(const char* name
) const;
399 int callCallback(PyObject
* argTuple
) const;
400 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
405 PyObject
* m_lastFound
;
408 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
412 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
413 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
414 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
415 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
416 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
421 //---------------------------------------------------------------------------
423 // This is used in C++ classes that need to be able to make callback to
424 // "overloaded" python methods
427 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
428 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
430 private: wxPyCallbackHelper m_myInst
433 //---------------------------------------------------------------------------
436 wxPYAPP_ASSERT_SUPPRESS
= 1,
437 wxPYAPP_ASSERT_EXCEPTION
= 2,
438 wxPYAPP_ASSERT_DIALOG
= 4,
439 wxPYAPP_ASSERT_LOG
= 8
442 class wxPyApp
: public wxApp
444 DECLARE_ABSTRACT_CLASS(wxPyApp
);
452 int GetAssertMode() { return m_assertMode
; }
453 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
455 virtual bool OnInitGui();
456 virtual int OnExit();
458 virtual void OnAssert(const wxChar
*file
,
463 // virtual int FilterEvent(wxEvent& event); // This one too????
466 static bool GetMacSupportPCMenuShortcuts();
467 static long GetMacAboutMenuItemId();
468 static long GetMacPreferencesMenuItemId();
469 static long GetMacExitMenuItemId();
470 static wxString
GetMacHelpMenuTitleName();
472 static void SetMacSupportPCMenuShortcuts(bool val
);
473 static void SetMacAboutMenuItemId(long val
);
474 static void SetMacPreferencesMenuItemId(long val
);
475 static void SetMacExitMenuItemId(long val
);
476 static void SetMacHelpMenuTitleName(const wxString
& val
);
483 extern wxPyApp
*wxPythonApp
;
486 //----------------------------------------------------------------------
487 // These macros are used to implement the virtual methods that should
488 // redirect to a Python method if one exists. The names designate the
489 // return type, if any, as well as any parameter types.
490 //---------------------------------------------------------------------------
492 #define DEC_PYCALLBACK__(CBNAME) \
497 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
498 void CLASS::CBNAME() { \
500 wxPyBeginBlockThreads(); \
501 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
502 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
503 wxPyEndBlockThreads(); \
507 void CLASS::base_##CBNAME() { \
511 //---------------------------------------------------------------------------
513 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
514 bool CBNAME(int a, int b); \
515 bool base_##CBNAME(int a, int b)
518 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
519 bool CLASS::CBNAME(int a, int b) { \
520 bool rval=FALSE, found; \
521 wxPyBeginBlockThreads(); \
522 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
523 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
524 wxPyEndBlockThreads(); \
526 rval = PCLASS::CBNAME(a,b); \
529 bool CLASS::base_##CBNAME(int a, int b) { \
530 return PCLASS::CBNAME(a,b); \
533 //---------------------------------------------------------------------------
535 #define DEC_PYCALLBACK_VOID_(CBNAME) \
540 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
541 void CLASS::CBNAME() { \
543 wxPyBeginBlockThreads(); \
544 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
545 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
546 wxPyEndBlockThreads(); \
550 void CLASS::base_##CBNAME() { \
554 //---------------------------------------------------------------------------
556 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
557 void CBNAME(int a, int b); \
558 void base_##CBNAME(int a, int b)
561 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
562 void CLASS::CBNAME(int a, int b) { \
564 wxPyBeginBlockThreads(); \
565 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
566 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
567 wxPyEndBlockThreads(); \
569 PCLASS::CBNAME(a,b); \
571 void CLASS::base_##CBNAME(int a, int b) { \
572 PCLASS::CBNAME(a,b); \
575 //---------------------------------------------------------------------------
577 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
578 void CBNAME(int a); \
579 void base_##CBNAME(int a)
582 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
583 void CLASS::CBNAME(int a) { \
585 wxPyBeginBlockThreads(); \
586 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
587 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
588 wxPyEndBlockThreads(); \
592 void CLASS::base_##CBNAME(int a) { \
596 //---------------------------------------------------------------------------
598 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
599 void CBNAME(int a, int b, int c, int d); \
600 void base_##CBNAME(int a, int b, int c, int d)
603 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
604 void CLASS::CBNAME(int a, int b, int c, int d) { \
606 wxPyBeginBlockThreads(); \
607 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
608 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
609 wxPyEndBlockThreads(); \
611 PCLASS::CBNAME(a,b,c,d); \
613 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
614 PCLASS::CBNAME(a,b,c,d); \
617 //---------------------------------------------------------------------------
618 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
619 void CBNAME(int a, int b, int c, int d, int e); \
620 void base_##CBNAME(int a, int b, int c, int d, int e)
623 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
624 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
626 wxPyBeginBlockThreads(); \
627 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
628 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
629 wxPyEndBlockThreads(); \
631 PCLASS::CBNAME(a,b,c,d,e); \
633 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
634 PCLASS::CBNAME(a,b,c,d,e); \
637 //---------------------------------------------------------------------------
639 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
640 void CBNAME(int* a, int* b) const; \
641 void base_##CBNAME(int* a, int* b) const
644 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
645 void CLASS::CBNAME(int* a, int* b) const { \
646 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
648 wxPyBeginBlockThreads(); \
649 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
651 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
653 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
654 PyObject* o1 = PySequence_GetItem(ro, 0); \
655 PyObject* o2 = PySequence_GetItem(ro, 1); \
656 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
657 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
660 PyErr_SetString(PyExc_TypeError, errmsg); \
665 PyErr_SetString(PyExc_TypeError, errmsg); \
670 wxPyEndBlockThreads(); \
672 PCLASS::CBNAME(a,b); \
674 void CLASS::base_##CBNAME(int* a, int* b) const { \
675 PCLASS::CBNAME(a,b); \
679 //---------------------------------------------------------------------------
681 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
682 wxSize CBNAME() const; \
683 wxSize base_##CBNAME() const
686 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
687 wxSize CLASS::CBNAME() const { \
688 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
689 bool found; wxSize rval(0,0); \
690 wxPyBeginBlockThreads(); \
691 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
693 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
695 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
696 PyObject* o1 = PySequence_GetItem(ro, 0); \
697 PyObject* o2 = PySequence_GetItem(ro, 1); \
698 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
699 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
702 PyErr_SetString(PyExc_TypeError, errmsg); \
707 PyErr_SetString(PyExc_TypeError, errmsg); \
712 wxPyEndBlockThreads(); \
714 return PCLASS::CBNAME(); \
718 wxSize CLASS::base_##CBNAME() const { \
719 return PCLASS::CBNAME(); \
723 //---------------------------------------------------------------------------
725 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
726 bool CBNAME(bool a); \
727 bool base_##CBNAME(bool a)
730 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
731 bool CLASS::CBNAME(bool a) { \
732 bool rval=FALSE, found; \
733 wxPyBeginBlockThreads(); \
734 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
735 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
736 wxPyEndBlockThreads(); \
738 rval = PCLASS::CBNAME(a); \
741 bool CLASS::base_##CBNAME(bool a) { \
742 return PCLASS::CBNAME(a); \
745 //---------------------------------------------------------------------------
747 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
748 bool CBNAME(int a); \
749 bool base_##CBNAME(int a)
752 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
753 bool CLASS::CBNAME(int a) { \
754 bool rval=FALSE, found; \
755 wxPyBeginBlockThreads(); \
756 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
757 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
758 wxPyEndBlockThreads(); \
760 rval = PCLASS::CBNAME(a); \
763 bool CLASS::base_##CBNAME(int a) { \
764 return PCLASS::CBNAME(a); \
767 //---------------------------------------------------------------------------
769 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
773 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
774 bool CLASS::CBNAME(int a) { \
776 wxPyBeginBlockThreads(); \
777 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
778 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
780 wxPyEndBlockThreads(); \
785 //---------------------------------------------------------------------------
787 #define DEC_PYCALLBACK__DC(CBNAME) \
788 void CBNAME(wxDC& a); \
789 void base_##CBNAME(wxDC& a)
792 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
793 void CLASS::CBNAME(wxDC& a) { \
795 wxPyBeginBlockThreads(); \
796 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
797 PyObject* obj = wxPyMake_wxObject(&a); \
798 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
801 wxPyEndBlockThreads(); \
805 void CLASS::base_##CBNAME(wxDC& a) { \
811 //---------------------------------------------------------------------------
813 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
814 void CBNAME(wxDC& a, bool b); \
815 void base_##CBNAME(wxDC& a, bool b)
818 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
819 void CLASS::CBNAME(wxDC& a, bool b) { \
821 wxPyBeginBlockThreads(); \
822 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
823 PyObject* obj = wxPyMake_wxObject(&a); \
824 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
827 wxPyEndBlockThreads(); \
829 PCLASS::CBNAME(a, b); \
831 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
832 PCLASS::CBNAME(a, b); \
835 //---------------------------------------------------------------------------
837 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
838 void CBNAME(wxDC& a, bool b); \
839 void base_##CBNAME(wxDC& a, bool b)
842 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
843 void CLASS::CBNAME(wxDC& a, bool b) { \
845 wxPyBeginBlockThreads(); \
846 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
847 PyObject* obj = wxPyMake_wxObject(&a); \
848 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
851 wxPyEndBlockThreads(); \
853 PCLASS::CBNAME(a, b); \
855 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
856 PCLASS::CBNAME(a, b); \
859 //---------------------------------------------------------------------------
861 #define DEC_PYCALLBACK__2DBL(CBNAME) \
862 void CBNAME(double a, double b); \
863 void base_##CBNAME(double a, double b)
866 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
867 void CLASS::CBNAME(double a, double b) { \
869 wxPyBeginBlockThreads(); \
870 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
871 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
872 wxPyEndBlockThreads(); \
874 PCLASS::CBNAME(a, b); \
876 void CLASS::base_##CBNAME(double a, double b) { \
877 PCLASS::CBNAME(a, b); \
880 //---------------------------------------------------------------------------
882 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
883 void CBNAME(double a, double b, int c, int d); \
884 void base_##CBNAME(double a, double b, int c, int d)
887 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
888 void CLASS::CBNAME(double a, double b, int c, int d) { \
890 wxPyBeginBlockThreads(); \
891 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
892 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
894 wxPyEndBlockThreads(); \
896 PCLASS::CBNAME(a, b, c, d); \
898 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
899 PCLASS::CBNAME(a, b, c, d); \
902 //---------------------------------------------------------------------------
904 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
905 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
906 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
909 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
910 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
912 wxPyBeginBlockThreads(); \
913 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
914 PyObject* obj = wxPyMake_wxObject(&a); \
915 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
918 wxPyEndBlockThreads(); \
920 PCLASS::CBNAME(a, b, c, d, e, f); \
922 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
923 PCLASS::CBNAME(a, b, c, d, e, f); \
926 //---------------------------------------------------------------------------
928 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
929 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
930 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
933 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
934 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
936 wxPyBeginBlockThreads(); \
938 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
939 PyObject* obj = wxPyMake_wxObject(&a); \
940 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
943 wxPyEndBlockThreads(); \
945 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
948 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
949 return PCLASS::CBNAME(a, b, c, d, e, f); \
952 //---------------------------------------------------------------------------
954 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
955 void CBNAME(bool a, double b, double c, int d, int e); \
956 void base_##CBNAME(bool a, double b, double c, int d, int e)
959 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
960 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
962 wxPyBeginBlockThreads(); \
963 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
964 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
966 wxPyEndBlockThreads(); \
968 PCLASS::CBNAME(a, b, c, d, e); \
970 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
971 PCLASS::CBNAME(a, b, c, d, e); \
974 //---------------------------------------------------------------------------
976 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
977 void CBNAME(wxDC& a, double b, double c, double d, double e); \
978 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
981 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
982 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
984 wxPyBeginBlockThreads(); \
985 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
986 PyObject* obj = wxPyMake_wxObject(&a); \
987 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
990 wxPyEndBlockThreads(); \
992 PCLASS::CBNAME(a, b, c, d, e); \
994 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
995 PCLASS::CBNAME(a, b, c, d, e); \
998 //---------------------------------------------------------------------------
1000 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1001 void CBNAME(wxDC& a, bool b); \
1002 void base_##CBNAME(wxDC& a, bool b)
1005 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1006 void CLASS::CBNAME(wxDC& a, bool b) { \
1008 wxPyBeginBlockThreads(); \
1009 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1010 PyObject* obj = wxPyMake_wxObject(&a); \
1011 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1014 wxPyEndBlockThreads(); \
1016 PCLASS::CBNAME(a, b); \
1018 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1019 PCLASS::CBNAME(a, b); \
1022 //---------------------------------------------------------------------------
1024 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1025 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1026 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1029 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1030 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1033 wxPyBeginBlockThreads(); \
1034 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1035 PyObject* obj = wxPyMake_wxObject(a); \
1036 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1039 wxPyEndBlockThreads(); \
1041 PCLASS::CBNAME(a, b, c, d, e, f); \
1043 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1045 PCLASS::CBNAME(a, b, c, d, e, f); \
1048 //---------------------------------------------------------------------------
1050 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1051 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1052 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1055 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1056 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1058 wxPyBeginBlockThreads(); \
1059 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1060 PyObject* obj = wxPyMake_wxObject(a); \
1061 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1064 wxPyEndBlockThreads(); \
1066 PCLASS::CBNAME(a, b, c, d, e); \
1068 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1070 PCLASS::CBNAME(a, b, c, d, e); \
1073 //---------------------------------------------------------------------------
1075 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1076 void CBNAME(double a, double b, int c); \
1077 void base_##CBNAME(double a, double b, int c)
1080 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1081 void CLASS::CBNAME(double a, double b, int c) { \
1083 wxPyBeginBlockThreads(); \
1084 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1085 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1086 wxPyEndBlockThreads(); \
1088 PCLASS::CBNAME(a, b, c); \
1090 void CLASS::base_##CBNAME(double a, double b, int c) { \
1091 PCLASS::CBNAME(a, b, c); \
1094 //---------------------------------------------------------------------------
1096 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1097 void CBNAME(bool a, double b, double c, int d); \
1098 void base_##CBNAME(bool a, double b, double c, int d)
1101 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1102 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1104 wxPyBeginBlockThreads(); \
1105 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1106 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1107 wxPyEndBlockThreads(); \
1109 PCLASS::CBNAME(a, b, c, d); \
1111 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1112 PCLASS::CBNAME(a, b, c, d); \
1115 //---------------------------------------------------------------------------
1116 //---------------------------------------------------------------------------
1118 #define DEC_PYCALLBACK__STRING(CBNAME) \
1119 void CBNAME(const wxString& a); \
1120 void base_##CBNAME(const wxString& a)
1122 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1123 void CLASS::CBNAME(const wxString& a) { \
1125 wxPyBeginBlockThreads(); \
1126 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1127 PyObject* s = wx2PyString(a); \
1128 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1131 wxPyEndBlockThreads(); \
1133 PCLASS::CBNAME(a); \
1135 void CLASS::base_##CBNAME(const wxString& a) { \
1136 PCLASS::CBNAME(a); \
1139 //---------------------------------------------------------------------------
1141 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1142 bool CBNAME(const wxString& a); \
1143 bool base_##CBNAME(const wxString& a)
1145 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1146 bool CLASS::CBNAME(const wxString& a) { \
1149 wxPyBeginBlockThreads(); \
1150 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1151 PyObject* s = wx2PyString(a); \
1152 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1155 wxPyEndBlockThreads(); \
1157 rval = PCLASS::CBNAME(a); \
1160 bool CLASS::base_##CBNAME(const wxString& a) { \
1161 return PCLASS::CBNAME(a); \
1164 //---------------------------------------------------------------------------
1166 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1167 bool CBNAME(const wxString& a)
1169 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1170 bool CLASS::CBNAME(const wxString& a) { \
1172 wxPyBeginBlockThreads(); \
1173 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1174 PyObject* s = wx2PyString(a); \
1175 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1178 wxPyEndBlockThreads(); \
1182 //---------------------------------------------------------------------------
1184 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1185 wxString CBNAME(const wxString& a)
1187 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1188 wxString CLASS::CBNAME(const wxString& a) { \
1190 wxPyBeginBlockThreads(); \
1191 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1193 PyObject* s = wx2PyString(a); \
1194 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1197 rval = Py2wxString(ro); \
1201 wxPyEndBlockThreads(); \
1205 //---------------------------------------------------------------------------
1207 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1208 wxString CBNAME(const wxString& a); \
1209 wxString base_##CBNAME(const wxString& a)
1211 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1212 wxString CLASS::CBNAME(const wxString& a) { \
1215 wxPyBeginBlockThreads(); \
1216 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1218 PyObject* s = wx2PyString(a); \
1219 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1222 rval = Py2wxString(ro); \
1227 rval = PCLASS::CBNAME(a); \
1228 wxPyEndBlockThreads(); \
1232 //---------------------------------------------------------------------------
1234 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1235 wxString CBNAME(const wxString& a,int b)
1237 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1238 wxString CLASS::CBNAME(const wxString& a,int b) { \
1240 wxPyBeginBlockThreads(); \
1241 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1243 PyObject* s = wx2PyString(a); \
1244 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1247 rval = Py2wxString(ro); \
1251 wxPyEndBlockThreads(); \
1255 //---------------------------------------------------------------------------
1257 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1258 bool CBNAME(const wxString& a, const wxString& b); \
1259 bool base_##CBNAME(const wxString& a, const wxString& b)
1261 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1262 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1265 wxPyBeginBlockThreads(); \
1266 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1267 PyObject* s1 = wx2PyString(a); \
1268 PyObject* s2 = wx2PyString(b); \
1269 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1273 wxPyEndBlockThreads(); \
1275 rval = PCLASS::CBNAME(a, b); \
1278 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1279 return PCLASS::CBNAME(a, b); \
1282 //---------------------------------------------------------------------------
1284 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1285 wxString CBNAME(); \
1286 wxString base_##CBNAME()
1288 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1289 wxString CLASS::CBNAME() { \
1292 wxPyBeginBlockThreads(); \
1293 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1295 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1297 rval = Py2wxString(ro); \
1301 wxPyEndBlockThreads(); \
1303 rval = PCLASS::CBNAME(); \
1306 wxString CLASS::base_##CBNAME() { \
1307 return PCLASS::CBNAME(); \
1310 //---------------------------------------------------------------------------
1312 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1313 wxString CBNAME() const; \
1314 wxString base_##CBNAME() const;
1316 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1317 wxString CLASS::CBNAME() const { \
1320 wxPyBeginBlockThreads(); \
1321 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1323 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1325 rval = Py2wxString(ro); \
1329 wxPyEndBlockThreads(); \
1331 rval = PCLASS::CBNAME(); \
1334 wxString CLASS::base_##CBNAME() const { \
1335 return PCLASS::CBNAME(); \
1338 //---------------------------------------------------------------------------
1340 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1343 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1344 wxString CLASS::CBNAME() { \
1346 wxPyBeginBlockThreads(); \
1347 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1349 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1351 rval = Py2wxString(ro); \
1355 wxPyEndBlockThreads(); \
1359 //---------------------------------------------------------------------------
1361 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1362 wxString CBNAME() const;
1364 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1365 wxString CLASS::CBNAME() const { \
1367 wxPyBeginBlockThreads(); \
1368 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1370 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1372 rval = Py2wxString(ro); \
1376 wxPyEndBlockThreads(); \
1380 //---------------------------------------------------------------------------
1382 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1383 bool CBNAME(const wxHtmlTag& a)
1386 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1387 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1389 wxPyBeginBlockThreads(); \
1390 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1391 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1392 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1395 wxPyEndBlockThreads(); \
1399 //---------------------------------------------------------------------------
1401 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1402 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1403 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1405 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1406 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1408 wxPyBeginBlockThreads(); \
1409 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1410 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1411 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1414 wxPyEndBlockThreads(); \
1416 PCLASS::CBNAME(cell, x, y); \
1418 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1419 PCLASS::CBNAME(cell, x, y); \
1423 //---------------------------------------------------------------------------
1425 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1426 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1427 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1429 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1430 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1432 wxPyBeginBlockThreads(); \
1433 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1434 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1435 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1436 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1440 wxPyEndBlockThreads(); \
1442 PCLASS::CBNAME(cell, x, y, e); \
1444 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1445 PCLASS::CBNAME(cell, x, y, e); \
1450 //---------------------------------------------------------------------------
1452 #define DEC_PYCALLBACK___pure(CBNAME) \
1456 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1457 void CLASS::CBNAME() { \
1458 wxPyBeginBlockThreads(); \
1459 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1460 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1461 wxPyEndBlockThreads(); \
1464 //---------------------------------------------------------------------------
1466 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1470 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1471 wxSize CLASS::CBNAME() { \
1472 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1474 wxPyBeginBlockThreads(); \
1475 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1478 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1480 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1482 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1483 PyObject* o1 = PySequence_GetItem(ro, 0); \
1484 PyObject* o2 = PySequence_GetItem(ro, 1); \
1485 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1486 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1488 PyErr_SetString(PyExc_TypeError, errmsg); \
1493 PyErr_SetString(PyExc_TypeError, errmsg); \
1498 wxPyEndBlockThreads(); \
1502 //---------------------------------------------------------------------------
1504 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1505 bool CBNAME(wxWindow* a); \
1506 bool base_##CBNAME(wxWindow* a)
1509 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1510 bool CLASS::CBNAME(wxWindow* a) { \
1513 wxPyBeginBlockThreads(); \
1514 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1515 PyObject* obj = wxPyMake_wxObject(a); \
1516 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1519 wxPyEndBlockThreads(); \
1521 rval = PCLASS::CBNAME(a); \
1524 bool CLASS::base_##CBNAME(wxWindow* a) { \
1525 return PCLASS::CBNAME(a); \
1528 //---------------------------------------------------------------------------
1530 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1531 bool CBNAME(wxWindow* a, wxDC& b); \
1532 bool base_##CBNAME(wxWindow* a, wxDC& b)
1535 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1536 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1539 wxPyBeginBlockThreads(); \
1540 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1541 PyObject* win = wxPyMake_wxObject(a); \
1542 PyObject* dc = wxPyMake_wxObject(&b); \
1543 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1547 wxPyEndBlockThreads(); \
1549 rval = PCLASS::CBNAME(a, b); \
1552 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1553 return PCLASS::CBNAME(a, b); \
1556 //---------------------------------------------------------------------------
1558 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1559 void CBNAME(wxWindowBase* a); \
1560 void base_##CBNAME(wxWindowBase* a)
1563 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1564 void CLASS::CBNAME(wxWindowBase* a) { \
1566 wxPyBeginBlockThreads(); \
1567 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1568 PyObject* obj = wxPyMake_wxObject(a); \
1569 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1572 wxPyEndBlockThreads(); \
1574 PCLASS::CBNAME(a); \
1576 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1577 PCLASS::CBNAME(a); \
1580 //---------------------------------------------------------------------------
1582 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1584 bool base_##CBNAME()
1587 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1588 bool CLASS::CBNAME() { \
1591 wxPyBeginBlockThreads(); \
1592 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1593 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1594 wxPyEndBlockThreads(); \
1596 rval = PCLASS::CBNAME(); \
1599 bool CLASS::base_##CBNAME() { \
1600 return PCLASS::CBNAME(); \
1603 //---------------------------------------------------------------------------
1605 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1606 bool CBNAME() const; \
1607 bool base_##CBNAME() const
1610 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1611 bool CLASS::CBNAME() const { \
1614 wxPyBeginBlockThreads(); \
1615 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1616 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1617 wxPyEndBlockThreads(); \
1619 rval = PCLASS::CBNAME(); \
1622 bool CLASS::base_##CBNAME() const { \
1623 return PCLASS::CBNAME(); \
1626 //---------------------------------------------------------------------------
1628 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1629 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1630 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1633 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1634 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1637 wxPyBeginBlockThreads(); \
1638 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1639 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1640 wxPyEndBlockThreads(); \
1642 rval = PCLASS::CBNAME(a, b, c); \
1643 return (wxDragResult)rval; \
1645 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1646 return PCLASS::CBNAME(a, b, c); \
1649 //---------------------------------------------------------------------------
1651 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1652 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1654 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1655 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1656 wxPyBeginBlockThreads(); \
1658 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1660 PyObject* obj = wxPyMake_wxObject(&a); \
1661 PyObject* s = wx2PyString(b); \
1662 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1665 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1671 wxPyEndBlockThreads(); \
1675 //---------------------------------------------------------------------------
1677 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1678 bool CBNAME(wxDragResult a); \
1679 bool base_##CBNAME(wxDragResult a)
1682 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1683 bool CLASS::CBNAME(wxDragResult a) { \
1686 wxPyBeginBlockThreads(); \
1687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1688 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1689 wxPyEndBlockThreads(); \
1691 rval = PCLASS::CBNAME(a); \
1694 bool CLASS::base_##CBNAME(wxDragResult a) { \
1695 return PCLASS::CBNAME(a); \
1698 //---------------------------------------------------------------------------
1700 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1701 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1704 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1705 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1706 wxPyBeginBlockThreads(); \
1708 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1709 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1710 wxPyEndBlockThreads(); \
1711 return (wxDragResult)rval; \
1714 //---------------------------------------------------------------------------
1716 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1717 bool CBNAME(int a, int b, const wxString& c)
1719 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1720 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1722 wxPyBeginBlockThreads(); \
1723 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1724 PyObject* s = wx2PyString(c); \
1725 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1728 wxPyEndBlockThreads(); \
1732 //---------------------------------------------------------------------------
1734 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1736 size_t base_##CBNAME()
1739 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1740 size_t CLASS::CBNAME() { \
1743 wxPyBeginBlockThreads(); \
1744 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1745 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1746 wxPyEndBlockThreads(); \
1748 rval = PCLASS::CBNAME(); \
1751 size_t CLASS::base_##CBNAME() { \
1752 return PCLASS::CBNAME(); \
1755 //---------------------------------------------------------------------------
1757 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1758 wxDataFormat CBNAME(size_t a); \
1759 wxDataFormat base_##CBNAME(size_t a)
1762 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1763 wxDataFormat CLASS::CBNAME(size_t a) { \
1764 wxDataFormat rval=0; \
1766 wxPyBeginBlockThreads(); \
1767 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1769 wxDataFormat* ptr; \
1770 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1772 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1777 wxPyEndBlockThreads(); \
1779 rval = PCLASS::CBNAME(a); \
1782 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1783 return PCLASS::CBNAME(a); \
1786 //---------------------------------------------------------------------------
1788 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1789 void CBNAME(const Type& a); \
1790 void base_##CBNAME(const Type& a)
1793 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1794 void CLASS::CBNAME(const Type& a) { \
1796 wxPyBeginBlockThreads(); \
1797 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1798 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1799 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1802 wxPyEndBlockThreads(); \
1804 PCLASS::CBNAME(a); \
1806 void CLASS::base_##CBNAME(const Type& a) { \
1807 PCLASS::CBNAME(a); \
1811 //---------------------------------------------------------------------------
1813 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1814 void CBNAME(Type& a); \
1815 void base_##CBNAME(Type& a)
1818 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1819 void CLASS::CBNAME(Type& a) { \
1821 wxPyBeginBlockThreads(); \
1822 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1823 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1824 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1827 wxPyEndBlockThreads(); \
1829 PCLASS::CBNAME(a); \
1831 void CLASS::base_##CBNAME(Type& a) { \
1832 PCLASS::CBNAME(a); \
1835 //---------------------------------------------------------------------------
1837 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1838 bool CBNAME(Type& a); \
1839 bool base_##CBNAME(Type& a)
1842 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1843 bool CLASS::CBNAME(Type& a) { \
1846 wxPyBeginBlockThreads(); \
1847 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1848 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1849 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1852 wxPyEndBlockThreads(); \
1854 rv = PCLASS::CBNAME(a); \
1857 bool CLASS::base_##CBNAME(Type& a) { \
1858 return PCLASS::CBNAME(a); \
1861 //---------------------------------------------------------------------------
1863 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1864 bool CBNAME(Type& a)
1867 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1868 bool CLASS::CBNAME(Type& a) { \
1870 wxPyBeginBlockThreads(); \
1871 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1872 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1873 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1876 wxPyEndBlockThreads(); \
1880 //---------------------------------------------------------------------------
1882 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1883 wxString CBNAME(long a, long b) const; \
1884 wxString base_##CBNAME(long a, long b) const
1886 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1887 wxString CLASS::CBNAME(long a, long b) const { \
1890 wxPyBeginBlockThreads(); \
1891 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1893 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1895 rval = Py2wxString(ro); \
1899 wxPyEndBlockThreads(); \
1901 rval = PCLASS::CBNAME(a,b); \
1904 wxString CLASS::base_##CBNAME(long a, long b) const { \
1905 return PCLASS::CBNAME(a,b); \
1908 //---------------------------------------------------------------------------
1910 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1911 int CBNAME(long a) const; \
1912 int base_##CBNAME(long a) const
1915 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1916 int CLASS::CBNAME(long a) const { \
1919 wxPyBeginBlockThreads(); \
1920 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1922 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1924 rval = PyInt_AsLong(ro); \
1928 wxPyEndBlockThreads(); \
1930 rval = PCLASS::CBNAME(a); \
1933 int CLASS::base_##CBNAME(long a) const { \
1934 return PCLASS::CBNAME(a); \
1938 //---------------------------------------------------------------------------
1940 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1941 wxListItemAttr* CBNAME(long a) const; \
1942 wxListItemAttr* base_##CBNAME(long a) const
1945 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1946 wxListItemAttr *CLASS::CBNAME(long a) const { \
1947 wxListItemAttr *rval = NULL; \
1949 wxPyBeginBlockThreads(); \
1950 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1952 wxListItemAttr* ptr; \
1953 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1955 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1960 wxPyEndBlockThreads(); \
1962 rval = PCLASS::CBNAME(a); \
1965 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
1966 return PCLASS::CBNAME(a); \
1969 //---------------------------------------------------------------------------
1971 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1972 bool CBNAME(wxMouseEvent& e); \
1973 bool base_##CBNAME(wxMouseEvent& e)
1975 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1976 bool CLASS::CBNAME(wxMouseEvent& e) { \
1979 wxPyBeginBlockThreads(); \
1980 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1982 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1983 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1985 rval = PyInt_AsLong(ro); \
1990 wxPyEndBlockThreads(); \
1992 return PCLASS::CBNAME(e); \
1995 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1996 return PCLASS::CBNAME(e); \
2000 //---------------------------------------------------------------------------
2002 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2003 wxWizardPage* CBNAME() const
2005 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2006 wxWizardPage* CLASS::CBNAME() const { \
2007 wxWizardPage* rv = NULL; \
2008 wxPyBeginBlockThreads(); \
2009 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2011 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2013 SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
2017 wxPyEndBlockThreads(); \
2021 //---------------------------------------------------------------------------
2023 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2024 wxBitmap CBNAME() const
2026 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2027 wxBitmap CLASS::CBNAME() const { \
2029 wxPyBeginBlockThreads(); \
2030 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2033 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2035 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
2040 wxPyEndBlockThreads(); \
2044 //---------------------------------------------------------------------------
2046 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2049 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2050 wxObject* CLASS::CBNAME() { \
2051 wxObject* rv = NULL; \
2052 wxPyBeginBlockThreads(); \
2053 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2055 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2057 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2061 wxPyEndBlockThreads(); \
2065 //---------------------------------------------------------------------------
2067 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2068 wxObject* CBNAME(const wxString& a)
2070 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2071 wxObject* CLASS::CBNAME(const wxString& a) { \
2072 wxObject* rv = NULL; \
2073 wxPyBeginBlockThreads(); \
2074 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2075 PyObject* so = wx2PyString(a); \
2077 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2079 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2084 wxPyEndBlockThreads(); \
2088 //---------------------------------------------------------------------------
2090 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2091 bool CBNAME(wxXmlNode* a)
2094 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2095 bool CLASS::CBNAME(wxXmlNode* a) { \
2097 wxPyBeginBlockThreads(); \
2098 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2099 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2100 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2103 wxPyEndBlockThreads(); \
2107 //---------------------------------------------------------------------------
2109 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2110 wxCoord CBNAME(size_t a) const
2113 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2114 wxCoord CLASS::CBNAME(size_t a) const { \
2117 wxPyBeginBlockThreads(); \
2118 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2119 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2121 wxPyEndBlockThreads(); \
2125 //---------------------------------------------------------------------------
2127 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2128 void CBNAME(size_t a, size_t b) const; \
2129 void base_##CBNAME(size_t a, size_t b) const
2132 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2133 void CLASS::CBNAME(size_t a, size_t b) const { \
2135 wxPyBeginBlockThreads(); \
2136 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2137 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2138 wxPyEndBlockThreads(); \
2140 PCLASS::CBNAME(a,b); \
2142 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2143 PCLASS::CBNAME(a,b); \
2146 //---------------------------------------------------------------------------
2148 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2149 wxCoord CBNAME() const; \
2150 wxCoord base_##CBNAME() const
2153 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2154 wxCoord CLASS::CBNAME() const { \
2157 wxPyBeginBlockThreads(); \
2158 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2159 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2160 wxPyEndBlockThreads(); \
2162 rval = PCLASS::CBNAME(); \
2165 wxCoord CLASS::base_##CBNAME() const { \
2166 return PCLASS::CBNAME(); \
2169 //---------------------------------------------------------------------------
2171 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2172 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2175 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2176 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2178 wxPyBeginBlockThreads(); \
2179 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2180 PyObject* obj = wxPyMake_wxObject(&a); \
2181 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2182 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2185 wxPyEndBlockThreads(); \
2188 //---------------------------------------------------------------------------
2190 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2191 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2192 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2195 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2196 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2198 wxPyBeginBlockThreads(); \
2199 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2200 PyObject* obj = wxPyMake_wxObject(&a); \
2201 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2202 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2205 wxPyEndBlockThreads(); \
2207 PCLASS::CBNAME(a,b,c); \
2209 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2210 PCLASS::CBNAME(a,b,c); \
2213 //---------------------------------------------------------------------------
2216 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2217 wxString CBNAME(size_t a) const; \
2218 wxString base_##CBNAME(size_t a) const
2220 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2221 wxString CLASS::CBNAME(size_t a) const { \
2224 wxPyBeginBlockThreads(); \
2225 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2227 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2229 rval = Py2wxString(ro); \
2233 wxPyEndBlockThreads(); \
2235 rval = PCLASS::CBNAME(a); \
2238 wxString CLASS::base_##CBNAME(size_t a) const { \
2239 return PCLASS::CBNAME(a); \
2242 //---------------------------------------------------------------------------
2244 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2245 wxString CBNAME(size_t a) const
2247 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2248 wxString CLASS::CBNAME(size_t a) const { \
2251 wxPyBeginBlockThreads(); \
2252 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2254 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2256 rval = Py2wxString(ro); \
2260 wxPyEndBlockThreads(); \
2264 //---------------------------------------------------------------------------