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>
33 #include <wx/docview.h>
34 #include <wx/encconv.h>
35 #include <wx/fdrepdlg.h>
36 #include <wx/fileconf.h>
37 #include <wx/filesys.h>
38 #include <wx/fontdlg.h>
39 #include <wx/fs_inet.h>
40 #include <wx/fs_mem.h>
41 #include <wx/fs_zip.h>
42 #include <wx/gbsizer.h>
43 #include <wx/geometry.h>
44 #include <wx/htmllbox.h>
46 #include <wx/imaglist.h>
48 #include <wx/laywin.h>
49 #include <wx/listbook.h>
50 #include <wx/minifram.h>
51 #include <wx/notebook.h>
53 #include <wx/printdlg.h>
54 #include <wx/process.h>
55 #include <wx/progdlg.h>
56 #include <wx/sashwin.h>
57 #include <wx/spinbutt.h>
58 #include <wx/spinctrl.h>
59 #include <wx/splash.h>
60 #include <wx/splitter.h>
61 #include <wx/statline.h>
62 #include <wx/stream.h>
63 #include <wx/sysopt.h>
64 #include <wx/taskbar.h>
65 #include <wx/tglbtn.h>
66 #include <wx/tipwin.h>
67 #include <wx/tooltip.h>
69 #include <wx/vscroll.h>
73 # pragma warning(disable:4800)
74 # pragma warning(disable:4190)
77 #ifdef __WXMAC__ // avoid a bug in Carbon headers
81 //---------------------------------------------------------------------------
83 typedef unsigned char byte
;
84 typedef wxPoint2DDouble wxPoint2D
;
86 const bool True
= true;
87 const bool False
= false;
90 #ifndef wxPyUSE_EXPORTED_API
92 void __wxPyPreStart(PyObject
*);
94 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
95 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
98 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
101 bool wxPyCheckSwigType(const wxChar
* className
);
102 PyObject
* wxPyConstructObject(void* ptr
,
103 const wxChar
* className
,
105 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
106 const wxChar
* className
);
107 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
110 PyObject
* wx2PyString(const wxString
& src
);
111 wxString
Py2wxString(PyObject
* source
);
113 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
114 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
115 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
117 PyObject
* wxPy_ConvertList(wxListBase
* list
);
118 long wxPyGetWinHandle(wxWindow
* win
);
120 void wxPy_ReinitStockObjects(int pass
);
122 bool wxPyInstance_Check(PyObject
* obj
);
123 bool wxPySwigInstance_Check(PyObject
* obj
);
126 #endif // wxPyUSE_EXPORTED_API
127 //---------------------------------------------------------------------------
129 // if we want to handle threads and Python threads are available...
130 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
131 #define WXP_WITH_THREAD
132 #else // no Python threads...
133 #undef WXP_WITH_THREAD
136 #ifndef wxPyUSE_EXPORTED_API
138 // For Python --> C++
139 PyThreadState
* wxPyBeginAllowThreads();
140 void wxPyEndAllowThreads(PyThreadState
* state
);
142 // For C++ --> Python
143 void wxPyBeginBlockThreads();
144 void wxPyEndBlockThreads();
146 #endif // wxPyUSE_EXPORTED_API
148 #define wxPyBLOCK_THREADS(stmt) { wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(); }
149 #define wxPyRaiseNotImplemented() wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
151 //---------------------------------------------------------------------------
152 // These are helpers used by the typemaps
154 #ifndef wxPyUSE_EXPORTED_API
156 wxString
* wxString_in_helper(PyObject
* source
);
158 byte
* byte_LIST_helper(PyObject
* source
);
159 int* int_LIST_helper(PyObject
* source
);
160 long* long_LIST_helper(PyObject
* source
);
161 char** string_LIST_helper(PyObject
* source
);
162 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
163 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
164 wxString
* wxString_LIST_helper(PyObject
* source
);
165 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
166 wxPen
** wxPen_LIST_helper(PyObject
* source
);
168 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
169 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
170 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
171 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
172 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
173 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
176 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
177 bool wxColour_typecheck(PyObject
* source
);
181 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
183 // If source is an object instance then it may already be the right type
184 if (wxPySwigInstance_Check(source
)) {
186 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
191 // otherwise a 2-tuple of integers is expected
192 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
193 PyObject
* o1
= PySequence_GetItem(source
, 0);
194 PyObject
* o2
= PySequence_GetItem(source
, 1);
195 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
200 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
208 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
209 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
215 // Other helpful stuff
216 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
217 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
219 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
220 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
222 #endif // wxPyUSE_EXPORTED_API
224 //---------------------------------------------------------------------------
226 #if PYTHON_API_VERSION < 1009
227 #define PySequence_Fast_GET_ITEM(o, i) \
228 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
231 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
232 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
233 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
235 //---------------------------------------------------------------------------
237 #ifndef wxPyUSE_EXPORTED_API
239 class wxPyCallback
: public wxObject
{
240 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
242 wxPyCallback(PyObject
* func
);
243 wxPyCallback(const wxPyCallback
& other
);
246 void EventThunker(wxEvent
& event
);
251 #endif // wxPyUSE_EXPORTED_API
252 //---------------------------------------------------------------------------
253 //---------------------------------------------------------------------------
254 // These Event classes can be derived from in Python and passed through the
255 // event system without loosing anything. They do this by keeping a reference
256 // to themselves and some special case handling in wxPyCallback::EventThunker.
260 class wxPyEvtSelfRef
{
265 void SetSelf(PyObject
* self
, bool clone
=False
);
266 PyObject
* GetSelf() const;
267 bool GetCloned() const { return m_cloned
; }
275 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
276 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
278 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
279 wxPyEvent(const wxPyEvent
& evt
);
282 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
286 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
287 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
289 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
290 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
293 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
298 //----------------------------------------------------------------------
299 // Forward decalre a few things used in the exported API
300 class wxPyClientData
;
302 class wxPyOORClientData
;
303 class wxPyCBInputStream
;
305 void wxPyClientData_dtor(wxPyClientData
* self
);
306 void wxPyUserData_dtor(wxPyUserData
* self
);
307 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
308 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
311 //---------------------------------------------------------------------------
312 // Export a C API in a struct. Other modules will be able to load this from
313 // the wx.core module and will then have safe access to these functions, even if
314 // in another shared library.
316 class wxPyCallbackHelper
;
317 struct swig_type_info
;
318 struct swig_const_info
;
321 // Make SunCC happy and make typedef's for these that are extern "C"
322 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
323 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
324 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
325 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
326 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
327 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
328 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
329 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
330 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
331 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
332 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
333 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
334 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
335 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
336 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
337 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
338 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
343 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
344 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
345 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
346 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
347 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
348 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
349 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
350 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
351 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
352 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
353 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
354 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
355 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
356 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
357 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
358 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
359 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
362 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
363 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
364 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
365 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
367 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
368 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
369 void (*p_wxPyBeginBlockThreads
)();
370 void (*p_wxPyEndBlockThreads
)();
372 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
374 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
375 wxString (*p_Py2wxString
)(PyObject
* source
);
376 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
378 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
379 int* (*p_int_LIST_helper
)(PyObject
* source
);
380 long* (*p_long_LIST_helper
)(PyObject
* source
);
381 char** (*p_string_LIST_helper
)(PyObject
* source
);
382 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
383 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
384 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
385 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
387 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
388 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
389 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
390 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
391 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
392 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
395 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
396 bool (*p_wxColour_typecheck
)(PyObject
* source
);
398 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
399 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
400 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
401 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
402 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
404 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
405 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
406 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
407 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
408 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
409 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
410 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
412 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
413 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
414 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
416 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
418 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
419 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
423 #ifdef wxPyUSE_EXPORTED_API
424 // Notice that this is static, not extern. This is by design, each module
425 // needs one, but doesn't have to use it.
426 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
427 #endif // wxPyUSE_EXPORTED_API
429 //---------------------------------------------------------------------------
431 // A wxObject that holds a reference to a Python object
432 class wxPyUserData
: public wxObject
{
434 wxPyUserData(PyObject
* obj
) {
440 #ifdef wxPyUSE_EXPORTED_API
441 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
443 wxPyUserData_dtor(this);
450 // A wxClientData that holds a refernece to a Python object
451 class wxPyClientData
: public wxClientData
{
453 wxPyClientData(PyObject
* obj
) {
459 #ifdef wxPyUSE_EXPORTED_API
460 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
462 wxPyClientData_dtor(this);
469 // Just like wxPyClientData, except when this object is destroyed it does some
470 // OOR magic on the Python Object.
471 class wxPyOORClientData
: public wxPyClientData
{
473 wxPyOORClientData(PyObject
* obj
)
474 : wxPyClientData(obj
) {}
476 ~wxPyOORClientData() {
477 #ifdef wxPyUSE_EXPORTED_API
478 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
480 wxPyOORClientData_dtor(this);
486 //---------------------------------------------------------------------------
487 // This class holds an instance of a Python Shadow Class object and assists
488 // with looking up and invoking Python callback methods from C++ virtual
489 // method redirections. For all classes which have virtuals which should be
490 // overridable in wxPython, a new subclass is created that contains a
491 // wxPyCallbackHelper.
494 class wxPyCallbackHelper
{
496 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
498 wxPyCallbackHelper() {
505 ~wxPyCallbackHelper() {
506 #ifdef wxPyUSE_EXPORTED_API
507 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
509 wxPyCBH_delete(this);
513 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
514 bool findCallback(const char* name
) const;
515 int callCallback(PyObject
* argTuple
) const;
516 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
517 PyObject
* GetLastFound() const { return m_lastFound
; }
522 PyObject
* m_lastFound
;
525 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
529 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
530 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
531 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
532 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
533 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
538 //---------------------------------------------------------------------------
540 // This is used in C++ classes that need to be able to make callback to
541 // "overloaded" python methods
544 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
545 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
547 private: wxPyCallbackHelper m_myInst
550 //---------------------------------------------------------------------------
551 // The wxPythonApp class
554 wxPYAPP_ASSERT_SUPPRESS
= 1,
555 wxPYAPP_ASSERT_EXCEPTION
= 2,
556 wxPYAPP_ASSERT_DIALOG
= 4,
557 wxPYAPP_ASSERT_LOG
= 8
560 class wxPyApp
: public wxApp
562 DECLARE_ABSTRACT_CLASS(wxPyApp
);
570 int GetAssertMode() { return m_assertMode
; }
571 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
573 virtual bool OnInitGui();
574 virtual int OnExit();
576 virtual void OnAssert(const wxChar
*file
,
581 // virtual int FilterEvent(wxEvent& event); // This one too????
584 static bool GetMacSupportPCMenuShortcuts();
585 static long GetMacAboutMenuItemId();
586 static long GetMacPreferencesMenuItemId();
587 static long GetMacExitMenuItemId();
588 static wxString
GetMacHelpMenuTitleName();
590 static void SetMacSupportPCMenuShortcuts(bool val
);
591 static void SetMacAboutMenuItemId(long val
);
592 static void SetMacPreferencesMenuItemId(long val
);
593 static void SetMacExitMenuItemId(long val
);
594 static void SetMacHelpMenuTitleName(const wxString
& val
);
597 void _BootstrapApp();
599 // implementation only
600 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
604 bool m_startupComplete
;
607 extern wxPyApp
*wxPythonApp
;
610 //----------------------------------------------------------------------
611 // These macros are used to implement the virtual methods that should
612 // redirect to a Python method if one exists. The names designate the
613 // return type, if any, as well as any parameter types.
614 //---------------------------------------------------------------------------
616 #define DEC_PYCALLBACK__(CBNAME) \
621 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
622 void CLASS::CBNAME() { \
624 wxPyBeginBlockThreads(); \
625 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
626 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
627 wxPyEndBlockThreads(); \
631 void CLASS::base_##CBNAME() { \
635 //---------------------------------------------------------------------------
637 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
638 bool CBNAME(int a, int b); \
639 bool base_##CBNAME(int a, int b)
642 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
643 bool CLASS::CBNAME(int a, int b) { \
644 bool rval=False, found; \
645 wxPyBeginBlockThreads(); \
646 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
647 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
648 wxPyEndBlockThreads(); \
650 rval = PCLASS::CBNAME(a,b); \
653 bool CLASS::base_##CBNAME(int a, int b) { \
654 return PCLASS::CBNAME(a,b); \
657 //---------------------------------------------------------------------------
659 #define DEC_PYCALLBACK_VOID_(CBNAME) \
664 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
665 void CLASS::CBNAME() { \
667 wxPyBeginBlockThreads(); \
668 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
669 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
670 wxPyEndBlockThreads(); \
674 void CLASS::base_##CBNAME() { \
678 //---------------------------------------------------------------------------
680 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
681 void CBNAME(int a, int b); \
682 void base_##CBNAME(int a, int b)
685 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
686 void CLASS::CBNAME(int a, int b) { \
688 wxPyBeginBlockThreads(); \
689 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
690 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
691 wxPyEndBlockThreads(); \
693 PCLASS::CBNAME(a,b); \
695 void CLASS::base_##CBNAME(int a, int b) { \
696 PCLASS::CBNAME(a,b); \
699 //---------------------------------------------------------------------------
701 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
702 void CBNAME(int a); \
703 void base_##CBNAME(int a)
706 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
707 void CLASS::CBNAME(int a) { \
709 wxPyBeginBlockThreads(); \
710 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
711 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
712 wxPyEndBlockThreads(); \
716 void CLASS::base_##CBNAME(int a) { \
720 //---------------------------------------------------------------------------
722 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
723 void CBNAME(int a, int b, int c, int d); \
724 void base_##CBNAME(int a, int b, int c, int d)
727 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
728 void CLASS::CBNAME(int a, int b, int c, int d) { \
730 wxPyBeginBlockThreads(); \
731 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
732 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
733 wxPyEndBlockThreads(); \
735 PCLASS::CBNAME(a,b,c,d); \
737 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
738 PCLASS::CBNAME(a,b,c,d); \
741 //---------------------------------------------------------------------------
742 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
743 void CBNAME(int a, int b, int c, int d, int e); \
744 void base_##CBNAME(int a, int b, int c, int d, int e)
747 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
748 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
750 wxPyBeginBlockThreads(); \
751 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
752 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
753 wxPyEndBlockThreads(); \
755 PCLASS::CBNAME(a,b,c,d,e); \
757 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
758 PCLASS::CBNAME(a,b,c,d,e); \
761 //---------------------------------------------------------------------------
763 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
764 void CBNAME(int* a, int* b) const; \
765 void base_##CBNAME(int* a, int* b) const
768 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
769 void CLASS::CBNAME(int* a, int* b) const { \
770 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
772 wxPyBeginBlockThreads(); \
773 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
775 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
777 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
778 PyObject* o1 = PySequence_GetItem(ro, 0); \
779 PyObject* o2 = PySequence_GetItem(ro, 1); \
780 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
781 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
784 PyErr_SetString(PyExc_TypeError, errmsg); \
789 PyErr_SetString(PyExc_TypeError, errmsg); \
794 wxPyEndBlockThreads(); \
796 PCLASS::CBNAME(a,b); \
798 void CLASS::base_##CBNAME(int* a, int* b) const { \
799 PCLASS::CBNAME(a,b); \
803 //---------------------------------------------------------------------------
805 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
806 wxSize CBNAME() const; \
807 wxSize base_##CBNAME() const
810 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
811 wxSize CLASS::CBNAME() const { \
812 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
813 bool found; wxSize rval(0,0); \
814 wxPyBeginBlockThreads(); \
815 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
817 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
819 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
820 PyObject* o1 = PySequence_GetItem(ro, 0); \
821 PyObject* o2 = PySequence_GetItem(ro, 1); \
822 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
823 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
826 PyErr_SetString(PyExc_TypeError, errmsg); \
831 PyErr_SetString(PyExc_TypeError, errmsg); \
836 wxPyEndBlockThreads(); \
838 return PCLASS::CBNAME(); \
842 wxSize CLASS::base_##CBNAME() const { \
843 return PCLASS::CBNAME(); \
847 //---------------------------------------------------------------------------
849 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
850 bool CBNAME(bool a); \
851 bool base_##CBNAME(bool a)
854 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
855 bool CLASS::CBNAME(bool a) { \
856 bool rval=False, found; \
857 wxPyBeginBlockThreads(); \
858 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
859 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
860 wxPyEndBlockThreads(); \
862 rval = PCLASS::CBNAME(a); \
865 bool CLASS::base_##CBNAME(bool a) { \
866 return PCLASS::CBNAME(a); \
869 //---------------------------------------------------------------------------
871 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
872 bool CBNAME(int a); \
873 bool base_##CBNAME(int a)
876 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
877 bool CLASS::CBNAME(int a) { \
878 bool rval=False, found; \
879 wxPyBeginBlockThreads(); \
880 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
881 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
882 wxPyEndBlockThreads(); \
884 rval = PCLASS::CBNAME(a); \
887 bool CLASS::base_##CBNAME(int a) { \
888 return PCLASS::CBNAME(a); \
891 //---------------------------------------------------------------------------
893 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
897 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
898 bool CLASS::CBNAME(int a) { \
900 wxPyBeginBlockThreads(); \
901 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
902 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
904 wxPyEndBlockThreads(); \
909 //---------------------------------------------------------------------------
911 #define DEC_PYCALLBACK__DC(CBNAME) \
912 void CBNAME(wxDC& a); \
913 void base_##CBNAME(wxDC& a)
916 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
917 void CLASS::CBNAME(wxDC& a) { \
919 wxPyBeginBlockThreads(); \
920 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
921 PyObject* obj = wxPyMake_wxObject(&a); \
922 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
925 wxPyEndBlockThreads(); \
929 void CLASS::base_##CBNAME(wxDC& a) { \
935 //---------------------------------------------------------------------------
937 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
938 void CBNAME(wxDC& a, bool b); \
939 void base_##CBNAME(wxDC& a, bool b)
942 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
943 void CLASS::CBNAME(wxDC& a, bool b) { \
945 wxPyBeginBlockThreads(); \
946 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
947 PyObject* obj = wxPyMake_wxObject(&a); \
948 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
951 wxPyEndBlockThreads(); \
953 PCLASS::CBNAME(a, b); \
955 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
956 PCLASS::CBNAME(a, b); \
959 //---------------------------------------------------------------------------
961 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
962 void CBNAME(wxDC& a, bool b); \
963 void base_##CBNAME(wxDC& a, bool b)
966 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
967 void CLASS::CBNAME(wxDC& a, bool b) { \
969 wxPyBeginBlockThreads(); \
970 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
971 PyObject* obj = wxPyMake_wxObject(&a); \
972 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
975 wxPyEndBlockThreads(); \
977 PCLASS::CBNAME(a, b); \
979 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
980 PCLASS::CBNAME(a, b); \
983 //---------------------------------------------------------------------------
985 #define DEC_PYCALLBACK__2DBL(CBNAME) \
986 void CBNAME(double a, double b); \
987 void base_##CBNAME(double a, double b)
990 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
991 void CLASS::CBNAME(double a, double b) { \
993 wxPyBeginBlockThreads(); \
994 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
995 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
996 wxPyEndBlockThreads(); \
998 PCLASS::CBNAME(a, b); \
1000 void CLASS::base_##CBNAME(double a, double b) { \
1001 PCLASS::CBNAME(a, b); \
1004 //---------------------------------------------------------------------------
1006 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1007 void CBNAME(double a, double b, int c, int d); \
1008 void base_##CBNAME(double a, double b, int c, int d)
1011 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1012 void CLASS::CBNAME(double a, double b, int c, int d) { \
1014 wxPyBeginBlockThreads(); \
1015 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1016 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1018 wxPyEndBlockThreads(); \
1020 PCLASS::CBNAME(a, b, c, d); \
1022 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1023 PCLASS::CBNAME(a, b, c, d); \
1026 //---------------------------------------------------------------------------
1028 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1029 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1030 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1033 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1034 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1036 wxPyBeginBlockThreads(); \
1037 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1038 PyObject* obj = wxPyMake_wxObject(&a); \
1039 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1042 wxPyEndBlockThreads(); \
1044 PCLASS::CBNAME(a, b, c, d, e, f); \
1046 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1047 PCLASS::CBNAME(a, b, c, d, e, f); \
1050 //---------------------------------------------------------------------------
1052 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1053 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1054 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1057 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1058 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1060 wxPyBeginBlockThreads(); \
1062 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1063 PyObject* obj = wxPyMake_wxObject(&a); \
1064 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1067 wxPyEndBlockThreads(); \
1069 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1072 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1073 return PCLASS::CBNAME(a, b, c, d, e, f); \
1076 //---------------------------------------------------------------------------
1078 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1079 void CBNAME(bool a, double b, double c, int d, int e); \
1080 void base_##CBNAME(bool a, double b, double c, int d, int e)
1083 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1084 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1086 wxPyBeginBlockThreads(); \
1087 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1088 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1090 wxPyEndBlockThreads(); \
1092 PCLASS::CBNAME(a, b, c, d, e); \
1094 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1095 PCLASS::CBNAME(a, b, c, d, e); \
1098 //---------------------------------------------------------------------------
1100 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1101 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1102 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1105 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1106 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1108 wxPyBeginBlockThreads(); \
1109 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1110 PyObject* obj = wxPyMake_wxObject(&a); \
1111 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1114 wxPyEndBlockThreads(); \
1116 PCLASS::CBNAME(a, b, c, d, e); \
1118 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1119 PCLASS::CBNAME(a, b, c, d, e); \
1122 //---------------------------------------------------------------------------
1124 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1125 void CBNAME(wxDC& a, bool b); \
1126 void base_##CBNAME(wxDC& a, bool b)
1129 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1130 void CLASS::CBNAME(wxDC& a, bool b) { \
1132 wxPyBeginBlockThreads(); \
1133 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1134 PyObject* obj = wxPyMake_wxObject(&a); \
1135 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1138 wxPyEndBlockThreads(); \
1140 PCLASS::CBNAME(a, b); \
1142 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1143 PCLASS::CBNAME(a, b); \
1146 //---------------------------------------------------------------------------
1148 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1149 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1150 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1153 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1154 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1157 wxPyBeginBlockThreads(); \
1158 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1159 PyObject* obj = wxPyMake_wxObject(a); \
1160 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1163 wxPyEndBlockThreads(); \
1165 PCLASS::CBNAME(a, b, c, d, e, f); \
1167 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1169 PCLASS::CBNAME(a, b, c, d, e, f); \
1172 //---------------------------------------------------------------------------
1174 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1175 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1176 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1179 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1180 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1182 wxPyBeginBlockThreads(); \
1183 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1184 PyObject* obj = wxPyMake_wxObject(a); \
1185 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1188 wxPyEndBlockThreads(); \
1190 PCLASS::CBNAME(a, b, c, d, e); \
1192 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1194 PCLASS::CBNAME(a, b, c, d, e); \
1197 //---------------------------------------------------------------------------
1199 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1200 void CBNAME(double a, double b, int c); \
1201 void base_##CBNAME(double a, double b, int c)
1204 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1205 void CLASS::CBNAME(double a, double b, int c) { \
1207 wxPyBeginBlockThreads(); \
1208 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1209 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1210 wxPyEndBlockThreads(); \
1212 PCLASS::CBNAME(a, b, c); \
1214 void CLASS::base_##CBNAME(double a, double b, int c) { \
1215 PCLASS::CBNAME(a, b, c); \
1218 //---------------------------------------------------------------------------
1220 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1221 void CBNAME(bool a, double b, double c, int d); \
1222 void base_##CBNAME(bool a, double b, double c, int d)
1225 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1226 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1228 wxPyBeginBlockThreads(); \
1229 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1230 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1231 wxPyEndBlockThreads(); \
1233 PCLASS::CBNAME(a, b, c, d); \
1235 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1236 PCLASS::CBNAME(a, b, c, d); \
1239 //---------------------------------------------------------------------------
1240 //---------------------------------------------------------------------------
1242 #define DEC_PYCALLBACK__STRING(CBNAME) \
1243 void CBNAME(const wxString& a); \
1244 void base_##CBNAME(const wxString& a)
1246 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1247 void CLASS::CBNAME(const wxString& a) { \
1249 wxPyBeginBlockThreads(); \
1250 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1251 PyObject* s = wx2PyString(a); \
1252 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1255 wxPyEndBlockThreads(); \
1257 PCLASS::CBNAME(a); \
1259 void CLASS::base_##CBNAME(const wxString& a) { \
1260 PCLASS::CBNAME(a); \
1263 //---------------------------------------------------------------------------
1265 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1266 bool CBNAME(const wxString& a); \
1267 bool base_##CBNAME(const wxString& a)
1269 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1270 bool CLASS::CBNAME(const wxString& a) { \
1273 wxPyBeginBlockThreads(); \
1274 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1275 PyObject* s = wx2PyString(a); \
1276 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1279 wxPyEndBlockThreads(); \
1281 rval = PCLASS::CBNAME(a); \
1284 bool CLASS::base_##CBNAME(const wxString& a) { \
1285 return PCLASS::CBNAME(a); \
1288 //---------------------------------------------------------------------------
1290 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1291 bool CBNAME(const wxString& a)
1293 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1294 bool CLASS::CBNAME(const wxString& a) { \
1296 wxPyBeginBlockThreads(); \
1297 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1298 PyObject* s = wx2PyString(a); \
1299 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1302 wxPyEndBlockThreads(); \
1306 //---------------------------------------------------------------------------
1308 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1309 wxString CBNAME(const wxString& a)
1311 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1312 wxString CLASS::CBNAME(const wxString& a) { \
1314 wxPyBeginBlockThreads(); \
1315 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1317 PyObject* s = wx2PyString(a); \
1318 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1321 rval = Py2wxString(ro); \
1325 wxPyEndBlockThreads(); \
1329 //---------------------------------------------------------------------------
1331 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1332 wxString CBNAME(const wxString& a); \
1333 wxString base_##CBNAME(const wxString& a)
1335 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1336 wxString CLASS::CBNAME(const wxString& a) { \
1339 wxPyBeginBlockThreads(); \
1340 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1342 PyObject* s = wx2PyString(a); \
1343 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1346 rval = Py2wxString(ro); \
1351 rval = PCLASS::CBNAME(a); \
1352 wxPyEndBlockThreads(); \
1356 //---------------------------------------------------------------------------
1358 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1359 wxString CBNAME(const wxString& a,int b)
1361 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1362 wxString CLASS::CBNAME(const wxString& a,int b) { \
1364 wxPyBeginBlockThreads(); \
1365 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1367 PyObject* s = wx2PyString(a); \
1368 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1371 rval = Py2wxString(ro); \
1375 wxPyEndBlockThreads(); \
1379 //---------------------------------------------------------------------------
1381 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1382 bool CBNAME(const wxString& a, const wxString& b); \
1383 bool base_##CBNAME(const wxString& a, const wxString& b)
1385 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1386 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1389 wxPyBeginBlockThreads(); \
1390 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1391 PyObject* s1 = wx2PyString(a); \
1392 PyObject* s2 = wx2PyString(b); \
1393 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1397 wxPyEndBlockThreads(); \
1399 rval = PCLASS::CBNAME(a, b); \
1402 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1403 return PCLASS::CBNAME(a, b); \
1406 //---------------------------------------------------------------------------
1408 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1409 wxString CBNAME(); \
1410 wxString base_##CBNAME()
1412 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1413 wxString CLASS::CBNAME() { \
1416 wxPyBeginBlockThreads(); \
1417 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1419 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1421 rval = Py2wxString(ro); \
1425 wxPyEndBlockThreads(); \
1427 rval = PCLASS::CBNAME(); \
1430 wxString CLASS::base_##CBNAME() { \
1431 return PCLASS::CBNAME(); \
1434 //---------------------------------------------------------------------------
1436 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1437 wxString CBNAME() const; \
1438 wxString base_##CBNAME() const;
1440 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1441 wxString CLASS::CBNAME() const { \
1444 wxPyBeginBlockThreads(); \
1445 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1447 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1449 rval = Py2wxString(ro); \
1453 wxPyEndBlockThreads(); \
1455 rval = PCLASS::CBNAME(); \
1458 wxString CLASS::base_##CBNAME() const { \
1459 return PCLASS::CBNAME(); \
1462 //---------------------------------------------------------------------------
1464 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1467 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1468 wxString CLASS::CBNAME() { \
1470 wxPyBeginBlockThreads(); \
1471 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1473 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1475 rval = Py2wxString(ro); \
1479 wxPyEndBlockThreads(); \
1483 //---------------------------------------------------------------------------
1485 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1486 wxString CBNAME() const;
1488 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1489 wxString CLASS::CBNAME() const { \
1491 wxPyBeginBlockThreads(); \
1492 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1494 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1496 rval = Py2wxString(ro); \
1500 wxPyEndBlockThreads(); \
1504 //---------------------------------------------------------------------------
1506 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1507 bool CBNAME(const wxHtmlTag& a)
1510 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1511 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1513 wxPyBeginBlockThreads(); \
1514 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1515 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1516 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1519 wxPyEndBlockThreads(); \
1523 //---------------------------------------------------------------------------
1525 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1526 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1527 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1529 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1530 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1532 wxPyBeginBlockThreads(); \
1533 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1534 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1535 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1538 wxPyEndBlockThreads(); \
1540 PCLASS::CBNAME(cell, x, y); \
1542 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1543 PCLASS::CBNAME(cell, x, y); \
1547 //---------------------------------------------------------------------------
1549 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1550 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1551 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1553 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1554 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1556 wxPyBeginBlockThreads(); \
1557 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1558 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1559 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1560 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1564 wxPyEndBlockThreads(); \
1566 PCLASS::CBNAME(cell, x, y, e); \
1568 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1569 PCLASS::CBNAME(cell, x, y, e); \
1574 //---------------------------------------------------------------------------
1576 #define DEC_PYCALLBACK___pure(CBNAME) \
1580 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1581 void CLASS::CBNAME() { \
1582 wxPyBeginBlockThreads(); \
1583 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1584 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1585 wxPyEndBlockThreads(); \
1588 //---------------------------------------------------------------------------
1590 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1594 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1595 wxSize CLASS::CBNAME() { \
1596 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1598 wxPyBeginBlockThreads(); \
1599 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1602 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1604 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1606 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1607 PyObject* o1 = PySequence_GetItem(ro, 0); \
1608 PyObject* o2 = PySequence_GetItem(ro, 1); \
1609 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1610 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1612 PyErr_SetString(PyExc_TypeError, errmsg); \
1617 PyErr_SetString(PyExc_TypeError, errmsg); \
1622 wxPyEndBlockThreads(); \
1626 //---------------------------------------------------------------------------
1628 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1629 bool CBNAME(wxWindow* a); \
1630 bool base_##CBNAME(wxWindow* a)
1633 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1634 bool CLASS::CBNAME(wxWindow* a) { \
1637 wxPyBeginBlockThreads(); \
1638 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1639 PyObject* obj = wxPyMake_wxObject(a); \
1640 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1643 wxPyEndBlockThreads(); \
1645 rval = PCLASS::CBNAME(a); \
1648 bool CLASS::base_##CBNAME(wxWindow* a) { \
1649 return PCLASS::CBNAME(a); \
1652 //---------------------------------------------------------------------------
1654 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1655 bool CBNAME(wxWindow* a, wxDC& b); \
1656 bool base_##CBNAME(wxWindow* a, wxDC& b)
1659 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1660 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1663 wxPyBeginBlockThreads(); \
1664 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1665 PyObject* win = wxPyMake_wxObject(a); \
1666 PyObject* dc = wxPyMake_wxObject(&b); \
1667 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1671 wxPyEndBlockThreads(); \
1673 rval = PCLASS::CBNAME(a, b); \
1676 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1677 return PCLASS::CBNAME(a, b); \
1680 //---------------------------------------------------------------------------
1682 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1683 void CBNAME(wxWindowBase* a); \
1684 void base_##CBNAME(wxWindowBase* a)
1687 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1688 void CLASS::CBNAME(wxWindowBase* a) { \
1690 wxPyBeginBlockThreads(); \
1691 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1692 PyObject* obj = wxPyMake_wxObject(a); \
1693 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1696 wxPyEndBlockThreads(); \
1698 PCLASS::CBNAME(a); \
1700 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1701 PCLASS::CBNAME(a); \
1704 //---------------------------------------------------------------------------
1706 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1708 bool base_##CBNAME()
1711 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1712 bool CLASS::CBNAME() { \
1715 wxPyBeginBlockThreads(); \
1716 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1717 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1718 wxPyEndBlockThreads(); \
1720 rval = PCLASS::CBNAME(); \
1723 bool CLASS::base_##CBNAME() { \
1724 return PCLASS::CBNAME(); \
1727 //---------------------------------------------------------------------------
1729 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1730 bool CBNAME() const; \
1731 bool base_##CBNAME() const
1734 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1735 bool CLASS::CBNAME() const { \
1738 wxPyBeginBlockThreads(); \
1739 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1740 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1741 wxPyEndBlockThreads(); \
1743 rval = PCLASS::CBNAME(); \
1746 bool CLASS::base_##CBNAME() const { \
1747 return PCLASS::CBNAME(); \
1750 //---------------------------------------------------------------------------
1752 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1753 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1754 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1757 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1758 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1761 wxPyBeginBlockThreads(); \
1762 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1763 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1764 wxPyEndBlockThreads(); \
1766 rval = PCLASS::CBNAME(a, b, c); \
1767 return (wxDragResult)rval; \
1769 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1770 return PCLASS::CBNAME(a, b, c); \
1773 //---------------------------------------------------------------------------
1775 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1776 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1778 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1779 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1780 wxPyBeginBlockThreads(); \
1782 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1784 PyObject* obj = wxPyMake_wxObject(&a); \
1785 PyObject* s = wx2PyString(b); \
1786 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1789 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1795 wxPyEndBlockThreads(); \
1799 //---------------------------------------------------------------------------
1801 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1802 bool CBNAME(wxDragResult a); \
1803 bool base_##CBNAME(wxDragResult a)
1806 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1807 bool CLASS::CBNAME(wxDragResult a) { \
1810 wxPyBeginBlockThreads(); \
1811 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1812 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1813 wxPyEndBlockThreads(); \
1815 rval = PCLASS::CBNAME(a); \
1818 bool CLASS::base_##CBNAME(wxDragResult a) { \
1819 return PCLASS::CBNAME(a); \
1822 //---------------------------------------------------------------------------
1824 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1825 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1828 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1829 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1830 wxPyBeginBlockThreads(); \
1832 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1833 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1834 wxPyEndBlockThreads(); \
1835 return (wxDragResult)rval; \
1838 //---------------------------------------------------------------------------
1840 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1841 bool CBNAME(int a, int b, const wxString& c)
1843 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1844 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1846 wxPyBeginBlockThreads(); \
1847 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1848 PyObject* s = wx2PyString(c); \
1849 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1852 wxPyEndBlockThreads(); \
1856 //---------------------------------------------------------------------------
1858 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1860 size_t base_##CBNAME()
1863 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1864 size_t CLASS::CBNAME() { \
1867 wxPyBeginBlockThreads(); \
1868 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1869 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1870 wxPyEndBlockThreads(); \
1872 rval = PCLASS::CBNAME(); \
1875 size_t CLASS::base_##CBNAME() { \
1876 return PCLASS::CBNAME(); \
1879 //---------------------------------------------------------------------------
1881 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1882 size_t CBNAME() const; \
1883 size_t base_##CBNAME() const
1886 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1887 size_t CLASS::CBNAME() const { \
1890 wxPyBeginBlockThreads(); \
1891 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1892 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1893 wxPyEndBlockThreads(); \
1895 rval = PCLASS::CBNAME(); \
1898 size_t CLASS::base_##CBNAME() const { \
1899 return PCLASS::CBNAME(); \
1902 //---------------------------------------------------------------------------
1904 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1905 wxDataFormat CBNAME(size_t a); \
1906 wxDataFormat base_##CBNAME(size_t a)
1909 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1910 wxDataFormat CLASS::CBNAME(size_t a) { \
1911 wxDataFormat rval=0; \
1913 wxPyBeginBlockThreads(); \
1914 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1916 wxDataFormat* ptr; \
1917 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1919 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1924 wxPyEndBlockThreads(); \
1926 rval = PCLASS::CBNAME(a); \
1929 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1930 return PCLASS::CBNAME(a); \
1933 //---------------------------------------------------------------------------
1935 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1936 void CBNAME(const Type& a); \
1937 void base_##CBNAME(const Type& a)
1940 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1941 void CLASS::CBNAME(const Type& a) { \
1943 wxPyBeginBlockThreads(); \
1944 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1945 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1946 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1949 wxPyEndBlockThreads(); \
1951 PCLASS::CBNAME(a); \
1953 void CLASS::base_##CBNAME(const Type& a) { \
1954 PCLASS::CBNAME(a); \
1958 //---------------------------------------------------------------------------
1960 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1961 void CBNAME(Type& a); \
1962 void base_##CBNAME(Type& a)
1965 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1966 void CLASS::CBNAME(Type& a) { \
1968 wxPyBeginBlockThreads(); \
1969 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1970 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1971 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1974 wxPyEndBlockThreads(); \
1976 PCLASS::CBNAME(a); \
1978 void CLASS::base_##CBNAME(Type& a) { \
1979 PCLASS::CBNAME(a); \
1982 //---------------------------------------------------------------------------
1984 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1985 bool CBNAME(Type& a); \
1986 bool base_##CBNAME(Type& a)
1989 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1990 bool CLASS::CBNAME(Type& a) { \
1993 wxPyBeginBlockThreads(); \
1994 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1995 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1996 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1999 wxPyEndBlockThreads(); \
2001 rv = PCLASS::CBNAME(a); \
2004 bool CLASS::base_##CBNAME(Type& a) { \
2005 return PCLASS::CBNAME(a); \
2008 //---------------------------------------------------------------------------
2010 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2011 bool CBNAME(Type& a)
2014 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2015 bool CLASS::CBNAME(Type& a) { \
2017 wxPyBeginBlockThreads(); \
2018 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2019 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2020 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2023 wxPyEndBlockThreads(); \
2027 //---------------------------------------------------------------------------
2029 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2030 wxString CBNAME(long a, long b) const; \
2031 wxString base_##CBNAME(long a, long b) const
2033 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2034 wxString CLASS::CBNAME(long a, long b) const { \
2037 wxPyBeginBlockThreads(); \
2038 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2040 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2042 rval = Py2wxString(ro); \
2046 wxPyEndBlockThreads(); \
2048 rval = PCLASS::CBNAME(a,b); \
2051 wxString CLASS::base_##CBNAME(long a, long b) const { \
2052 return PCLASS::CBNAME(a,b); \
2055 //---------------------------------------------------------------------------
2057 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2058 int CBNAME(long a) const; \
2059 int base_##CBNAME(long a) const
2062 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2063 int CLASS::CBNAME(long a) const { \
2066 wxPyBeginBlockThreads(); \
2067 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2069 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2071 rval = PyInt_AsLong(ro); \
2075 wxPyEndBlockThreads(); \
2077 rval = PCLASS::CBNAME(a); \
2080 int CLASS::base_##CBNAME(long a) const { \
2081 return PCLASS::CBNAME(a); \
2085 //---------------------------------------------------------------------------
2087 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2088 wxListItemAttr* CBNAME(long a) const; \
2089 wxListItemAttr* base_##CBNAME(long a) const
2092 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2093 wxListItemAttr *CLASS::CBNAME(long a) const { \
2094 wxListItemAttr *rval = NULL; \
2096 wxPyBeginBlockThreads(); \
2097 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2099 wxListItemAttr* ptr; \
2100 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2102 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2107 wxPyEndBlockThreads(); \
2109 rval = PCLASS::CBNAME(a); \
2112 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2113 return PCLASS::CBNAME(a); \
2116 //---------------------------------------------------------------------------
2118 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2119 bool CBNAME(wxMouseEvent& e); \
2120 bool base_##CBNAME(wxMouseEvent& e)
2122 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2123 bool CLASS::CBNAME(wxMouseEvent& e) { \
2126 wxPyBeginBlockThreads(); \
2127 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2129 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2130 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2132 rval = PyInt_AsLong(ro); \
2137 wxPyEndBlockThreads(); \
2139 return PCLASS::CBNAME(e); \
2142 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2143 return PCLASS::CBNAME(e); \
2147 //---------------------------------------------------------------------------
2149 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2150 wxWizardPage* CBNAME() const
2152 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2153 wxWizardPage* CLASS::CBNAME() const { \
2154 wxWizardPage* rv = NULL; \
2155 wxPyBeginBlockThreads(); \
2156 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2158 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2160 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2164 wxPyEndBlockThreads(); \
2168 //---------------------------------------------------------------------------
2170 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2171 wxBitmap CBNAME() const
2173 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2174 wxBitmap CLASS::CBNAME() const { \
2176 wxPyBeginBlockThreads(); \
2177 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2180 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2182 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2187 wxPyEndBlockThreads(); \
2191 //---------------------------------------------------------------------------
2193 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2196 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2197 wxObject* CLASS::CBNAME() { \
2198 wxObject* rv = NULL; \
2199 wxPyBeginBlockThreads(); \
2200 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2202 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2204 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2208 wxPyEndBlockThreads(); \
2212 //---------------------------------------------------------------------------
2214 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2215 wxObject* CBNAME(const wxString& a)
2217 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2218 wxObject* CLASS::CBNAME(const wxString& a) { \
2219 wxObject* rv = NULL; \
2220 wxPyBeginBlockThreads(); \
2221 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2222 PyObject* so = wx2PyString(a); \
2224 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2226 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2231 wxPyEndBlockThreads(); \
2235 //---------------------------------------------------------------------------
2237 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2238 bool CBNAME(wxXmlNode* a)
2241 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2242 bool CLASS::CBNAME(wxXmlNode* a) { \
2244 wxPyBeginBlockThreads(); \
2245 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2246 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2247 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2250 wxPyEndBlockThreads(); \
2254 //---------------------------------------------------------------------------
2256 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2257 wxCoord CBNAME(size_t a) const
2260 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2261 wxCoord CLASS::CBNAME(size_t a) const { \
2264 wxPyBeginBlockThreads(); \
2265 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2268 wxPyEndBlockThreads(); \
2272 //---------------------------------------------------------------------------
2274 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2275 void CBNAME(size_t a, size_t b) const; \
2276 void base_##CBNAME(size_t a, size_t b) const
2279 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2280 void CLASS::CBNAME(size_t a, size_t b) const { \
2282 wxPyBeginBlockThreads(); \
2283 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2284 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2285 wxPyEndBlockThreads(); \
2287 PCLASS::CBNAME(a,b); \
2289 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2290 PCLASS::CBNAME(a,b); \
2293 //---------------------------------------------------------------------------
2295 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2296 wxCoord CBNAME() const; \
2297 wxCoord base_##CBNAME() const
2300 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2301 wxCoord CLASS::CBNAME() const { \
2304 wxPyBeginBlockThreads(); \
2305 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2306 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2307 wxPyEndBlockThreads(); \
2309 rval = PCLASS::CBNAME(); \
2312 wxCoord CLASS::base_##CBNAME() const { \
2313 return PCLASS::CBNAME(); \
2316 //---------------------------------------------------------------------------
2318 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2319 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2322 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2323 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2325 wxPyBeginBlockThreads(); \
2326 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2327 PyObject* obj = wxPyMake_wxObject(&a); \
2328 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2329 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2332 wxPyEndBlockThreads(); \
2335 //---------------------------------------------------------------------------
2337 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2338 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2339 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2342 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2343 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2345 wxPyBeginBlockThreads(); \
2346 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2347 PyObject* obj = wxPyMake_wxObject(&a); \
2348 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2349 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2352 wxPyEndBlockThreads(); \
2354 PCLASS::CBNAME(a,b,c); \
2356 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2357 PCLASS::CBNAME(a,b,c); \
2360 //---------------------------------------------------------------------------
2363 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2364 wxString CBNAME(size_t a) const; \
2365 wxString base_##CBNAME(size_t a) const
2367 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2368 wxString CLASS::CBNAME(size_t a) const { \
2371 wxPyBeginBlockThreads(); \
2372 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2374 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2376 rval = Py2wxString(ro); \
2380 wxPyEndBlockThreads(); \
2382 rval = PCLASS::CBNAME(a); \
2385 wxString CLASS::base_##CBNAME(size_t a) const { \
2386 return PCLASS::CBNAME(a); \
2389 //---------------------------------------------------------------------------
2391 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2392 wxString CBNAME(size_t a) const
2394 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2395 wxString CLASS::CBNAME(size_t a) const { \
2398 wxPyBeginBlockThreads(); \
2399 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2401 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2403 rval = Py2wxString(ro); \
2407 wxPyEndBlockThreads(); \
2411 //---------------------------------------------------------------------------