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 //----------------------------------------------------------------------
53 // if we want to handle threads and Python threads are available...
54 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
55 #define WXP_WITH_THREAD
56 #else // no Python threads...
57 #undef WXP_WITH_THREAD
62 PyThreadState
* wxPyBeginAllowThreads();
63 void wxPyEndAllowThreads(PyThreadState
* state
);
66 void wxPyBeginBlockThreads();
67 void wxPyEndBlockThreads();
69 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
71 //----------------------------------------------------------------------
72 // These are helpers used by the typemaps
74 wxString
* wxString_in_helper(PyObject
* source
);
76 byte
* byte_LIST_helper(PyObject
* source
);
77 int* int_LIST_helper(PyObject
* source
);
78 long* long_LIST_helper(PyObject
* source
);
79 char** string_LIST_helper(PyObject
* source
);
80 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
81 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
82 wxString
* wxString_LIST_helper(PyObject
* source
);
83 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
84 wxPen
** wxPen_LIST_helper(PyObject
* source
);
86 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
87 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
88 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
89 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
90 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
92 bool wxPoint2DDouble_helper(PyObject
* source
, wxPoint2DDouble
** obj
);
95 //----------------------------------------------------------------------
96 // Other helpful stuff
98 #if PYTHON_API_VERSION < 1009
99 #define PySequence_Fast_GET_ITEM(o, i) \
100 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
103 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
104 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
107 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
108 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
110 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
111 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
112 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
114 //----------------------------------------------------------------------
115 // functions used by the DrawXXXList enhancements added to wxDC
117 typedef bool (*wxPyDrawListOp_t
)(wxDC
& dc
, PyObject
* coords
);
118 PyObject
* wxPyDrawXXXList(wxDC
& dc
, wxPyDrawListOp_t doDraw
,
119 PyObject
* pyCoords
, PyObject
* pyPens
, PyObject
* pyBrushes
);
120 bool wxPyDrawXXXPoint(wxDC
& dc
, PyObject
* coords
);
121 bool wxPyDrawXXXLine(wxDC
& dc
, PyObject
* coords
);
122 bool wxPyDrawXXXRectangle(wxDC
& dc
, PyObject
* coords
);
123 bool wxPyDrawXXXEllipse(wxDC
& dc
, PyObject
* coords
);
124 bool wxPyDrawXXXPolygon(wxDC
& dc
, PyObject
* coords
);
126 PyObject
* wxPyDrawTextList(wxDC
& dc
, PyObject
* textList
, PyObject
* pyPoints
,
127 PyObject
* foregroundList
, PyObject
* backgroundList
);
129 //----------------------------------------------------------------------
132 extern "C" void SWIG_MakePtr(char *, void *, char *);
133 extern "C" char *SWIG_GetPtr(char *, void **, char *);
134 extern "C" char *SWIG_GetPtrObj(PyObject
*obj
, void **ptr
, char *type
);
139 # pragma warning(disable:4800)
140 # pragma warning(disable:4190)
143 //----------------------------------------------------------------------
145 class wxPyCallback
: public wxObject
{
146 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
148 wxPyCallback(PyObject
* func
);
149 wxPyCallback(const wxPyCallback
& other
);
152 void EventThunker(wxEvent
& event
);
157 //---------------------------------------------------------------------------
159 class wxPyTimer
: public wxTimer
{
161 wxPyTimer(PyObject
* callback
);
170 //---------------------------------------------------------------------------
171 //---------------------------------------------------------------------------
172 // These Event classes can be derived from in Python and passed through the
173 // event system without loosing anything. They do this by keeping a reference
174 // to themselves and some special case handling in wxPyCallback::EventThunker.
177 class wxPyEvtSelfRef
{
182 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
183 PyObject
* GetSelf() const;
191 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
192 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
195 wxPyEvent(const wxPyEvent
& evt
);
198 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
202 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
203 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
205 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
206 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
209 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
214 //----------------------------------------------------------------------
215 // Forward decalre a few things used in the exported API
216 class wxPyClientData
;
218 class wxPyOORClientData
;
219 class wxPyCBInputStream
;
221 void wxPyClientData_dtor(wxPyClientData
* self
);
222 void wxPyUserData_dtor(wxPyUserData
* self
);
223 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
224 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
227 //---------------------------------------------------------------------------
228 // Export a C API in a struct. Other modules will be able to load this from
229 // the wxc module and will then have safe access to these functions, even if
230 // in another shared library.
232 class wxPyCallbackHelper
;
235 // Make SunCC happy and make typedef's for these that are extern "C"
236 typedef void (*p_SWIG_MakePtr_t
)(char*, void*, char*);
237 typedef char* (*p_SWIG_GetPtr_t
)(char*, void**, char*);
238 typedef char* (*p_SWIG_GetPtrObj_t
)(PyObject
*, void**, char*);
239 typedef void (*p_SWIG_RegisterMapping_t
)(char*, char*, void *(*cast
)(void *));
240 typedef void (*p_SWIG_addvarlink_t
)(PyObject
*, char*, PyObject
*(*get_attr
)(void), int (*set_attr
)(PyObject
*p
));
241 typedef PyObject
* (*p_SWIG_newvarlink_t
)(void);
246 p_SWIG_MakePtr_t p_SWIG_MakePtr
;
247 p_SWIG_GetPtr_t p_SWIG_GetPtr
;
248 p_SWIG_GetPtrObj_t p_SWIG_GetPtrObj
;
249 p_SWIG_RegisterMapping_t p_SWIG_RegisterMapping
;
250 p_SWIG_addvarlink_t p_SWIG_addvarlink
;
251 p_SWIG_newvarlink_t p_SWIG_newvarlink
;
253 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
254 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
255 void (*p_wxPyBeginBlockThreads
)();
256 void (*p_wxPyEndBlockThreads
)();
258 PyObject
* (*p_wxPyConstructObject
)(void *, const wxString
&, int);
259 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
, const char* className
);
261 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
262 wxString (*p_Py2wxString
)(PyObject
* source
);
263 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
265 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
266 int* (*p_int_LIST_helper
)(PyObject
* source
);
267 long* (*p_long_LIST_helper
)(PyObject
* source
);
268 char** (*p_string_LIST_helper
)(PyObject
* source
);
269 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
270 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
271 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
272 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
274 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
275 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
276 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
277 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
278 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
279 bool (*p_wxPoint2DDouble_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
281 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
282 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
283 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
284 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
285 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
287 PyObject
* (*p_wxPyClassExists
)(const wxString
& className
);
288 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
289 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
290 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
291 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
292 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
294 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
295 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
296 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
298 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
302 #ifdef wxPyUSE_EXPORT
303 // Notice that this is static, not extern. This is by design, each module
304 // needs one, but doesn't have to use it.
305 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
309 //---------------------------------------------------------------------------
312 class wxPyUserData
: public wxObject
{
314 wxPyUserData(PyObject
* obj
) {
320 #ifdef wxPyUSE_EXPORT
321 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
323 wxPyUserData_dtor(this);
330 class wxPyClientData
: public wxClientData
{
332 wxPyClientData(PyObject
* obj
) {
338 #ifdef wxPyUSE_EXPORT
339 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
341 wxPyClientData_dtor(this);
348 class wxPyOORClientData
: public wxPyClientData
{
350 wxPyOORClientData(PyObject
* obj
)
351 : wxPyClientData(obj
) {}
353 ~wxPyOORClientData() {
354 #ifdef wxPyUSE_EXPORT
355 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
357 wxPyOORClientData_dtor(this);
362 //---------------------------------------------------------------------------
363 // This class holds an instance of a Python Shadow Class object and assists
364 // with looking up and invoking Python callback methods from C++ virtual
365 // method redirections. For all classes which have virtuals which should be
366 // overridable in wxPython, a new subclass is created that contains a
367 // wxPyCallbackHelper.
370 class wxPyCallbackHelper
{
372 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
374 wxPyCallbackHelper() {
381 ~wxPyCallbackHelper() {
382 #ifdef wxPyUSE_EXPORT
383 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
385 wxPyCBH_delete(this);
389 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
390 bool findCallback(const char* name
) const;
391 int callCallback(PyObject
* argTuple
) const;
392 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
397 PyObject
* m_lastFound
;
400 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
404 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
405 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
406 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
407 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
408 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
413 //---------------------------------------------------------------------------
415 // This is used in C++ classes that need to be able to make callback to
416 // "overloaded" python methods
419 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
420 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
422 private: wxPyCallbackHelper m_myInst
425 //---------------------------------------------------------------------------
428 wxPYAPP_ASSERT_SUPPRESS
= 1,
429 wxPYAPP_ASSERT_EXCEPTION
= 2,
430 wxPYAPP_ASSERT_DIALOG
= 4,
431 wxPYAPP_ASSERT_LOG
= 8
434 class wxPyApp
: public wxApp
436 DECLARE_ABSTRACT_CLASS(wxPyApp
);
444 int GetAssertMode() { return m_assertMode
; }
445 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
447 virtual bool OnInitGui();
448 virtual int OnExit();
450 virtual void OnAssert(const wxChar
*file
,
455 // virtual int FilterEvent(wxEvent& event); // This one too????
458 static bool GetMacDefaultEncodingIsPC();
459 static bool GetMacSupportPCMenuShortcuts();
460 static long GetMacAboutMenuItemId();
461 static long GetMacPreferencesMenuItemId();
462 static long GetMacExitMenuItemId();
463 static wxString
GetMacHelpMenuTitleName();
465 static void SetMacDefaultEncodingIsPC(bool val
);
466 static void SetMacSupportPCMenuShortcuts(bool val
);
467 static void SetMacAboutMenuItemId(long val
);
468 static void SetMacPreferencesMenuItemId(long val
);
469 static void SetMacExitMenuItemId(long val
);
470 static void SetMacHelpMenuTitleName(const wxString
& val
);
477 extern wxPyApp
*wxPythonApp
;
480 //----------------------------------------------------------------------
481 // These macros are used to implement the virtual methods that should
482 // redirect to a Python method if one exists. The names designate the
483 // return type, if any, as well as any parameter types.
484 //---------------------------------------------------------------------------
486 #define DEC_PYCALLBACK__(CBNAME) \
491 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
492 void CLASS::CBNAME() { \
494 wxPyBeginBlockThreads(); \
495 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
496 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
497 wxPyEndBlockThreads(); \
501 void CLASS::base_##CBNAME() { \
505 //---------------------------------------------------------------------------
507 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
508 bool CBNAME(int a, int b); \
509 bool base_##CBNAME(int a, int b)
512 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
513 bool CLASS::CBNAME(int a, int b) { \
514 bool rval=FALSE, found; \
515 wxPyBeginBlockThreads(); \
516 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
517 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
518 wxPyEndBlockThreads(); \
520 rval = PCLASS::CBNAME(a,b); \
523 bool CLASS::base_##CBNAME(int a, int b) { \
524 return PCLASS::CBNAME(a,b); \
527 //---------------------------------------------------------------------------
529 #define DEC_PYCALLBACK_VOID_(CBNAME) \
534 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
535 void CLASS::CBNAME() { \
537 wxPyBeginBlockThreads(); \
538 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
539 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
540 wxPyEndBlockThreads(); \
544 void CLASS::base_##CBNAME() { \
548 //---------------------------------------------------------------------------
550 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
551 void CBNAME(int a, int b); \
552 void base_##CBNAME(int a, int b)
555 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
556 void CLASS::CBNAME(int a, int b) { \
558 wxPyBeginBlockThreads(); \
559 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
560 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
561 wxPyEndBlockThreads(); \
563 PCLASS::CBNAME(a,b); \
565 void CLASS::base_##CBNAME(int a, int b) { \
566 PCLASS::CBNAME(a,b); \
569 //---------------------------------------------------------------------------
571 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
572 void CBNAME(int a); \
573 void base_##CBNAME(int a)
576 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
577 void CLASS::CBNAME(int a) { \
579 wxPyBeginBlockThreads(); \
580 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
581 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
582 wxPyEndBlockThreads(); \
586 void CLASS::base_##CBNAME(int a) { \
590 //---------------------------------------------------------------------------
592 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
593 void CBNAME(int a, int b, int c, int d); \
594 void base_##CBNAME(int a, int b, int c, int d)
597 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
598 void CLASS::CBNAME(int a, int b, int c, int d) { \
600 wxPyBeginBlockThreads(); \
601 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
602 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
603 wxPyEndBlockThreads(); \
605 PCLASS::CBNAME(a,b,c,d); \
607 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
608 PCLASS::CBNAME(a,b,c,d); \
611 //---------------------------------------------------------------------------
612 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
613 void CBNAME(int a, int b, int c, int d, int e); \
614 void base_##CBNAME(int a, int b, int c, int d, int e)
617 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
618 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
620 wxPyBeginBlockThreads(); \
621 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
622 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
623 wxPyEndBlockThreads(); \
625 PCLASS::CBNAME(a,b,c,d,e); \
627 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
628 PCLASS::CBNAME(a,b,c,d,e); \
631 //---------------------------------------------------------------------------
633 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
634 void CBNAME(int* a, int* b) const; \
635 void base_##CBNAME(int* a, int* b) const
638 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
639 void CLASS::CBNAME(int* a, int* b) const { \
640 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
642 wxPyBeginBlockThreads(); \
643 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
645 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
647 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
648 PyObject* o1 = PySequence_GetItem(ro, 0); \
649 PyObject* o2 = PySequence_GetItem(ro, 1); \
650 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
651 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
654 PyErr_SetString(PyExc_TypeError, errmsg); \
659 PyErr_SetString(PyExc_TypeError, errmsg); \
664 wxPyEndBlockThreads(); \
666 PCLASS::CBNAME(a,b); \
668 void CLASS::base_##CBNAME(int* a, int* b) const { \
669 PCLASS::CBNAME(a,b); \
673 //---------------------------------------------------------------------------
675 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
676 wxSize CBNAME() const; \
677 wxSize base_##CBNAME() const
680 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
681 wxSize CLASS::CBNAME() const { \
682 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
683 bool found; wxSize rval(0,0); \
684 wxPyBeginBlockThreads(); \
685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
687 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
689 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
690 PyObject* o1 = PySequence_GetItem(ro, 0); \
691 PyObject* o2 = PySequence_GetItem(ro, 1); \
692 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
693 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
696 PyErr_SetString(PyExc_TypeError, errmsg); \
701 PyErr_SetString(PyExc_TypeError, errmsg); \
706 wxPyEndBlockThreads(); \
708 return PCLASS::CBNAME(); \
712 wxSize CLASS::base_##CBNAME() const { \
713 return PCLASS::CBNAME(); \
717 //---------------------------------------------------------------------------
719 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
720 bool CBNAME(bool a); \
721 bool base_##CBNAME(bool a)
724 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
725 bool CLASS::CBNAME(bool a) { \
726 bool rval=FALSE, found; \
727 wxPyBeginBlockThreads(); \
728 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
729 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
730 wxPyEndBlockThreads(); \
732 rval = PCLASS::CBNAME(a); \
735 bool CLASS::base_##CBNAME(bool a) { \
736 return PCLASS::CBNAME(a); \
739 //---------------------------------------------------------------------------
741 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
742 bool CBNAME(int a); \
743 bool base_##CBNAME(int a)
746 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
747 bool CLASS::CBNAME(int a) { \
748 bool rval=FALSE, found; \
749 wxPyBeginBlockThreads(); \
750 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
751 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
752 wxPyEndBlockThreads(); \
754 rval = PCLASS::CBNAME(a); \
757 bool CLASS::base_##CBNAME(int a) { \
758 return PCLASS::CBNAME(a); \
761 //---------------------------------------------------------------------------
763 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
767 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
768 bool CLASS::CBNAME(int a) { \
770 wxPyBeginBlockThreads(); \
771 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
772 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
774 wxPyEndBlockThreads(); \
779 //---------------------------------------------------------------------------
781 #define DEC_PYCALLBACK__DC(CBNAME) \
782 void CBNAME(wxDC& a); \
783 void base_##CBNAME(wxDC& a)
786 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
787 void CLASS::CBNAME(wxDC& a) { \
789 wxPyBeginBlockThreads(); \
790 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
791 PyObject* obj = wxPyMake_wxObject(&a); \
792 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
795 wxPyEndBlockThreads(); \
799 void CLASS::base_##CBNAME(wxDC& a) { \
805 //---------------------------------------------------------------------------
807 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
808 void CBNAME(wxDC& a, bool b); \
809 void base_##CBNAME(wxDC& a, bool b)
812 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
813 void CLASS::CBNAME(wxDC& a, bool b) { \
815 wxPyBeginBlockThreads(); \
816 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
817 PyObject* obj = wxPyMake_wxObject(&a); \
818 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
821 wxPyEndBlockThreads(); \
823 PCLASS::CBNAME(a, b); \
825 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
826 PCLASS::CBNAME(a, b); \
829 //---------------------------------------------------------------------------
831 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
832 void CBNAME(wxDC& a, bool b); \
833 void base_##CBNAME(wxDC& a, bool b)
836 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
837 void CLASS::CBNAME(wxDC& a, bool b) { \
839 wxPyBeginBlockThreads(); \
840 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
841 PyObject* obj = wxPyMake_wxObject(&a); \
842 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
845 wxPyEndBlockThreads(); \
847 PCLASS::CBNAME(a, b); \
849 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
850 PCLASS::CBNAME(a, b); \
853 //---------------------------------------------------------------------------
855 #define DEC_PYCALLBACK__2DBL(CBNAME) \
856 void CBNAME(double a, double b); \
857 void base_##CBNAME(double a, double b)
860 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
861 void CLASS::CBNAME(double a, double b) { \
863 wxPyBeginBlockThreads(); \
864 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
865 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
866 wxPyEndBlockThreads(); \
868 PCLASS::CBNAME(a, b); \
870 void CLASS::base_##CBNAME(double a, double b) { \
871 PCLASS::CBNAME(a, b); \
874 //---------------------------------------------------------------------------
876 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
877 void CBNAME(double a, double b, int c, int d); \
878 void base_##CBNAME(double a, double b, int c, int d)
881 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
882 void CLASS::CBNAME(double a, double b, int c, int d) { \
884 wxPyBeginBlockThreads(); \
885 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
886 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
888 wxPyEndBlockThreads(); \
890 PCLASS::CBNAME(a, b, c, d); \
892 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
893 PCLASS::CBNAME(a, b, c, d); \
896 //---------------------------------------------------------------------------
898 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
899 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
900 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
903 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
904 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
906 wxPyBeginBlockThreads(); \
907 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
908 PyObject* obj = wxPyMake_wxObject(&a); \
909 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
912 wxPyEndBlockThreads(); \
914 PCLASS::CBNAME(a, b, c, d, e, f); \
916 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
917 PCLASS::CBNAME(a, b, c, d, e, f); \
920 //---------------------------------------------------------------------------
922 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
923 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
924 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
927 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
928 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
930 wxPyBeginBlockThreads(); \
932 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
933 PyObject* obj = wxPyMake_wxObject(&a); \
934 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
937 wxPyEndBlockThreads(); \
939 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
942 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
943 return PCLASS::CBNAME(a, b, c, d, e, f); \
946 //---------------------------------------------------------------------------
948 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
949 void CBNAME(bool a, double b, double c, int d, int e); \
950 void base_##CBNAME(bool a, double b, double c, int d, int e)
953 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
954 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
956 wxPyBeginBlockThreads(); \
957 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
958 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
960 wxPyEndBlockThreads(); \
962 PCLASS::CBNAME(a, b, c, d, e); \
964 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
965 PCLASS::CBNAME(a, b, c, d, e); \
968 //---------------------------------------------------------------------------
970 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
971 void CBNAME(wxDC& a, double b, double c, double d, double e); \
972 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
975 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
976 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
978 wxPyBeginBlockThreads(); \
979 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
980 PyObject* obj = wxPyMake_wxObject(&a); \
981 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
984 wxPyEndBlockThreads(); \
986 PCLASS::CBNAME(a, b, c, d, e); \
988 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
989 PCLASS::CBNAME(a, b, c, d, e); \
992 //---------------------------------------------------------------------------
994 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
995 void CBNAME(wxDC& a, bool b); \
996 void base_##CBNAME(wxDC& a, bool b)
999 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1000 void CLASS::CBNAME(wxDC& a, bool b) { \
1002 wxPyBeginBlockThreads(); \
1003 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1004 PyObject* obj = wxPyMake_wxObject(&a); \
1005 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1008 wxPyEndBlockThreads(); \
1010 PCLASS::CBNAME(a, b); \
1012 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1013 PCLASS::CBNAME(a, b); \
1016 //---------------------------------------------------------------------------
1018 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1019 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1020 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1023 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1024 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1027 wxPyBeginBlockThreads(); \
1028 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1029 PyObject* obj = wxPyMake_wxObject(a); \
1030 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1033 wxPyEndBlockThreads(); \
1035 PCLASS::CBNAME(a, b, c, d, e, f); \
1037 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1039 PCLASS::CBNAME(a, b, c, d, e, f); \
1042 //---------------------------------------------------------------------------
1044 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1045 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1046 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1049 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1050 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1052 wxPyBeginBlockThreads(); \
1053 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1054 PyObject* obj = wxPyMake_wxObject(a); \
1055 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1058 wxPyEndBlockThreads(); \
1060 PCLASS::CBNAME(a, b, c, d, e); \
1062 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1064 PCLASS::CBNAME(a, b, c, d, e); \
1067 //---------------------------------------------------------------------------
1069 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1070 void CBNAME(double a, double b, int c); \
1071 void base_##CBNAME(double a, double b, int c)
1074 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1075 void CLASS::CBNAME(double a, double b, int c) { \
1077 wxPyBeginBlockThreads(); \
1078 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1079 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1080 wxPyEndBlockThreads(); \
1082 PCLASS::CBNAME(a, b, c); \
1084 void CLASS::base_##CBNAME(double a, double b, int c) { \
1085 PCLASS::CBNAME(a, b, c); \
1088 //---------------------------------------------------------------------------
1090 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1091 void CBNAME(bool a, double b, double c, int d); \
1092 void base_##CBNAME(bool a, double b, double c, int d)
1095 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1096 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1098 wxPyBeginBlockThreads(); \
1099 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1100 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1101 wxPyEndBlockThreads(); \
1103 PCLASS::CBNAME(a, b, c, d); \
1105 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1106 PCLASS::CBNAME(a, b, c, d); \
1109 //---------------------------------------------------------------------------
1110 //---------------------------------------------------------------------------
1112 #define DEC_PYCALLBACK__STRING(CBNAME) \
1113 void CBNAME(const wxString& a); \
1114 void base_##CBNAME(const wxString& a)
1116 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1117 void CLASS::CBNAME(const wxString& a) { \
1119 wxPyBeginBlockThreads(); \
1120 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1121 PyObject* s = wx2PyString(a); \
1122 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1125 wxPyEndBlockThreads(); \
1127 PCLASS::CBNAME(a); \
1129 void CLASS::base_##CBNAME(const wxString& a) { \
1130 PCLASS::CBNAME(a); \
1133 //---------------------------------------------------------------------------
1135 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1136 bool CBNAME(const wxString& a); \
1137 bool base_##CBNAME(const wxString& a)
1139 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1140 bool CLASS::CBNAME(const wxString& a) { \
1143 wxPyBeginBlockThreads(); \
1144 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1145 PyObject* s = wx2PyString(a); \
1146 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1149 wxPyEndBlockThreads(); \
1151 rval = PCLASS::CBNAME(a); \
1154 bool CLASS::base_##CBNAME(const wxString& a) { \
1155 return PCLASS::CBNAME(a); \
1158 //---------------------------------------------------------------------------
1160 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1161 bool CBNAME(const wxString& a)
1163 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1164 bool CLASS::CBNAME(const wxString& a) { \
1166 wxPyBeginBlockThreads(); \
1167 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1168 PyObject* s = wx2PyString(a); \
1169 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1172 wxPyEndBlockThreads(); \
1176 //---------------------------------------------------------------------------
1178 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1179 wxString CBNAME(const wxString& a)
1181 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1182 wxString CLASS::CBNAME(const wxString& a) { \
1184 wxPyBeginBlockThreads(); \
1185 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1187 PyObject* s = wx2PyString(a); \
1188 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1191 rval = Py2wxString(ro); \
1195 wxPyEndBlockThreads(); \
1199 //---------------------------------------------------------------------------
1201 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1202 wxString CBNAME(const wxString& a); \
1203 wxString base_##CBNAME(const wxString& a)
1205 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1206 wxString CLASS::CBNAME(const wxString& a) { \
1209 wxPyBeginBlockThreads(); \
1210 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1212 PyObject* s = wx2PyString(a); \
1213 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1216 rval = Py2wxString(ro); \
1221 rval = PCLASS::CBNAME(a); \
1222 wxPyEndBlockThreads(); \
1226 //---------------------------------------------------------------------------
1228 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1229 wxString CBNAME(const wxString& a,int b)
1231 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1232 wxString CLASS::CBNAME(const wxString& a,int b) { \
1234 wxPyBeginBlockThreads(); \
1235 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1237 PyObject* s = wx2PyString(a); \
1238 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1241 rval = Py2wxString(ro); \
1245 wxPyEndBlockThreads(); \
1249 //---------------------------------------------------------------------------
1251 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1252 bool CBNAME(const wxString& a, const wxString& b); \
1253 bool base_##CBNAME(const wxString& a, const wxString& b)
1255 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1256 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1259 wxPyBeginBlockThreads(); \
1260 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1261 PyObject* s1 = wx2PyString(a); \
1262 PyObject* s2 = wx2PyString(b); \
1263 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1267 wxPyEndBlockThreads(); \
1269 rval = PCLASS::CBNAME(a, b); \
1272 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1273 return PCLASS::CBNAME(a, b); \
1276 //---------------------------------------------------------------------------
1278 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1279 wxString CBNAME(); \
1280 wxString base_##CBNAME()
1282 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1283 wxString CLASS::CBNAME() { \
1286 wxPyBeginBlockThreads(); \
1287 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1289 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1291 rval = Py2wxString(ro); \
1295 wxPyEndBlockThreads(); \
1297 rval = PCLASS::CBNAME(); \
1300 wxString CLASS::base_##CBNAME() { \
1301 return PCLASS::CBNAME(); \
1304 //---------------------------------------------------------------------------
1306 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1307 wxString CBNAME() const; \
1308 wxString base_##CBNAME() const;
1310 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1311 wxString CLASS::CBNAME() const { \
1314 wxPyBeginBlockThreads(); \
1315 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1317 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1319 rval = Py2wxString(ro); \
1323 wxPyEndBlockThreads(); \
1325 rval = PCLASS::CBNAME(); \
1328 wxString CLASS::base_##CBNAME() const { \
1329 return PCLASS::CBNAME(); \
1332 //---------------------------------------------------------------------------
1334 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1337 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1338 wxString CLASS::CBNAME() { \
1340 wxPyBeginBlockThreads(); \
1341 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1343 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1345 rval = Py2wxString(ro); \
1349 wxPyEndBlockThreads(); \
1353 //---------------------------------------------------------------------------
1355 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1356 wxString CBNAME() const;
1358 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1359 wxString CLASS::CBNAME() const { \
1361 wxPyBeginBlockThreads(); \
1362 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1364 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1366 rval = Py2wxString(ro); \
1370 wxPyEndBlockThreads(); \
1374 //---------------------------------------------------------------------------
1376 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1377 bool CBNAME(const wxHtmlTag& a)
1380 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1381 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1383 wxPyBeginBlockThreads(); \
1384 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1385 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1386 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1389 wxPyEndBlockThreads(); \
1393 //---------------------------------------------------------------------------
1395 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1396 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1397 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1399 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1400 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1402 wxPyBeginBlockThreads(); \
1403 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1404 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1405 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1408 wxPyEndBlockThreads(); \
1410 PCLASS::CBNAME(cell, x, y); \
1412 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1413 PCLASS::CBNAME(cell, x, y); \
1417 //---------------------------------------------------------------------------
1419 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1420 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1421 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1423 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1424 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1426 wxPyBeginBlockThreads(); \
1427 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1428 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1429 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1430 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1434 wxPyEndBlockThreads(); \
1436 PCLASS::CBNAME(cell, x, y, e); \
1438 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1439 PCLASS::CBNAME(cell, x, y, e); \
1444 //---------------------------------------------------------------------------
1446 #define DEC_PYCALLBACK___pure(CBNAME) \
1450 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1451 void CLASS::CBNAME() { \
1452 wxPyBeginBlockThreads(); \
1453 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1454 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1455 wxPyEndBlockThreads(); \
1458 //---------------------------------------------------------------------------
1460 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1464 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1465 wxSize CLASS::CBNAME() { \
1466 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1468 wxPyBeginBlockThreads(); \
1469 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1472 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1474 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1476 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1477 PyObject* o1 = PySequence_GetItem(ro, 0); \
1478 PyObject* o2 = PySequence_GetItem(ro, 1); \
1479 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1480 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1482 PyErr_SetString(PyExc_TypeError, errmsg); \
1487 PyErr_SetString(PyExc_TypeError, errmsg); \
1492 wxPyEndBlockThreads(); \
1496 //---------------------------------------------------------------------------
1498 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1499 bool CBNAME(wxWindow* a); \
1500 bool base_##CBNAME(wxWindow* a)
1503 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1504 bool CLASS::CBNAME(wxWindow* a) { \
1507 wxPyBeginBlockThreads(); \
1508 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1509 PyObject* obj = wxPyMake_wxObject(a); \
1510 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1513 wxPyEndBlockThreads(); \
1515 rval = PCLASS::CBNAME(a); \
1518 bool CLASS::base_##CBNAME(wxWindow* a) { \
1519 return PCLASS::CBNAME(a); \
1522 //---------------------------------------------------------------------------
1524 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1525 bool CBNAME(wxWindow* a, wxDC& b); \
1526 bool base_##CBNAME(wxWindow* a, wxDC& b)
1529 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1530 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1533 wxPyBeginBlockThreads(); \
1534 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1535 PyObject* win = wxPyMake_wxObject(a); \
1536 PyObject* dc = wxPyMake_wxObject(&b); \
1537 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1541 wxPyEndBlockThreads(); \
1543 rval = PCLASS::CBNAME(a, b); \
1546 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1547 return PCLASS::CBNAME(a, b); \
1550 //---------------------------------------------------------------------------
1552 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1553 void CBNAME(wxWindowBase* a); \
1554 void base_##CBNAME(wxWindowBase* a)
1557 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1558 void CLASS::CBNAME(wxWindowBase* a) { \
1560 wxPyBeginBlockThreads(); \
1561 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1562 PyObject* obj = wxPyMake_wxObject(a); \
1563 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1566 wxPyEndBlockThreads(); \
1568 PCLASS::CBNAME(a); \
1570 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1571 PCLASS::CBNAME(a); \
1574 //---------------------------------------------------------------------------
1576 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1578 bool base_##CBNAME()
1581 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1582 bool CLASS::CBNAME() { \
1585 wxPyBeginBlockThreads(); \
1586 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1587 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1588 wxPyEndBlockThreads(); \
1590 rval = PCLASS::CBNAME(); \
1593 bool CLASS::base_##CBNAME() { \
1594 return PCLASS::CBNAME(); \
1597 //---------------------------------------------------------------------------
1599 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1600 bool CBNAME() const; \
1601 bool base_##CBNAME() const
1604 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1605 bool CLASS::CBNAME() const { \
1608 wxPyBeginBlockThreads(); \
1609 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1610 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1611 wxPyEndBlockThreads(); \
1613 rval = PCLASS::CBNAME(); \
1616 bool CLASS::base_##CBNAME() const { \
1617 return PCLASS::CBNAME(); \
1620 //---------------------------------------------------------------------------
1622 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1623 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1624 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1627 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1628 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1631 wxPyBeginBlockThreads(); \
1632 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1633 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1634 wxPyEndBlockThreads(); \
1636 rval = PCLASS::CBNAME(a, b, c); \
1637 return (wxDragResult)rval; \
1639 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1640 return PCLASS::CBNAME(a, b, c); \
1643 //---------------------------------------------------------------------------
1645 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1646 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1648 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1649 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1650 wxPyBeginBlockThreads(); \
1652 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1654 PyObject* obj = wxPyMake_wxObject(&a); \
1655 PyObject* s = wx2PyString(b); \
1656 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1659 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1665 wxPyEndBlockThreads(); \
1669 //---------------------------------------------------------------------------
1671 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1672 bool CBNAME(wxDragResult a); \
1673 bool base_##CBNAME(wxDragResult a)
1676 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1677 bool CLASS::CBNAME(wxDragResult a) { \
1680 wxPyBeginBlockThreads(); \
1681 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1682 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1683 wxPyEndBlockThreads(); \
1685 rval = PCLASS::CBNAME(a); \
1688 bool CLASS::base_##CBNAME(wxDragResult a) { \
1689 return PCLASS::CBNAME(a); \
1692 //---------------------------------------------------------------------------
1694 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1695 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1698 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1699 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1700 wxPyBeginBlockThreads(); \
1702 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1703 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1704 wxPyEndBlockThreads(); \
1705 return (wxDragResult)rval; \
1708 //---------------------------------------------------------------------------
1710 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1711 bool CBNAME(int a, int b, const wxString& c)
1713 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1714 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1716 wxPyBeginBlockThreads(); \
1717 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1718 PyObject* s = wx2PyString(c); \
1719 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1722 wxPyEndBlockThreads(); \
1726 //---------------------------------------------------------------------------
1728 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1730 size_t base_##CBNAME()
1733 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1734 size_t CLASS::CBNAME() { \
1737 wxPyBeginBlockThreads(); \
1738 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1739 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1740 wxPyEndBlockThreads(); \
1742 rval = PCLASS::CBNAME(); \
1745 size_t CLASS::base_##CBNAME() { \
1746 return PCLASS::CBNAME(); \
1749 //---------------------------------------------------------------------------
1751 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1752 wxDataFormat CBNAME(size_t a); \
1753 wxDataFormat base_##CBNAME(size_t a)
1756 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1757 wxDataFormat CLASS::CBNAME(size_t a) { \
1758 wxDataFormat rval=0; \
1760 wxPyBeginBlockThreads(); \
1761 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1763 wxDataFormat* ptr; \
1764 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1766 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1771 wxPyEndBlockThreads(); \
1773 rval = PCLASS::CBNAME(a); \
1776 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1777 return PCLASS::CBNAME(a); \
1780 //---------------------------------------------------------------------------
1782 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1783 void CBNAME(const Type& a); \
1784 void base_##CBNAME(const Type& a)
1787 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1788 void CLASS::CBNAME(const Type& a) { \
1790 wxPyBeginBlockThreads(); \
1791 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1792 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1793 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1796 wxPyEndBlockThreads(); \
1798 PCLASS::CBNAME(a); \
1800 void CLASS::base_##CBNAME(const Type& a) { \
1801 PCLASS::CBNAME(a); \
1805 //---------------------------------------------------------------------------
1807 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1808 void CBNAME(Type& a); \
1809 void base_##CBNAME(Type& a)
1812 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1813 void CLASS::CBNAME(Type& a) { \
1815 wxPyBeginBlockThreads(); \
1816 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1817 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1818 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1821 wxPyEndBlockThreads(); \
1823 PCLASS::CBNAME(a); \
1825 void CLASS::base_##CBNAME(Type& a) { \
1826 PCLASS::CBNAME(a); \
1829 //---------------------------------------------------------------------------
1831 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1832 bool CBNAME(Type& a); \
1833 bool base_##CBNAME(Type& a)
1836 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1837 bool CLASS::CBNAME(Type& a) { \
1840 wxPyBeginBlockThreads(); \
1841 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1842 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1843 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1846 wxPyEndBlockThreads(); \
1848 rv = PCLASS::CBNAME(a); \
1851 bool CLASS::base_##CBNAME(Type& a) { \
1852 return PCLASS::CBNAME(a); \
1855 //---------------------------------------------------------------------------
1857 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1858 bool CBNAME(Type& a)
1861 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1862 bool CLASS::CBNAME(Type& a) { \
1864 wxPyBeginBlockThreads(); \
1865 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1866 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1867 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1870 wxPyEndBlockThreads(); \
1874 //---------------------------------------------------------------------------
1876 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1877 wxString CBNAME(long a, long b) const; \
1878 wxString base_##CBNAME(long a, long b) const
1880 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1881 wxString CLASS::CBNAME(long a, long b) const { \
1884 wxPyBeginBlockThreads(); \
1885 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1887 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1889 rval = Py2wxString(ro); \
1893 wxPyEndBlockThreads(); \
1895 rval = PCLASS::CBNAME(a,b); \
1898 wxString CLASS::base_##CBNAME(long a, long b) const { \
1899 return PCLASS::CBNAME(a,b); \
1902 //---------------------------------------------------------------------------
1904 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1905 int CBNAME(long a) const; \
1906 int base_##CBNAME(long a) const
1909 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1910 int CLASS::CBNAME(long a) const { \
1913 wxPyBeginBlockThreads(); \
1914 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1916 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1918 rval = PyInt_AsLong(ro); \
1922 wxPyEndBlockThreads(); \
1924 rval = PCLASS::CBNAME(a); \
1927 int CLASS::base_##CBNAME(long a) const { \
1928 return PCLASS::CBNAME(a); \
1932 //---------------------------------------------------------------------------
1934 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
1935 wxListItemAttr* CBNAME(long a) const; \
1936 wxListItemAttr* base_##CBNAME(long a) const
1939 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
1940 wxListItemAttr *CLASS::CBNAME(long a) const { \
1941 wxListItemAttr *rval = NULL; \
1943 wxPyBeginBlockThreads(); \
1944 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1946 wxListItemAttr* ptr; \
1947 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1949 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1954 wxPyEndBlockThreads(); \
1956 rval = PCLASS::CBNAME(a); \
1959 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
1960 return PCLASS::CBNAME(a); \
1963 //---------------------------------------------------------------------------
1965 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1966 bool CBNAME(wxMouseEvent& e); \
1967 bool base_##CBNAME(wxMouseEvent& e)
1969 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1970 bool CLASS::CBNAME(wxMouseEvent& e) { \
1973 wxPyBeginBlockThreads(); \
1974 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1976 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1977 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1979 rval = PyInt_AsLong(ro); \
1984 wxPyEndBlockThreads(); \
1986 return PCLASS::CBNAME(e); \
1989 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1990 return PCLASS::CBNAME(e); \
1994 //---------------------------------------------------------------------------
1996 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
1997 wxWizardPage* CBNAME() const
1999 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2000 wxWizardPage* CLASS::CBNAME() const { \
2001 wxWizardPage* rv = NULL; \
2002 wxPyBeginBlockThreads(); \
2003 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2005 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2007 SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \
2011 wxPyEndBlockThreads(); \
2015 //---------------------------------------------------------------------------
2017 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2018 wxBitmap CBNAME() const
2020 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2021 wxBitmap CLASS::CBNAME() const { \
2023 wxPyBeginBlockThreads(); \
2024 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2027 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2029 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \
2034 wxPyEndBlockThreads(); \
2038 //---------------------------------------------------------------------------
2040 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2043 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2044 wxObject* CLASS::CBNAME() { \
2045 wxObject* rv = NULL; \
2046 wxPyBeginBlockThreads(); \
2047 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2049 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2051 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2055 wxPyEndBlockThreads(); \
2059 //---------------------------------------------------------------------------
2061 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2062 wxObject* CBNAME(const wxString& a)
2064 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2065 wxObject* CLASS::CBNAME(const wxString& a) { \
2066 wxObject* rv = NULL; \
2067 wxPyBeginBlockThreads(); \
2068 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2069 PyObject* so = wx2PyString(a); \
2071 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2073 SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \
2078 wxPyEndBlockThreads(); \
2082 //---------------------------------------------------------------------------
2084 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2085 bool CBNAME(wxXmlNode* a)
2088 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2089 bool CLASS::CBNAME(wxXmlNode* a) { \
2091 wxPyBeginBlockThreads(); \
2092 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2093 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2094 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2097 wxPyEndBlockThreads(); \
2101 //---------------------------------------------------------------------------