1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/clipbrd.h>
24 #include <wx/colordlg.h>
25 #include <wx/config.h>
26 #include <wx/cshelp.h>
27 #include <wx/dcbuffer.h>
28 #include <wx/dcmirror.h>
30 #include <wx/dirctrl.h>
31 #include <wx/dirdlg.h>
32 #include <wx/docview.h>
33 #include <wx/encconv.h>
34 #include <wx/fdrepdlg.h>
35 #include <wx/fileconf.h>
36 #include <wx/filesys.h>
37 #include <wx/fontdlg.h>
38 #include <wx/fs_inet.h>
39 #include <wx/fs_mem.h>
40 #include <wx/fs_zip.h>
41 #include <wx/gbsizer.h>
42 #include <wx/geometry.h>
43 #include <wx/htmllbox.h>
45 #include <wx/imaglist.h>
47 #include <wx/laywin.h>
48 #include <wx/listbook.h>
49 #include <wx/minifram.h>
50 #include <wx/notebook.h>
52 #include <wx/printdlg.h>
53 #include <wx/process.h>
54 #include <wx/progdlg.h>
55 #include <wx/sashwin.h>
56 #include <wx/spinbutt.h>
57 #include <wx/spinctrl.h>
58 #include <wx/splash.h>
59 #include <wx/splitter.h>
60 #include <wx/statline.h>
61 #include <wx/stream.h>
62 #include <wx/sysopt.h>
63 #include <wx/taskbar.h>
64 #include <wx/tglbtn.h>
65 #include <wx/tipwin.h>
66 #include <wx/tooltip.h>
68 #include <wx/vscroll.h>
72 # pragma warning(disable:4800)
73 # pragma warning(disable:4190)
76 #ifdef __WXMAC__ // avoid a bug in Carbon headers
80 //---------------------------------------------------------------------------
82 typedef unsigned char byte
;
83 typedef wxPoint2DDouble wxPoint2D
;
86 #ifndef wxPyUSE_EXPORTED_API
88 void __wxPyPreStart(PyObject
*);
90 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
93 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
96 bool wxPyCheckSwigType(const wxChar
* className
);
97 PyObject
* wxPyConstructObject(void* ptr
,
98 const wxChar
* className
,
100 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
101 const wxChar
* className
);
102 PyObject
* wxPyMakeSwigPtr(void* ptr
, const char* classname
);
105 PyObject
* wx2PyString(const wxString
& src
);
106 wxString
Py2wxString(PyObject
* source
);
108 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=TRUE
);
109 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
110 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
112 PyObject
* wxPy_ConvertList(wxListBase
* list
);
113 long wxPyGetWinHandle(wxWindow
* win
);
115 void wxPy_ReinitStockObjects(bool init
);
117 bool wxPyInstance_Check(PyObject
* obj
);
118 bool wxPySwigInstance_Check(PyObject
* obj
);
121 #endif // wxPyUSE_EXPORTED_API
122 //---------------------------------------------------------------------------
124 // if we want to handle threads and Python threads are available...
125 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
126 #define WXP_WITH_THREAD
127 #else // no Python threads...
128 #undef WXP_WITH_THREAD
131 #ifndef wxPyUSE_EXPORTED_API
133 // For Python --> C++
134 PyThreadState
* wxPyBeginAllowThreads();
135 void wxPyEndAllowThreads(PyThreadState
* state
);
137 // For C++ --> Python
138 void wxPyBeginBlockThreads();
139 void wxPyEndBlockThreads();
141 #endif // wxPyUSE_EXPORTED_API
143 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
145 //---------------------------------------------------------------------------
146 // These are helpers used by the typemaps
148 #ifndef wxPyUSE_EXPORTED_API
150 wxString
* wxString_in_helper(PyObject
* source
);
152 byte
* byte_LIST_helper(PyObject
* source
);
153 int* int_LIST_helper(PyObject
* source
);
154 long* long_LIST_helper(PyObject
* source
);
155 char** string_LIST_helper(PyObject
* source
);
156 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
157 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
158 wxString
* wxString_LIST_helper(PyObject
* source
);
159 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
160 wxPen
** wxPen_LIST_helper(PyObject
* source
);
162 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
163 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
164 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
165 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
166 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
167 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
170 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
171 bool wxColour_typecheck(PyObject
* source
);
175 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
177 // If source is an object instance then it may already be the right type
178 if (wxPySwigInstance_Check(source
)) {
180 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
185 // otherwise a 2-tuple of integers is expected
186 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
187 PyObject
* o1
= PySequence_GetItem(source
, 0);
188 PyObject
* o2
= PySequence_GetItem(source
, 1);
189 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
194 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
202 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
203 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
209 // Other helpful stuff
210 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
211 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
213 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
214 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
216 #endif // wxPyUSE_EXPORTED_API
218 //---------------------------------------------------------------------------
220 #if PYTHON_API_VERSION < 1009
221 #define PySequence_Fast_GET_ITEM(o, i) \
222 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
225 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
226 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
227 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
229 //---------------------------------------------------------------------------
231 #ifndef wxPyUSE_EXPORTED_API
233 class wxPyCallback
: public wxObject
{
234 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
236 wxPyCallback(PyObject
* func
);
237 wxPyCallback(const wxPyCallback
& other
);
240 void EventThunker(wxEvent
& event
);
245 #endif // wxPyUSE_EXPORTED_API
246 //---------------------------------------------------------------------------
247 //---------------------------------------------------------------------------
248 // These Event classes can be derived from in Python and passed through the
249 // event system without loosing anything. They do this by keeping a reference
250 // to themselves and some special case handling in wxPyCallback::EventThunker.
254 class wxPyEvtSelfRef
{
259 void SetSelf(PyObject
* self
, bool clone
=FALSE
);
260 PyObject
* GetSelf() const;
261 bool GetCloned() const { return m_cloned
; }
269 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
270 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
272 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
273 wxPyEvent(const wxPyEvent
& evt
);
276 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
280 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
281 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
283 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
284 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
287 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
292 //----------------------------------------------------------------------
293 // Forward decalre a few things used in the exported API
294 class wxPyClientData
;
296 class wxPyOORClientData
;
297 class wxPyCBInputStream
;
299 void wxPyClientData_dtor(wxPyClientData
* self
);
300 void wxPyUserData_dtor(wxPyUserData
* self
);
301 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
302 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
305 //---------------------------------------------------------------------------
306 // Export a C API in a struct. Other modules will be able to load this from
307 // the wx.core module and will then have safe access to these functions, even if
308 // in another shared library.
310 class wxPyCallbackHelper
;
311 struct swig_type_info
;
312 struct swig_const_info
;
315 // Make SunCC happy and make typedef's for these that are extern "C"
316 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
317 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
318 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
319 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
320 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
321 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
322 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
323 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
324 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
325 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
326 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
327 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
328 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
329 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
330 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
331 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
332 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
337 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
338 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
339 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
340 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
341 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
342 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
343 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
344 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
345 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
346 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
347 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
348 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
349 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
350 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
351 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
352 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
353 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
356 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
357 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
358 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
359 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
361 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
362 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
363 void (*p_wxPyBeginBlockThreads
)();
364 void (*p_wxPyEndBlockThreads
)();
366 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
368 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
369 wxString (*p_Py2wxString
)(PyObject
* source
);
370 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
372 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
373 int* (*p_int_LIST_helper
)(PyObject
* source
);
374 long* (*p_long_LIST_helper
)(PyObject
* source
);
375 char** (*p_string_LIST_helper
)(PyObject
* source
);
376 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
377 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
378 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
379 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
381 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
382 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
383 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
384 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
385 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
386 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
389 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
390 bool (*p_wxColour_typecheck
)(PyObject
* source
);
392 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
393 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
394 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
395 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
396 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
398 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
399 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
400 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
401 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
402 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
403 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
404 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
406 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
407 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
408 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
410 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
412 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
413 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
417 #ifdef wxPyUSE_EXPORTED_API
418 // Notice that this is static, not extern. This is by design, each module
419 // needs one, but doesn't have to use it.
420 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
421 #endif // wxPyUSE_EXPORTED_API
423 //---------------------------------------------------------------------------
425 // A wxObject that holds a reference to a Python object
426 class wxPyUserData
: public wxObject
{
428 wxPyUserData(PyObject
* obj
) {
434 #ifdef wxPyUSE_EXPORTED_API
435 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
437 wxPyUserData_dtor(this);
444 // A wxClientData that holds a refernece to a Python object
445 class wxPyClientData
: public wxClientData
{
447 wxPyClientData(PyObject
* obj
) {
453 #ifdef wxPyUSE_EXPORTED_API
454 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
456 wxPyClientData_dtor(this);
463 // Just like wxPyClientData, except when this object is destroyed it does some
464 // OOR magic on the Python Object.
465 class wxPyOORClientData
: public wxPyClientData
{
467 wxPyOORClientData(PyObject
* obj
)
468 : wxPyClientData(obj
) {}
470 ~wxPyOORClientData() {
471 #ifdef wxPyUSE_EXPORTED_API
472 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
474 wxPyOORClientData_dtor(this);
480 //---------------------------------------------------------------------------
481 // This class holds an instance of a Python Shadow Class object and assists
482 // with looking up and invoking Python callback methods from C++ virtual
483 // method redirections. For all classes which have virtuals which should be
484 // overridable in wxPython, a new subclass is created that contains a
485 // wxPyCallbackHelper.
488 class wxPyCallbackHelper
{
490 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
492 wxPyCallbackHelper() {
499 ~wxPyCallbackHelper() {
500 #ifdef wxPyUSE_EXPORTED_API
501 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
503 wxPyCBH_delete(this);
507 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=TRUE
);
508 bool findCallback(const char* name
) const;
509 int callCallback(PyObject
* argTuple
) const;
510 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
515 PyObject
* m_lastFound
;
518 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
522 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
523 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
524 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
525 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
526 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
531 //---------------------------------------------------------------------------
533 // This is used in C++ classes that need to be able to make callback to
534 // "overloaded" python methods
537 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
538 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
540 private: wxPyCallbackHelper m_myInst
543 //---------------------------------------------------------------------------
544 // The wxPythonApp class
547 wxPYAPP_ASSERT_SUPPRESS
= 1,
548 wxPYAPP_ASSERT_EXCEPTION
= 2,
549 wxPYAPP_ASSERT_DIALOG
= 4,
550 wxPYAPP_ASSERT_LOG
= 8
553 class wxPyApp
: public wxApp
555 DECLARE_ABSTRACT_CLASS(wxPyApp
);
563 int GetAssertMode() { return m_assertMode
; }
564 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
566 virtual bool OnInitGui();
567 virtual int OnExit();
569 virtual void OnAssert(const wxChar
*file
,
574 // virtual int FilterEvent(wxEvent& event); // This one too????
577 static bool GetMacSupportPCMenuShortcuts();
578 static long GetMacAboutMenuItemId();
579 static long GetMacPreferencesMenuItemId();
580 static long GetMacExitMenuItemId();
581 static wxString
GetMacHelpMenuTitleName();
583 static void SetMacSupportPCMenuShortcuts(bool val
);
584 static void SetMacAboutMenuItemId(long val
);
585 static void SetMacPreferencesMenuItemId(long val
);
586 static void SetMacExitMenuItemId(long val
);
587 static void SetMacHelpMenuTitleName(const wxString
& val
);
590 void _BootstrapApp();
592 // implementation only
593 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
597 bool m_startupComplete
;
600 extern wxPyApp
*wxPythonApp
;
603 //----------------------------------------------------------------------
604 // These macros are used to implement the virtual methods that should
605 // redirect to a Python method if one exists. The names designate the
606 // return type, if any, as well as any parameter types.
607 //---------------------------------------------------------------------------
609 #define DEC_PYCALLBACK__(CBNAME) \
614 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
615 void CLASS::CBNAME() { \
617 wxPyBeginBlockThreads(); \
618 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
619 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
620 wxPyEndBlockThreads(); \
624 void CLASS::base_##CBNAME() { \
628 //---------------------------------------------------------------------------
630 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
631 bool CBNAME(int a, int b); \
632 bool base_##CBNAME(int a, int b)
635 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
636 bool CLASS::CBNAME(int a, int b) { \
637 bool rval=FALSE, found; \
638 wxPyBeginBlockThreads(); \
639 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
640 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
641 wxPyEndBlockThreads(); \
643 rval = PCLASS::CBNAME(a,b); \
646 bool CLASS::base_##CBNAME(int a, int b) { \
647 return PCLASS::CBNAME(a,b); \
650 //---------------------------------------------------------------------------
652 #define DEC_PYCALLBACK_VOID_(CBNAME) \
657 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
658 void CLASS::CBNAME() { \
660 wxPyBeginBlockThreads(); \
661 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
662 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
663 wxPyEndBlockThreads(); \
667 void CLASS::base_##CBNAME() { \
671 //---------------------------------------------------------------------------
673 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
674 void CBNAME(int a, int b); \
675 void base_##CBNAME(int a, int b)
678 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
679 void CLASS::CBNAME(int a, int b) { \
681 wxPyBeginBlockThreads(); \
682 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
683 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
684 wxPyEndBlockThreads(); \
686 PCLASS::CBNAME(a,b); \
688 void CLASS::base_##CBNAME(int a, int b) { \
689 PCLASS::CBNAME(a,b); \
692 //---------------------------------------------------------------------------
694 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
695 void CBNAME(int a); \
696 void base_##CBNAME(int a)
699 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
700 void CLASS::CBNAME(int a) { \
702 wxPyBeginBlockThreads(); \
703 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
704 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
705 wxPyEndBlockThreads(); \
709 void CLASS::base_##CBNAME(int a) { \
713 //---------------------------------------------------------------------------
715 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
716 void CBNAME(int a, int b, int c, int d); \
717 void base_##CBNAME(int a, int b, int c, int d)
720 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
721 void CLASS::CBNAME(int a, int b, int c, int d) { \
723 wxPyBeginBlockThreads(); \
724 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
725 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
726 wxPyEndBlockThreads(); \
728 PCLASS::CBNAME(a,b,c,d); \
730 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
731 PCLASS::CBNAME(a,b,c,d); \
734 //---------------------------------------------------------------------------
735 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
736 void CBNAME(int a, int b, int c, int d, int e); \
737 void base_##CBNAME(int a, int b, int c, int d, int e)
740 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
741 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
743 wxPyBeginBlockThreads(); \
744 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
745 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
746 wxPyEndBlockThreads(); \
748 PCLASS::CBNAME(a,b,c,d,e); \
750 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
751 PCLASS::CBNAME(a,b,c,d,e); \
754 //---------------------------------------------------------------------------
756 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
757 void CBNAME(int* a, int* b) const; \
758 void base_##CBNAME(int* a, int* b) const
761 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
762 void CLASS::CBNAME(int* a, int* b) const { \
763 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
765 wxPyBeginBlockThreads(); \
766 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
768 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
770 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
771 PyObject* o1 = PySequence_GetItem(ro, 0); \
772 PyObject* o2 = PySequence_GetItem(ro, 1); \
773 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
774 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
777 PyErr_SetString(PyExc_TypeError, errmsg); \
782 PyErr_SetString(PyExc_TypeError, errmsg); \
787 wxPyEndBlockThreads(); \
789 PCLASS::CBNAME(a,b); \
791 void CLASS::base_##CBNAME(int* a, int* b) const { \
792 PCLASS::CBNAME(a,b); \
796 //---------------------------------------------------------------------------
798 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
799 wxSize CBNAME() const; \
800 wxSize base_##CBNAME() const
803 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
804 wxSize CLASS::CBNAME() const { \
805 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
806 bool found; wxSize rval(0,0); \
807 wxPyBeginBlockThreads(); \
808 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
810 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
812 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
813 PyObject* o1 = PySequence_GetItem(ro, 0); \
814 PyObject* o2 = PySequence_GetItem(ro, 1); \
815 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
816 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
819 PyErr_SetString(PyExc_TypeError, errmsg); \
824 PyErr_SetString(PyExc_TypeError, errmsg); \
829 wxPyEndBlockThreads(); \
831 return PCLASS::CBNAME(); \
835 wxSize CLASS::base_##CBNAME() const { \
836 return PCLASS::CBNAME(); \
840 //---------------------------------------------------------------------------
842 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
843 bool CBNAME(bool a); \
844 bool base_##CBNAME(bool a)
847 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
848 bool CLASS::CBNAME(bool a) { \
849 bool rval=FALSE, found; \
850 wxPyBeginBlockThreads(); \
851 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
852 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
853 wxPyEndBlockThreads(); \
855 rval = PCLASS::CBNAME(a); \
858 bool CLASS::base_##CBNAME(bool a) { \
859 return PCLASS::CBNAME(a); \
862 //---------------------------------------------------------------------------
864 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
865 bool CBNAME(int a); \
866 bool base_##CBNAME(int a)
869 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
870 bool CLASS::CBNAME(int a) { \
871 bool rval=FALSE, found; \
872 wxPyBeginBlockThreads(); \
873 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
874 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
875 wxPyEndBlockThreads(); \
877 rval = PCLASS::CBNAME(a); \
880 bool CLASS::base_##CBNAME(int a) { \
881 return PCLASS::CBNAME(a); \
884 //---------------------------------------------------------------------------
886 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
890 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
891 bool CLASS::CBNAME(int a) { \
893 wxPyBeginBlockThreads(); \
894 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
895 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
897 wxPyEndBlockThreads(); \
902 //---------------------------------------------------------------------------
904 #define DEC_PYCALLBACK__DC(CBNAME) \
905 void CBNAME(wxDC& a); \
906 void base_##CBNAME(wxDC& a)
909 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
910 void CLASS::CBNAME(wxDC& a) { \
912 wxPyBeginBlockThreads(); \
913 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
914 PyObject* obj = wxPyMake_wxObject(&a); \
915 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
918 wxPyEndBlockThreads(); \
922 void CLASS::base_##CBNAME(wxDC& a) { \
928 //---------------------------------------------------------------------------
930 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
931 void CBNAME(wxDC& a, bool b); \
932 void base_##CBNAME(wxDC& a, bool b)
935 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
936 void CLASS::CBNAME(wxDC& a, bool b) { \
938 wxPyBeginBlockThreads(); \
939 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
940 PyObject* obj = wxPyMake_wxObject(&a); \
941 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
944 wxPyEndBlockThreads(); \
946 PCLASS::CBNAME(a, b); \
948 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
949 PCLASS::CBNAME(a, b); \
952 //---------------------------------------------------------------------------
954 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
955 void CBNAME(wxDC& a, bool b); \
956 void base_##CBNAME(wxDC& a, bool b)
959 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
960 void CLASS::CBNAME(wxDC& a, bool b) { \
962 wxPyBeginBlockThreads(); \
963 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
964 PyObject* obj = wxPyMake_wxObject(&a); \
965 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
968 wxPyEndBlockThreads(); \
970 PCLASS::CBNAME(a, b); \
972 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
973 PCLASS::CBNAME(a, b); \
976 //---------------------------------------------------------------------------
978 #define DEC_PYCALLBACK__2DBL(CBNAME) \
979 void CBNAME(double a, double b); \
980 void base_##CBNAME(double a, double b)
983 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
984 void CLASS::CBNAME(double a, double b) { \
986 wxPyBeginBlockThreads(); \
987 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
988 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
989 wxPyEndBlockThreads(); \
991 PCLASS::CBNAME(a, b); \
993 void CLASS::base_##CBNAME(double a, double b) { \
994 PCLASS::CBNAME(a, b); \
997 //---------------------------------------------------------------------------
999 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1000 void CBNAME(double a, double b, int c, int d); \
1001 void base_##CBNAME(double a, double b, int c, int d)
1004 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1005 void CLASS::CBNAME(double a, double b, int c, int d) { \
1007 wxPyBeginBlockThreads(); \
1008 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1009 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1011 wxPyEndBlockThreads(); \
1013 PCLASS::CBNAME(a, b, c, d); \
1015 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1016 PCLASS::CBNAME(a, b, c, d); \
1019 //---------------------------------------------------------------------------
1021 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1022 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1023 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1026 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1027 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1029 wxPyBeginBlockThreads(); \
1030 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1031 PyObject* obj = wxPyMake_wxObject(&a); \
1032 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1035 wxPyEndBlockThreads(); \
1037 PCLASS::CBNAME(a, b, c, d, e, f); \
1039 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1040 PCLASS::CBNAME(a, b, c, d, e, f); \
1043 //---------------------------------------------------------------------------
1045 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1046 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1047 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1050 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1051 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1053 wxPyBeginBlockThreads(); \
1055 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1056 PyObject* obj = wxPyMake_wxObject(&a); \
1057 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1060 wxPyEndBlockThreads(); \
1062 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1065 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1066 return PCLASS::CBNAME(a, b, c, d, e, f); \
1069 //---------------------------------------------------------------------------
1071 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1072 void CBNAME(bool a, double b, double c, int d, int e); \
1073 void base_##CBNAME(bool a, double b, double c, int d, int e)
1076 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1077 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1079 wxPyBeginBlockThreads(); \
1080 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1081 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1083 wxPyEndBlockThreads(); \
1085 PCLASS::CBNAME(a, b, c, d, e); \
1087 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1088 PCLASS::CBNAME(a, b, c, d, e); \
1091 //---------------------------------------------------------------------------
1093 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1094 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1095 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1098 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1099 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1101 wxPyBeginBlockThreads(); \
1102 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1103 PyObject* obj = wxPyMake_wxObject(&a); \
1104 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1107 wxPyEndBlockThreads(); \
1109 PCLASS::CBNAME(a, b, c, d, e); \
1111 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1112 PCLASS::CBNAME(a, b, c, d, e); \
1115 //---------------------------------------------------------------------------
1117 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1118 void CBNAME(wxDC& a, bool b); \
1119 void base_##CBNAME(wxDC& a, bool b)
1122 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1123 void CLASS::CBNAME(wxDC& a, bool b) { \
1125 wxPyBeginBlockThreads(); \
1126 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1127 PyObject* obj = wxPyMake_wxObject(&a); \
1128 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1131 wxPyEndBlockThreads(); \
1133 PCLASS::CBNAME(a, b); \
1135 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1136 PCLASS::CBNAME(a, b); \
1139 //---------------------------------------------------------------------------
1141 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1142 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1143 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1146 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1147 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1150 wxPyBeginBlockThreads(); \
1151 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1152 PyObject* obj = wxPyMake_wxObject(a); \
1153 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1156 wxPyEndBlockThreads(); \
1158 PCLASS::CBNAME(a, b, c, d, e, f); \
1160 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1162 PCLASS::CBNAME(a, b, c, d, e, f); \
1165 //---------------------------------------------------------------------------
1167 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1168 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1169 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1172 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1173 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1175 wxPyBeginBlockThreads(); \
1176 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1177 PyObject* obj = wxPyMake_wxObject(a); \
1178 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1181 wxPyEndBlockThreads(); \
1183 PCLASS::CBNAME(a, b, c, d, e); \
1185 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1187 PCLASS::CBNAME(a, b, c, d, e); \
1190 //---------------------------------------------------------------------------
1192 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1193 void CBNAME(double a, double b, int c); \
1194 void base_##CBNAME(double a, double b, int c)
1197 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1198 void CLASS::CBNAME(double a, double b, int c) { \
1200 wxPyBeginBlockThreads(); \
1201 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1202 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1203 wxPyEndBlockThreads(); \
1205 PCLASS::CBNAME(a, b, c); \
1207 void CLASS::base_##CBNAME(double a, double b, int c) { \
1208 PCLASS::CBNAME(a, b, c); \
1211 //---------------------------------------------------------------------------
1213 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1214 void CBNAME(bool a, double b, double c, int d); \
1215 void base_##CBNAME(bool a, double b, double c, int d)
1218 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1219 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1221 wxPyBeginBlockThreads(); \
1222 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1223 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1224 wxPyEndBlockThreads(); \
1226 PCLASS::CBNAME(a, b, c, d); \
1228 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1229 PCLASS::CBNAME(a, b, c, d); \
1232 //---------------------------------------------------------------------------
1233 //---------------------------------------------------------------------------
1235 #define DEC_PYCALLBACK__STRING(CBNAME) \
1236 void CBNAME(const wxString& a); \
1237 void base_##CBNAME(const wxString& a)
1239 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1240 void CLASS::CBNAME(const wxString& a) { \
1242 wxPyBeginBlockThreads(); \
1243 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1244 PyObject* s = wx2PyString(a); \
1245 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1248 wxPyEndBlockThreads(); \
1250 PCLASS::CBNAME(a); \
1252 void CLASS::base_##CBNAME(const wxString& a) { \
1253 PCLASS::CBNAME(a); \
1256 //---------------------------------------------------------------------------
1258 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1259 bool CBNAME(const wxString& a); \
1260 bool base_##CBNAME(const wxString& a)
1262 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1263 bool CLASS::CBNAME(const wxString& a) { \
1266 wxPyBeginBlockThreads(); \
1267 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1268 PyObject* s = wx2PyString(a); \
1269 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1272 wxPyEndBlockThreads(); \
1274 rval = PCLASS::CBNAME(a); \
1277 bool CLASS::base_##CBNAME(const wxString& a) { \
1278 return PCLASS::CBNAME(a); \
1281 //---------------------------------------------------------------------------
1283 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1284 bool CBNAME(const wxString& a)
1286 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1287 bool CLASS::CBNAME(const wxString& a) { \
1289 wxPyBeginBlockThreads(); \
1290 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1291 PyObject* s = wx2PyString(a); \
1292 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1295 wxPyEndBlockThreads(); \
1299 //---------------------------------------------------------------------------
1301 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1302 wxString CBNAME(const wxString& a)
1304 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1305 wxString CLASS::CBNAME(const wxString& a) { \
1307 wxPyBeginBlockThreads(); \
1308 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1310 PyObject* s = wx2PyString(a); \
1311 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1314 rval = Py2wxString(ro); \
1318 wxPyEndBlockThreads(); \
1322 //---------------------------------------------------------------------------
1324 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1325 wxString CBNAME(const wxString& a); \
1326 wxString base_##CBNAME(const wxString& a)
1328 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1329 wxString CLASS::CBNAME(const wxString& a) { \
1332 wxPyBeginBlockThreads(); \
1333 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1335 PyObject* s = wx2PyString(a); \
1336 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1339 rval = Py2wxString(ro); \
1344 rval = PCLASS::CBNAME(a); \
1345 wxPyEndBlockThreads(); \
1349 //---------------------------------------------------------------------------
1351 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1352 wxString CBNAME(const wxString& a,int b)
1354 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1355 wxString CLASS::CBNAME(const wxString& a,int b) { \
1357 wxPyBeginBlockThreads(); \
1358 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1360 PyObject* s = wx2PyString(a); \
1361 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1364 rval = Py2wxString(ro); \
1368 wxPyEndBlockThreads(); \
1372 //---------------------------------------------------------------------------
1374 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1375 bool CBNAME(const wxString& a, const wxString& b); \
1376 bool base_##CBNAME(const wxString& a, const wxString& b)
1378 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1379 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1382 wxPyBeginBlockThreads(); \
1383 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1384 PyObject* s1 = wx2PyString(a); \
1385 PyObject* s2 = wx2PyString(b); \
1386 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1390 wxPyEndBlockThreads(); \
1392 rval = PCLASS::CBNAME(a, b); \
1395 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1396 return PCLASS::CBNAME(a, b); \
1399 //---------------------------------------------------------------------------
1401 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1402 wxString CBNAME(); \
1403 wxString base_##CBNAME()
1405 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1406 wxString CLASS::CBNAME() { \
1409 wxPyBeginBlockThreads(); \
1410 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1412 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1414 rval = Py2wxString(ro); \
1418 wxPyEndBlockThreads(); \
1420 rval = PCLASS::CBNAME(); \
1423 wxString CLASS::base_##CBNAME() { \
1424 return PCLASS::CBNAME(); \
1427 //---------------------------------------------------------------------------
1429 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1430 wxString CBNAME() const; \
1431 wxString base_##CBNAME() const;
1433 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1434 wxString CLASS::CBNAME() const { \
1437 wxPyBeginBlockThreads(); \
1438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1440 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1442 rval = Py2wxString(ro); \
1446 wxPyEndBlockThreads(); \
1448 rval = PCLASS::CBNAME(); \
1451 wxString CLASS::base_##CBNAME() const { \
1452 return PCLASS::CBNAME(); \
1455 //---------------------------------------------------------------------------
1457 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1460 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1461 wxString CLASS::CBNAME() { \
1463 wxPyBeginBlockThreads(); \
1464 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1466 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1468 rval = Py2wxString(ro); \
1472 wxPyEndBlockThreads(); \
1476 //---------------------------------------------------------------------------
1478 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1479 wxString CBNAME() const;
1481 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1482 wxString CLASS::CBNAME() const { \
1484 wxPyBeginBlockThreads(); \
1485 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1487 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1489 rval = Py2wxString(ro); \
1493 wxPyEndBlockThreads(); \
1497 //---------------------------------------------------------------------------
1499 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1500 bool CBNAME(const wxHtmlTag& a)
1503 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1504 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1506 wxPyBeginBlockThreads(); \
1507 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1508 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1509 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1512 wxPyEndBlockThreads(); \
1516 //---------------------------------------------------------------------------
1518 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1519 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1520 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1522 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1523 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1525 wxPyBeginBlockThreads(); \
1526 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1527 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1528 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1531 wxPyEndBlockThreads(); \
1533 PCLASS::CBNAME(cell, x, y); \
1535 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1536 PCLASS::CBNAME(cell, x, y); \
1540 //---------------------------------------------------------------------------
1542 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1543 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1544 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1546 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1547 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1549 wxPyBeginBlockThreads(); \
1550 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1551 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1552 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1553 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1557 wxPyEndBlockThreads(); \
1559 PCLASS::CBNAME(cell, x, y, e); \
1561 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1562 PCLASS::CBNAME(cell, x, y, e); \
1567 //---------------------------------------------------------------------------
1569 #define DEC_PYCALLBACK___pure(CBNAME) \
1573 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1574 void CLASS::CBNAME() { \
1575 wxPyBeginBlockThreads(); \
1576 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1577 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1578 wxPyEndBlockThreads(); \
1581 //---------------------------------------------------------------------------
1583 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1587 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1588 wxSize CLASS::CBNAME() { \
1589 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1591 wxPyBeginBlockThreads(); \
1592 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1595 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1597 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1599 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1600 PyObject* o1 = PySequence_GetItem(ro, 0); \
1601 PyObject* o2 = PySequence_GetItem(ro, 1); \
1602 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1603 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1605 PyErr_SetString(PyExc_TypeError, errmsg); \
1610 PyErr_SetString(PyExc_TypeError, errmsg); \
1615 wxPyEndBlockThreads(); \
1619 //---------------------------------------------------------------------------
1621 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1622 bool CBNAME(wxWindow* a); \
1623 bool base_##CBNAME(wxWindow* a)
1626 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1627 bool CLASS::CBNAME(wxWindow* a) { \
1630 wxPyBeginBlockThreads(); \
1631 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1632 PyObject* obj = wxPyMake_wxObject(a); \
1633 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1636 wxPyEndBlockThreads(); \
1638 rval = PCLASS::CBNAME(a); \
1641 bool CLASS::base_##CBNAME(wxWindow* a) { \
1642 return PCLASS::CBNAME(a); \
1645 //---------------------------------------------------------------------------
1647 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1648 bool CBNAME(wxWindow* a, wxDC& b); \
1649 bool base_##CBNAME(wxWindow* a, wxDC& b)
1652 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1653 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1656 wxPyBeginBlockThreads(); \
1657 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1658 PyObject* win = wxPyMake_wxObject(a); \
1659 PyObject* dc = wxPyMake_wxObject(&b); \
1660 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1664 wxPyEndBlockThreads(); \
1666 rval = PCLASS::CBNAME(a, b); \
1669 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1670 return PCLASS::CBNAME(a, b); \
1673 //---------------------------------------------------------------------------
1675 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1676 void CBNAME(wxWindowBase* a); \
1677 void base_##CBNAME(wxWindowBase* a)
1680 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1681 void CLASS::CBNAME(wxWindowBase* a) { \
1683 wxPyBeginBlockThreads(); \
1684 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1685 PyObject* obj = wxPyMake_wxObject(a); \
1686 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1689 wxPyEndBlockThreads(); \
1691 PCLASS::CBNAME(a); \
1693 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1694 PCLASS::CBNAME(a); \
1697 //---------------------------------------------------------------------------
1699 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1701 bool base_##CBNAME()
1704 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1705 bool CLASS::CBNAME() { \
1708 wxPyBeginBlockThreads(); \
1709 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1710 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1711 wxPyEndBlockThreads(); \
1713 rval = PCLASS::CBNAME(); \
1716 bool CLASS::base_##CBNAME() { \
1717 return PCLASS::CBNAME(); \
1720 //---------------------------------------------------------------------------
1722 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1723 bool CBNAME() const; \
1724 bool base_##CBNAME() const
1727 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1728 bool CLASS::CBNAME() const { \
1731 wxPyBeginBlockThreads(); \
1732 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1733 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1734 wxPyEndBlockThreads(); \
1736 rval = PCLASS::CBNAME(); \
1739 bool CLASS::base_##CBNAME() const { \
1740 return PCLASS::CBNAME(); \
1743 //---------------------------------------------------------------------------
1745 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1746 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1747 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1750 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1751 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1754 wxPyBeginBlockThreads(); \
1755 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1756 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1757 wxPyEndBlockThreads(); \
1759 rval = PCLASS::CBNAME(a, b, c); \
1760 return (wxDragResult)rval; \
1762 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1763 return PCLASS::CBNAME(a, b, c); \
1766 //---------------------------------------------------------------------------
1768 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1769 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1771 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1772 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1773 wxPyBeginBlockThreads(); \
1775 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1777 PyObject* obj = wxPyMake_wxObject(&a); \
1778 PyObject* s = wx2PyString(b); \
1779 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1782 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1788 wxPyEndBlockThreads(); \
1792 //---------------------------------------------------------------------------
1794 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1795 bool CBNAME(wxDragResult a); \
1796 bool base_##CBNAME(wxDragResult a)
1799 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1800 bool CLASS::CBNAME(wxDragResult a) { \
1803 wxPyBeginBlockThreads(); \
1804 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1805 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1806 wxPyEndBlockThreads(); \
1808 rval = PCLASS::CBNAME(a); \
1811 bool CLASS::base_##CBNAME(wxDragResult a) { \
1812 return PCLASS::CBNAME(a); \
1815 //---------------------------------------------------------------------------
1817 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1818 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1821 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1822 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1823 wxPyBeginBlockThreads(); \
1825 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1826 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1827 wxPyEndBlockThreads(); \
1828 return (wxDragResult)rval; \
1831 //---------------------------------------------------------------------------
1833 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1834 bool CBNAME(int a, int b, const wxString& c)
1836 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1837 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1839 wxPyBeginBlockThreads(); \
1840 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1841 PyObject* s = wx2PyString(c); \
1842 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1845 wxPyEndBlockThreads(); \
1849 //---------------------------------------------------------------------------
1851 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1853 size_t base_##CBNAME()
1856 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1857 size_t CLASS::CBNAME() { \
1860 wxPyBeginBlockThreads(); \
1861 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1862 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1863 wxPyEndBlockThreads(); \
1865 rval = PCLASS::CBNAME(); \
1868 size_t CLASS::base_##CBNAME() { \
1869 return PCLASS::CBNAME(); \
1872 //---------------------------------------------------------------------------
1874 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1875 size_t CBNAME() const; \
1876 size_t base_##CBNAME() const
1879 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1880 size_t CLASS::CBNAME() const { \
1883 wxPyBeginBlockThreads(); \
1884 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1885 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1886 wxPyEndBlockThreads(); \
1888 rval = PCLASS::CBNAME(); \
1891 size_t CLASS::base_##CBNAME() const { \
1892 return PCLASS::CBNAME(); \
1895 //---------------------------------------------------------------------------
1897 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1898 wxDataFormat CBNAME(size_t a); \
1899 wxDataFormat base_##CBNAME(size_t a)
1902 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1903 wxDataFormat CLASS::CBNAME(size_t a) { \
1904 wxDataFormat rval=0; \
1906 wxPyBeginBlockThreads(); \
1907 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1909 wxDataFormat* ptr; \
1910 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1912 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1917 wxPyEndBlockThreads(); \
1919 rval = PCLASS::CBNAME(a); \
1922 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1923 return PCLASS::CBNAME(a); \
1926 //---------------------------------------------------------------------------
1928 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1929 void CBNAME(const Type& a); \
1930 void base_##CBNAME(const Type& a)
1933 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1934 void CLASS::CBNAME(const Type& a) { \
1936 wxPyBeginBlockThreads(); \
1937 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1938 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1939 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1942 wxPyEndBlockThreads(); \
1944 PCLASS::CBNAME(a); \
1946 void CLASS::base_##CBNAME(const Type& a) { \
1947 PCLASS::CBNAME(a); \
1951 //---------------------------------------------------------------------------
1953 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1954 void CBNAME(Type& a); \
1955 void base_##CBNAME(Type& a)
1958 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1959 void CLASS::CBNAME(Type& a) { \
1961 wxPyBeginBlockThreads(); \
1962 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1963 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1964 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1967 wxPyEndBlockThreads(); \
1969 PCLASS::CBNAME(a); \
1971 void CLASS::base_##CBNAME(Type& a) { \
1972 PCLASS::CBNAME(a); \
1975 //---------------------------------------------------------------------------
1977 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1978 bool CBNAME(Type& a); \
1979 bool base_##CBNAME(Type& a)
1982 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1983 bool CLASS::CBNAME(Type& a) { \
1986 wxPyBeginBlockThreads(); \
1987 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1988 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1989 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1992 wxPyEndBlockThreads(); \
1994 rv = PCLASS::CBNAME(a); \
1997 bool CLASS::base_##CBNAME(Type& a) { \
1998 return PCLASS::CBNAME(a); \
2001 //---------------------------------------------------------------------------
2003 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2004 bool CBNAME(Type& a)
2007 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2008 bool CLASS::CBNAME(Type& a) { \
2010 wxPyBeginBlockThreads(); \
2011 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2012 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2013 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2016 wxPyEndBlockThreads(); \
2020 //---------------------------------------------------------------------------
2022 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2023 wxString CBNAME(long a, long b) const; \
2024 wxString base_##CBNAME(long a, long b) const
2026 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2027 wxString CLASS::CBNAME(long a, long b) const { \
2030 wxPyBeginBlockThreads(); \
2031 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2033 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2035 rval = Py2wxString(ro); \
2039 wxPyEndBlockThreads(); \
2041 rval = PCLASS::CBNAME(a,b); \
2044 wxString CLASS::base_##CBNAME(long a, long b) const { \
2045 return PCLASS::CBNAME(a,b); \
2048 //---------------------------------------------------------------------------
2050 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2051 int CBNAME(long a) const; \
2052 int base_##CBNAME(long a) const
2055 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2056 int CLASS::CBNAME(long a) const { \
2059 wxPyBeginBlockThreads(); \
2060 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2062 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2064 rval = PyInt_AsLong(ro); \
2068 wxPyEndBlockThreads(); \
2070 rval = PCLASS::CBNAME(a); \
2073 int CLASS::base_##CBNAME(long a) const { \
2074 return PCLASS::CBNAME(a); \
2078 //---------------------------------------------------------------------------
2080 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2081 wxListItemAttr* CBNAME(long a) const; \
2082 wxListItemAttr* base_##CBNAME(long a) const
2085 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2086 wxListItemAttr *CLASS::CBNAME(long a) const { \
2087 wxListItemAttr *rval = NULL; \
2089 wxPyBeginBlockThreads(); \
2090 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2092 wxListItemAttr* ptr; \
2093 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2095 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2100 wxPyEndBlockThreads(); \
2102 rval = PCLASS::CBNAME(a); \
2105 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2106 return PCLASS::CBNAME(a); \
2109 //---------------------------------------------------------------------------
2111 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2112 bool CBNAME(wxMouseEvent& e); \
2113 bool base_##CBNAME(wxMouseEvent& e)
2115 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2116 bool CLASS::CBNAME(wxMouseEvent& e) { \
2119 wxPyBeginBlockThreads(); \
2120 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2122 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2123 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2125 rval = PyInt_AsLong(ro); \
2130 wxPyEndBlockThreads(); \
2132 return PCLASS::CBNAME(e); \
2135 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2136 return PCLASS::CBNAME(e); \
2140 //---------------------------------------------------------------------------
2142 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2143 wxWizardPage* CBNAME() const
2145 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2146 wxWizardPage* CLASS::CBNAME() const { \
2147 wxWizardPage* rv = NULL; \
2148 wxPyBeginBlockThreads(); \
2149 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2151 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2153 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2157 wxPyEndBlockThreads(); \
2161 //---------------------------------------------------------------------------
2163 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2164 wxBitmap CBNAME() const
2166 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2167 wxBitmap CLASS::CBNAME() const { \
2169 wxPyBeginBlockThreads(); \
2170 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2173 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2175 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2180 wxPyEndBlockThreads(); \
2184 //---------------------------------------------------------------------------
2186 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2189 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2190 wxObject* CLASS::CBNAME() { \
2191 wxObject* rv = NULL; \
2192 wxPyBeginBlockThreads(); \
2193 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2195 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2197 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2201 wxPyEndBlockThreads(); \
2205 //---------------------------------------------------------------------------
2207 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2208 wxObject* CBNAME(const wxString& a)
2210 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2211 wxObject* CLASS::CBNAME(const wxString& a) { \
2212 wxObject* rv = NULL; \
2213 wxPyBeginBlockThreads(); \
2214 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2215 PyObject* so = wx2PyString(a); \
2217 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2219 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2224 wxPyEndBlockThreads(); \
2228 //---------------------------------------------------------------------------
2230 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2231 bool CBNAME(wxXmlNode* a)
2234 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2235 bool CLASS::CBNAME(wxXmlNode* a) { \
2237 wxPyBeginBlockThreads(); \
2238 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2239 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2240 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2243 wxPyEndBlockThreads(); \
2247 //---------------------------------------------------------------------------
2249 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2250 wxCoord CBNAME(size_t a) const
2253 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2254 wxCoord CLASS::CBNAME(size_t a) const { \
2257 wxPyBeginBlockThreads(); \
2258 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2259 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2261 wxPyEndBlockThreads(); \
2265 //---------------------------------------------------------------------------
2267 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2268 void CBNAME(size_t a, size_t b) const; \
2269 void base_##CBNAME(size_t a, size_t b) const
2272 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2273 void CLASS::CBNAME(size_t a, size_t b) const { \
2275 wxPyBeginBlockThreads(); \
2276 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2277 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2278 wxPyEndBlockThreads(); \
2280 PCLASS::CBNAME(a,b); \
2282 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2283 PCLASS::CBNAME(a,b); \
2286 //---------------------------------------------------------------------------
2288 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2289 wxCoord CBNAME() const; \
2290 wxCoord base_##CBNAME() const
2293 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2294 wxCoord CLASS::CBNAME() const { \
2297 wxPyBeginBlockThreads(); \
2298 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2299 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2300 wxPyEndBlockThreads(); \
2302 rval = PCLASS::CBNAME(); \
2305 wxCoord CLASS::base_##CBNAME() const { \
2306 return PCLASS::CBNAME(); \
2309 //---------------------------------------------------------------------------
2311 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2312 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2315 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2316 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2318 wxPyBeginBlockThreads(); \
2319 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2320 PyObject* obj = wxPyMake_wxObject(&a); \
2321 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2322 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2325 wxPyEndBlockThreads(); \
2328 //---------------------------------------------------------------------------
2330 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2331 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2332 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2335 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2336 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2338 wxPyBeginBlockThreads(); \
2339 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2340 PyObject* obj = wxPyMake_wxObject(&a); \
2341 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2342 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2345 wxPyEndBlockThreads(); \
2347 PCLASS::CBNAME(a,b,c); \
2349 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2350 PCLASS::CBNAME(a,b,c); \
2353 //---------------------------------------------------------------------------
2356 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2357 wxString CBNAME(size_t a) const; \
2358 wxString base_##CBNAME(size_t a) const
2360 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2361 wxString CLASS::CBNAME(size_t a) const { \
2364 wxPyBeginBlockThreads(); \
2365 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2367 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2369 rval = Py2wxString(ro); \
2373 wxPyEndBlockThreads(); \
2375 rval = PCLASS::CBNAME(a); \
2378 wxString CLASS::base_##CBNAME(size_t a) const { \
2379 return PCLASS::CBNAME(a); \
2382 //---------------------------------------------------------------------------
2384 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2385 wxString CBNAME(size_t a) const
2387 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2388 wxString CLASS::CBNAME(size_t a) const { \
2391 wxPyBeginBlockThreads(); \
2392 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2394 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2396 rval = Py2wxString(ro); \
2400 wxPyEndBlockThreads(); \
2404 //---------------------------------------------------------------------------