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
;
85 const bool True
= true;
86 const bool False
= false;
89 #ifndef wxPyUSE_EXPORTED_API
91 void __wxPyPreStart(PyObject
*);
93 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
96 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
99 bool wxPyCheckSwigType(const wxChar
* className
);
100 PyObject
* wxPyConstructObject(void* ptr
,
101 const wxChar
* className
,
103 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
104 const wxChar
* className
);
105 PyObject
* wxPyMakeSwigPtr(void* ptr
, const char* classname
);
108 PyObject
* wx2PyString(const wxString
& src
);
109 wxString
Py2wxString(PyObject
* source
);
111 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
112 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
113 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
115 PyObject
* wxPy_ConvertList(wxListBase
* list
);
116 long wxPyGetWinHandle(wxWindow
* win
);
118 void wxPy_ReinitStockObjects(bool init
);
120 bool wxPyInstance_Check(PyObject
* obj
);
121 bool wxPySwigInstance_Check(PyObject
* obj
);
124 #endif // wxPyUSE_EXPORTED_API
125 //---------------------------------------------------------------------------
127 // if we want to handle threads and Python threads are available...
128 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
129 #define WXP_WITH_THREAD
130 #else // no Python threads...
131 #undef WXP_WITH_THREAD
134 #ifndef wxPyUSE_EXPORTED_API
136 // For Python --> C++
137 PyThreadState
* wxPyBeginAllowThreads();
138 void wxPyEndAllowThreads(PyThreadState
* state
);
140 // For C++ --> Python
141 void wxPyBeginBlockThreads();
142 void wxPyEndBlockThreads();
144 #endif // wxPyUSE_EXPORTED_API
146 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
148 //---------------------------------------------------------------------------
149 // These are helpers used by the typemaps
151 #ifndef wxPyUSE_EXPORTED_API
153 wxString
* wxString_in_helper(PyObject
* source
);
155 byte
* byte_LIST_helper(PyObject
* source
);
156 int* int_LIST_helper(PyObject
* source
);
157 long* long_LIST_helper(PyObject
* source
);
158 char** string_LIST_helper(PyObject
* source
);
159 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
160 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
161 wxString
* wxString_LIST_helper(PyObject
* source
);
162 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
163 wxPen
** wxPen_LIST_helper(PyObject
* source
);
165 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
166 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
167 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
168 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
169 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
170 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
173 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
174 bool wxColour_typecheck(PyObject
* source
);
178 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
180 // If source is an object instance then it may already be the right type
181 if (wxPySwigInstance_Check(source
)) {
183 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
188 // otherwise a 2-tuple of integers is expected
189 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
190 PyObject
* o1
= PySequence_GetItem(source
, 0);
191 PyObject
* o2
= PySequence_GetItem(source
, 1);
192 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
197 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
205 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
206 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
212 // Other helpful stuff
213 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
214 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
216 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
217 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
219 #endif // wxPyUSE_EXPORTED_API
221 //---------------------------------------------------------------------------
223 #if PYTHON_API_VERSION < 1009
224 #define PySequence_Fast_GET_ITEM(o, i) \
225 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
228 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
229 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
230 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
232 //---------------------------------------------------------------------------
234 #ifndef wxPyUSE_EXPORTED_API
236 class wxPyCallback
: public wxObject
{
237 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
239 wxPyCallback(PyObject
* func
);
240 wxPyCallback(const wxPyCallback
& other
);
243 void EventThunker(wxEvent
& event
);
248 #endif // wxPyUSE_EXPORTED_API
249 //---------------------------------------------------------------------------
250 //---------------------------------------------------------------------------
251 // These Event classes can be derived from in Python and passed through the
252 // event system without loosing anything. They do this by keeping a reference
253 // to themselves and some special case handling in wxPyCallback::EventThunker.
257 class wxPyEvtSelfRef
{
262 void SetSelf(PyObject
* self
, bool clone
=False
);
263 PyObject
* GetSelf() const;
264 bool GetCloned() const { return m_cloned
; }
272 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
273 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
275 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
276 wxPyEvent(const wxPyEvent
& evt
);
279 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
283 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
284 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
286 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
287 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
290 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
295 //----------------------------------------------------------------------
296 // Forward decalre a few things used in the exported API
297 class wxPyClientData
;
299 class wxPyOORClientData
;
300 class wxPyCBInputStream
;
302 void wxPyClientData_dtor(wxPyClientData
* self
);
303 void wxPyUserData_dtor(wxPyUserData
* self
);
304 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
305 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
308 //---------------------------------------------------------------------------
309 // Export a C API in a struct. Other modules will be able to load this from
310 // the wx.core module and will then have safe access to these functions, even if
311 // in another shared library.
313 class wxPyCallbackHelper
;
314 struct swig_type_info
;
315 struct swig_const_info
;
318 // Make SunCC happy and make typedef's for these that are extern "C"
319 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
320 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
321 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
322 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
323 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
324 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
325 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
326 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
327 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
328 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
329 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
330 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
331 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
332 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
333 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
334 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
335 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
340 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
341 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
342 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
343 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
344 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
345 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
346 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
347 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
348 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
349 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
350 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
351 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
352 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
353 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
354 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
355 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
356 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
359 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
360 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
361 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
362 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
364 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
365 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
366 void (*p_wxPyBeginBlockThreads
)();
367 void (*p_wxPyEndBlockThreads
)();
369 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
371 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
372 wxString (*p_Py2wxString
)(PyObject
* source
);
373 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
375 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
376 int* (*p_int_LIST_helper
)(PyObject
* source
);
377 long* (*p_long_LIST_helper
)(PyObject
* source
);
378 char** (*p_string_LIST_helper
)(PyObject
* source
);
379 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
380 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
381 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
382 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
384 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
385 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
386 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
387 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
388 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
389 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
392 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
393 bool (*p_wxColour_typecheck
)(PyObject
* source
);
395 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
396 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
397 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
398 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
399 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
401 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
402 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
403 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
404 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
405 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
406 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
407 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
409 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
410 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
411 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
413 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
415 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
416 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
420 #ifdef wxPyUSE_EXPORTED_API
421 // Notice that this is static, not extern. This is by design, each module
422 // needs one, but doesn't have to use it.
423 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
424 #endif // wxPyUSE_EXPORTED_API
426 //---------------------------------------------------------------------------
428 // A wxObject that holds a reference to a Python object
429 class wxPyUserData
: public wxObject
{
431 wxPyUserData(PyObject
* obj
) {
437 #ifdef wxPyUSE_EXPORTED_API
438 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
440 wxPyUserData_dtor(this);
447 // A wxClientData that holds a refernece to a Python object
448 class wxPyClientData
: public wxClientData
{
450 wxPyClientData(PyObject
* obj
) {
456 #ifdef wxPyUSE_EXPORTED_API
457 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
459 wxPyClientData_dtor(this);
466 // Just like wxPyClientData, except when this object is destroyed it does some
467 // OOR magic on the Python Object.
468 class wxPyOORClientData
: public wxPyClientData
{
470 wxPyOORClientData(PyObject
* obj
)
471 : wxPyClientData(obj
) {}
473 ~wxPyOORClientData() {
474 #ifdef wxPyUSE_EXPORTED_API
475 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
477 wxPyOORClientData_dtor(this);
483 //---------------------------------------------------------------------------
484 // This class holds an instance of a Python Shadow Class object and assists
485 // with looking up and invoking Python callback methods from C++ virtual
486 // method redirections. For all classes which have virtuals which should be
487 // overridable in wxPython, a new subclass is created that contains a
488 // wxPyCallbackHelper.
491 class wxPyCallbackHelper
{
493 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
495 wxPyCallbackHelper() {
502 ~wxPyCallbackHelper() {
503 #ifdef wxPyUSE_EXPORTED_API
504 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
506 wxPyCBH_delete(this);
510 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
511 bool findCallback(const char* name
) const;
512 int callCallback(PyObject
* argTuple
) const;
513 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
518 PyObject
* m_lastFound
;
521 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
525 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
526 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
527 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
528 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
529 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
534 //---------------------------------------------------------------------------
536 // This is used in C++ classes that need to be able to make callback to
537 // "overloaded" python methods
540 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
541 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
543 private: wxPyCallbackHelper m_myInst
546 //---------------------------------------------------------------------------
547 // The wxPythonApp class
550 wxPYAPP_ASSERT_SUPPRESS
= 1,
551 wxPYAPP_ASSERT_EXCEPTION
= 2,
552 wxPYAPP_ASSERT_DIALOG
= 4,
553 wxPYAPP_ASSERT_LOG
= 8
556 class wxPyApp
: public wxApp
558 DECLARE_ABSTRACT_CLASS(wxPyApp
);
566 int GetAssertMode() { return m_assertMode
; }
567 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
569 virtual bool OnInitGui();
570 virtual int OnExit();
572 virtual void OnAssert(const wxChar
*file
,
577 // virtual int FilterEvent(wxEvent& event); // This one too????
580 static bool GetMacSupportPCMenuShortcuts();
581 static long GetMacAboutMenuItemId();
582 static long GetMacPreferencesMenuItemId();
583 static long GetMacExitMenuItemId();
584 static wxString
GetMacHelpMenuTitleName();
586 static void SetMacSupportPCMenuShortcuts(bool val
);
587 static void SetMacAboutMenuItemId(long val
);
588 static void SetMacPreferencesMenuItemId(long val
);
589 static void SetMacExitMenuItemId(long val
);
590 static void SetMacHelpMenuTitleName(const wxString
& val
);
593 void _BootstrapApp();
595 // implementation only
596 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
600 bool m_startupComplete
;
603 extern wxPyApp
*wxPythonApp
;
606 //----------------------------------------------------------------------
607 // These macros are used to implement the virtual methods that should
608 // redirect to a Python method if one exists. The names designate the
609 // return type, if any, as well as any parameter types.
610 //---------------------------------------------------------------------------
612 #define DEC_PYCALLBACK__(CBNAME) \
617 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
618 void CLASS::CBNAME() { \
620 wxPyBeginBlockThreads(); \
621 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
622 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
623 wxPyEndBlockThreads(); \
627 void CLASS::base_##CBNAME() { \
631 //---------------------------------------------------------------------------
633 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
634 bool CBNAME(int a, int b); \
635 bool base_##CBNAME(int a, int b)
638 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
639 bool CLASS::CBNAME(int a, int b) { \
640 bool rval=False, found; \
641 wxPyBeginBlockThreads(); \
642 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
643 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
644 wxPyEndBlockThreads(); \
646 rval = PCLASS::CBNAME(a,b); \
649 bool CLASS::base_##CBNAME(int a, int b) { \
650 return PCLASS::CBNAME(a,b); \
653 //---------------------------------------------------------------------------
655 #define DEC_PYCALLBACK_VOID_(CBNAME) \
660 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
661 void CLASS::CBNAME() { \
663 wxPyBeginBlockThreads(); \
664 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
665 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
666 wxPyEndBlockThreads(); \
670 void CLASS::base_##CBNAME() { \
674 //---------------------------------------------------------------------------
676 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
677 void CBNAME(int a, int b); \
678 void base_##CBNAME(int a, int b)
681 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
682 void CLASS::CBNAME(int a, int b) { \
684 wxPyBeginBlockThreads(); \
685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
686 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
687 wxPyEndBlockThreads(); \
689 PCLASS::CBNAME(a,b); \
691 void CLASS::base_##CBNAME(int a, int b) { \
692 PCLASS::CBNAME(a,b); \
695 //---------------------------------------------------------------------------
697 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
698 void CBNAME(int a); \
699 void base_##CBNAME(int a)
702 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
703 void CLASS::CBNAME(int a) { \
705 wxPyBeginBlockThreads(); \
706 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
707 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
708 wxPyEndBlockThreads(); \
712 void CLASS::base_##CBNAME(int a) { \
716 //---------------------------------------------------------------------------
718 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
719 void CBNAME(int a, int b, int c, int d); \
720 void base_##CBNAME(int a, int b, int c, int d)
723 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
724 void CLASS::CBNAME(int a, int b, int c, int d) { \
726 wxPyBeginBlockThreads(); \
727 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
728 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
729 wxPyEndBlockThreads(); \
731 PCLASS::CBNAME(a,b,c,d); \
733 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
734 PCLASS::CBNAME(a,b,c,d); \
737 //---------------------------------------------------------------------------
738 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
739 void CBNAME(int a, int b, int c, int d, int e); \
740 void base_##CBNAME(int a, int b, int c, int d, int e)
743 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
744 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
746 wxPyBeginBlockThreads(); \
747 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
748 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
749 wxPyEndBlockThreads(); \
751 PCLASS::CBNAME(a,b,c,d,e); \
753 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
754 PCLASS::CBNAME(a,b,c,d,e); \
757 //---------------------------------------------------------------------------
759 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
760 void CBNAME(int* a, int* b) const; \
761 void base_##CBNAME(int* a, int* b) const
764 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
765 void CLASS::CBNAME(int* a, int* b) const { \
766 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
768 wxPyBeginBlockThreads(); \
769 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
771 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
773 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
774 PyObject* o1 = PySequence_GetItem(ro, 0); \
775 PyObject* o2 = PySequence_GetItem(ro, 1); \
776 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
777 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
780 PyErr_SetString(PyExc_TypeError, errmsg); \
785 PyErr_SetString(PyExc_TypeError, errmsg); \
790 wxPyEndBlockThreads(); \
792 PCLASS::CBNAME(a,b); \
794 void CLASS::base_##CBNAME(int* a, int* b) const { \
795 PCLASS::CBNAME(a,b); \
799 //---------------------------------------------------------------------------
801 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
802 wxSize CBNAME() const; \
803 wxSize base_##CBNAME() const
806 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
807 wxSize CLASS::CBNAME() const { \
808 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
809 bool found; wxSize rval(0,0); \
810 wxPyBeginBlockThreads(); \
811 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
813 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
815 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
816 PyObject* o1 = PySequence_GetItem(ro, 0); \
817 PyObject* o2 = PySequence_GetItem(ro, 1); \
818 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
819 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
822 PyErr_SetString(PyExc_TypeError, errmsg); \
827 PyErr_SetString(PyExc_TypeError, errmsg); \
832 wxPyEndBlockThreads(); \
834 return PCLASS::CBNAME(); \
838 wxSize CLASS::base_##CBNAME() const { \
839 return PCLASS::CBNAME(); \
843 //---------------------------------------------------------------------------
845 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
846 bool CBNAME(bool a); \
847 bool base_##CBNAME(bool a)
850 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
851 bool CLASS::CBNAME(bool a) { \
852 bool rval=False, found; \
853 wxPyBeginBlockThreads(); \
854 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
855 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
856 wxPyEndBlockThreads(); \
858 rval = PCLASS::CBNAME(a); \
861 bool CLASS::base_##CBNAME(bool a) { \
862 return PCLASS::CBNAME(a); \
865 //---------------------------------------------------------------------------
867 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
868 bool CBNAME(int a); \
869 bool base_##CBNAME(int a)
872 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
873 bool CLASS::CBNAME(int a) { \
874 bool rval=False, found; \
875 wxPyBeginBlockThreads(); \
876 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
877 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
878 wxPyEndBlockThreads(); \
880 rval = PCLASS::CBNAME(a); \
883 bool CLASS::base_##CBNAME(int a) { \
884 return PCLASS::CBNAME(a); \
887 //---------------------------------------------------------------------------
889 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
893 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
894 bool CLASS::CBNAME(int a) { \
896 wxPyBeginBlockThreads(); \
897 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
898 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
900 wxPyEndBlockThreads(); \
905 //---------------------------------------------------------------------------
907 #define DEC_PYCALLBACK__DC(CBNAME) \
908 void CBNAME(wxDC& a); \
909 void base_##CBNAME(wxDC& a)
912 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
913 void CLASS::CBNAME(wxDC& a) { \
915 wxPyBeginBlockThreads(); \
916 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
917 PyObject* obj = wxPyMake_wxObject(&a); \
918 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
921 wxPyEndBlockThreads(); \
925 void CLASS::base_##CBNAME(wxDC& a) { \
931 //---------------------------------------------------------------------------
933 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
934 void CBNAME(wxDC& a, bool b); \
935 void base_##CBNAME(wxDC& a, bool b)
938 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
939 void CLASS::CBNAME(wxDC& a, bool b) { \
941 wxPyBeginBlockThreads(); \
942 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
943 PyObject* obj = wxPyMake_wxObject(&a); \
944 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
947 wxPyEndBlockThreads(); \
949 PCLASS::CBNAME(a, b); \
951 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
952 PCLASS::CBNAME(a, b); \
955 //---------------------------------------------------------------------------
957 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
958 void CBNAME(wxDC& a, bool b); \
959 void base_##CBNAME(wxDC& a, bool b)
962 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
963 void CLASS::CBNAME(wxDC& a, bool b) { \
965 wxPyBeginBlockThreads(); \
966 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
967 PyObject* obj = wxPyMake_wxObject(&a); \
968 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
971 wxPyEndBlockThreads(); \
973 PCLASS::CBNAME(a, b); \
975 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
976 PCLASS::CBNAME(a, b); \
979 //---------------------------------------------------------------------------
981 #define DEC_PYCALLBACK__2DBL(CBNAME) \
982 void CBNAME(double a, double b); \
983 void base_##CBNAME(double a, double b)
986 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
987 void CLASS::CBNAME(double a, double b) { \
989 wxPyBeginBlockThreads(); \
990 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
991 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
992 wxPyEndBlockThreads(); \
994 PCLASS::CBNAME(a, b); \
996 void CLASS::base_##CBNAME(double a, double b) { \
997 PCLASS::CBNAME(a, b); \
1000 //---------------------------------------------------------------------------
1002 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1003 void CBNAME(double a, double b, int c, int d); \
1004 void base_##CBNAME(double a, double b, int c, int d)
1007 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1008 void CLASS::CBNAME(double a, double b, int c, int d) { \
1010 wxPyBeginBlockThreads(); \
1011 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1012 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1014 wxPyEndBlockThreads(); \
1016 PCLASS::CBNAME(a, b, c, d); \
1018 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1019 PCLASS::CBNAME(a, b, c, d); \
1022 //---------------------------------------------------------------------------
1024 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1025 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1026 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1029 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1030 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1032 wxPyBeginBlockThreads(); \
1033 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1034 PyObject* obj = wxPyMake_wxObject(&a); \
1035 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1038 wxPyEndBlockThreads(); \
1040 PCLASS::CBNAME(a, b, c, d, e, f); \
1042 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1043 PCLASS::CBNAME(a, b, c, d, e, f); \
1046 //---------------------------------------------------------------------------
1048 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1049 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1050 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1053 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1054 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1056 wxPyBeginBlockThreads(); \
1058 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1059 PyObject* obj = wxPyMake_wxObject(&a); \
1060 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1063 wxPyEndBlockThreads(); \
1065 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1068 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1069 return PCLASS::CBNAME(a, b, c, d, e, f); \
1072 //---------------------------------------------------------------------------
1074 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1075 void CBNAME(bool a, double b, double c, int d, int e); \
1076 void base_##CBNAME(bool a, double b, double c, int d, int e)
1079 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1080 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1082 wxPyBeginBlockThreads(); \
1083 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1084 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1086 wxPyEndBlockThreads(); \
1088 PCLASS::CBNAME(a, b, c, d, e); \
1090 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1091 PCLASS::CBNAME(a, b, c, d, e); \
1094 //---------------------------------------------------------------------------
1096 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1097 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1098 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1101 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1102 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1104 wxPyBeginBlockThreads(); \
1105 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1106 PyObject* obj = wxPyMake_wxObject(&a); \
1107 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1110 wxPyEndBlockThreads(); \
1112 PCLASS::CBNAME(a, b, c, d, e); \
1114 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1115 PCLASS::CBNAME(a, b, c, d, e); \
1118 //---------------------------------------------------------------------------
1120 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1121 void CBNAME(wxDC& a, bool b); \
1122 void base_##CBNAME(wxDC& a, bool b)
1125 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1126 void CLASS::CBNAME(wxDC& a, bool b) { \
1128 wxPyBeginBlockThreads(); \
1129 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1130 PyObject* obj = wxPyMake_wxObject(&a); \
1131 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1134 wxPyEndBlockThreads(); \
1136 PCLASS::CBNAME(a, b); \
1138 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1139 PCLASS::CBNAME(a, b); \
1142 //---------------------------------------------------------------------------
1144 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1145 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1146 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1149 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1150 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1153 wxPyBeginBlockThreads(); \
1154 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1155 PyObject* obj = wxPyMake_wxObject(a); \
1156 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1159 wxPyEndBlockThreads(); \
1161 PCLASS::CBNAME(a, b, c, d, e, f); \
1163 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1165 PCLASS::CBNAME(a, b, c, d, e, f); \
1168 //---------------------------------------------------------------------------
1170 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1171 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1172 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1175 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1176 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1178 wxPyBeginBlockThreads(); \
1179 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1180 PyObject* obj = wxPyMake_wxObject(a); \
1181 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1184 wxPyEndBlockThreads(); \
1186 PCLASS::CBNAME(a, b, c, d, e); \
1188 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1190 PCLASS::CBNAME(a, b, c, d, e); \
1193 //---------------------------------------------------------------------------
1195 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1196 void CBNAME(double a, double b, int c); \
1197 void base_##CBNAME(double a, double b, int c)
1200 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1201 void CLASS::CBNAME(double a, double b, int c) { \
1203 wxPyBeginBlockThreads(); \
1204 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1205 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1206 wxPyEndBlockThreads(); \
1208 PCLASS::CBNAME(a, b, c); \
1210 void CLASS::base_##CBNAME(double a, double b, int c) { \
1211 PCLASS::CBNAME(a, b, c); \
1214 //---------------------------------------------------------------------------
1216 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1217 void CBNAME(bool a, double b, double c, int d); \
1218 void base_##CBNAME(bool a, double b, double c, int d)
1221 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1222 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1224 wxPyBeginBlockThreads(); \
1225 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1226 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1227 wxPyEndBlockThreads(); \
1229 PCLASS::CBNAME(a, b, c, d); \
1231 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1232 PCLASS::CBNAME(a, b, c, d); \
1235 //---------------------------------------------------------------------------
1236 //---------------------------------------------------------------------------
1238 #define DEC_PYCALLBACK__STRING(CBNAME) \
1239 void CBNAME(const wxString& a); \
1240 void base_##CBNAME(const wxString& a)
1242 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1243 void CLASS::CBNAME(const wxString& a) { \
1245 wxPyBeginBlockThreads(); \
1246 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1247 PyObject* s = wx2PyString(a); \
1248 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1251 wxPyEndBlockThreads(); \
1253 PCLASS::CBNAME(a); \
1255 void CLASS::base_##CBNAME(const wxString& a) { \
1256 PCLASS::CBNAME(a); \
1259 //---------------------------------------------------------------------------
1261 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1262 bool CBNAME(const wxString& a); \
1263 bool base_##CBNAME(const wxString& a)
1265 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1266 bool CLASS::CBNAME(const wxString& a) { \
1269 wxPyBeginBlockThreads(); \
1270 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1271 PyObject* s = wx2PyString(a); \
1272 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1275 wxPyEndBlockThreads(); \
1277 rval = PCLASS::CBNAME(a); \
1280 bool CLASS::base_##CBNAME(const wxString& a) { \
1281 return PCLASS::CBNAME(a); \
1284 //---------------------------------------------------------------------------
1286 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1287 bool CBNAME(const wxString& a)
1289 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1290 bool CLASS::CBNAME(const wxString& a) { \
1292 wxPyBeginBlockThreads(); \
1293 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1294 PyObject* s = wx2PyString(a); \
1295 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1298 wxPyEndBlockThreads(); \
1302 //---------------------------------------------------------------------------
1304 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1305 wxString CBNAME(const wxString& a)
1307 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1308 wxString CLASS::CBNAME(const wxString& a) { \
1310 wxPyBeginBlockThreads(); \
1311 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1313 PyObject* s = wx2PyString(a); \
1314 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1317 rval = Py2wxString(ro); \
1321 wxPyEndBlockThreads(); \
1325 //---------------------------------------------------------------------------
1327 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1328 wxString CBNAME(const wxString& a); \
1329 wxString base_##CBNAME(const wxString& a)
1331 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1332 wxString CLASS::CBNAME(const wxString& a) { \
1335 wxPyBeginBlockThreads(); \
1336 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1338 PyObject* s = wx2PyString(a); \
1339 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1342 rval = Py2wxString(ro); \
1347 rval = PCLASS::CBNAME(a); \
1348 wxPyEndBlockThreads(); \
1352 //---------------------------------------------------------------------------
1354 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1355 wxString CBNAME(const wxString& a,int b)
1357 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1358 wxString CLASS::CBNAME(const wxString& a,int b) { \
1360 wxPyBeginBlockThreads(); \
1361 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1363 PyObject* s = wx2PyString(a); \
1364 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1367 rval = Py2wxString(ro); \
1371 wxPyEndBlockThreads(); \
1375 //---------------------------------------------------------------------------
1377 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1378 bool CBNAME(const wxString& a, const wxString& b); \
1379 bool base_##CBNAME(const wxString& a, const wxString& b)
1381 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1382 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1385 wxPyBeginBlockThreads(); \
1386 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1387 PyObject* s1 = wx2PyString(a); \
1388 PyObject* s2 = wx2PyString(b); \
1389 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1393 wxPyEndBlockThreads(); \
1395 rval = PCLASS::CBNAME(a, b); \
1398 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1399 return PCLASS::CBNAME(a, b); \
1402 //---------------------------------------------------------------------------
1404 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1405 wxString CBNAME(); \
1406 wxString base_##CBNAME()
1408 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1409 wxString CLASS::CBNAME() { \
1412 wxPyBeginBlockThreads(); \
1413 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1415 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1417 rval = Py2wxString(ro); \
1421 wxPyEndBlockThreads(); \
1423 rval = PCLASS::CBNAME(); \
1426 wxString CLASS::base_##CBNAME() { \
1427 return PCLASS::CBNAME(); \
1430 //---------------------------------------------------------------------------
1432 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1433 wxString CBNAME() const; \
1434 wxString base_##CBNAME() const;
1436 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1437 wxString CLASS::CBNAME() const { \
1440 wxPyBeginBlockThreads(); \
1441 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1443 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1445 rval = Py2wxString(ro); \
1449 wxPyEndBlockThreads(); \
1451 rval = PCLASS::CBNAME(); \
1454 wxString CLASS::base_##CBNAME() const { \
1455 return PCLASS::CBNAME(); \
1458 //---------------------------------------------------------------------------
1460 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1463 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1464 wxString CLASS::CBNAME() { \
1466 wxPyBeginBlockThreads(); \
1467 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1469 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1471 rval = Py2wxString(ro); \
1475 wxPyEndBlockThreads(); \
1479 //---------------------------------------------------------------------------
1481 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1482 wxString CBNAME() const;
1484 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1485 wxString CLASS::CBNAME() const { \
1487 wxPyBeginBlockThreads(); \
1488 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1490 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1492 rval = Py2wxString(ro); \
1496 wxPyEndBlockThreads(); \
1500 //---------------------------------------------------------------------------
1502 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1503 bool CBNAME(const wxHtmlTag& a)
1506 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1507 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1509 wxPyBeginBlockThreads(); \
1510 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1511 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1512 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1515 wxPyEndBlockThreads(); \
1519 //---------------------------------------------------------------------------
1521 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1522 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1523 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1525 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1526 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1528 wxPyBeginBlockThreads(); \
1529 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1530 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1531 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1534 wxPyEndBlockThreads(); \
1536 PCLASS::CBNAME(cell, x, y); \
1538 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1539 PCLASS::CBNAME(cell, x, y); \
1543 //---------------------------------------------------------------------------
1545 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1546 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1547 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1549 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1550 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1552 wxPyBeginBlockThreads(); \
1553 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1554 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1555 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1556 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1560 wxPyEndBlockThreads(); \
1562 PCLASS::CBNAME(cell, x, y, e); \
1564 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1565 PCLASS::CBNAME(cell, x, y, e); \
1570 //---------------------------------------------------------------------------
1572 #define DEC_PYCALLBACK___pure(CBNAME) \
1576 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1577 void CLASS::CBNAME() { \
1578 wxPyBeginBlockThreads(); \
1579 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1580 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1581 wxPyEndBlockThreads(); \
1584 //---------------------------------------------------------------------------
1586 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1590 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1591 wxSize CLASS::CBNAME() { \
1592 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1594 wxPyBeginBlockThreads(); \
1595 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1598 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1600 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1602 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1603 PyObject* o1 = PySequence_GetItem(ro, 0); \
1604 PyObject* o2 = PySequence_GetItem(ro, 1); \
1605 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1606 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1608 PyErr_SetString(PyExc_TypeError, errmsg); \
1613 PyErr_SetString(PyExc_TypeError, errmsg); \
1618 wxPyEndBlockThreads(); \
1622 //---------------------------------------------------------------------------
1624 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1625 bool CBNAME(wxWindow* a); \
1626 bool base_##CBNAME(wxWindow* a)
1629 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1630 bool CLASS::CBNAME(wxWindow* a) { \
1633 wxPyBeginBlockThreads(); \
1634 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1635 PyObject* obj = wxPyMake_wxObject(a); \
1636 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1639 wxPyEndBlockThreads(); \
1641 rval = PCLASS::CBNAME(a); \
1644 bool CLASS::base_##CBNAME(wxWindow* a) { \
1645 return PCLASS::CBNAME(a); \
1648 //---------------------------------------------------------------------------
1650 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1651 bool CBNAME(wxWindow* a, wxDC& b); \
1652 bool base_##CBNAME(wxWindow* a, wxDC& b)
1655 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1656 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1659 wxPyBeginBlockThreads(); \
1660 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1661 PyObject* win = wxPyMake_wxObject(a); \
1662 PyObject* dc = wxPyMake_wxObject(&b); \
1663 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1667 wxPyEndBlockThreads(); \
1669 rval = PCLASS::CBNAME(a, b); \
1672 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1673 return PCLASS::CBNAME(a, b); \
1676 //---------------------------------------------------------------------------
1678 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1679 void CBNAME(wxWindowBase* a); \
1680 void base_##CBNAME(wxWindowBase* a)
1683 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1684 void CLASS::CBNAME(wxWindowBase* a) { \
1686 wxPyBeginBlockThreads(); \
1687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1688 PyObject* obj = wxPyMake_wxObject(a); \
1689 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1692 wxPyEndBlockThreads(); \
1694 PCLASS::CBNAME(a); \
1696 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1697 PCLASS::CBNAME(a); \
1700 //---------------------------------------------------------------------------
1702 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1704 bool base_##CBNAME()
1707 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1708 bool CLASS::CBNAME() { \
1711 wxPyBeginBlockThreads(); \
1712 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1713 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1714 wxPyEndBlockThreads(); \
1716 rval = PCLASS::CBNAME(); \
1719 bool CLASS::base_##CBNAME() { \
1720 return PCLASS::CBNAME(); \
1723 //---------------------------------------------------------------------------
1725 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1726 bool CBNAME() const; \
1727 bool base_##CBNAME() const
1730 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1731 bool CLASS::CBNAME() const { \
1734 wxPyBeginBlockThreads(); \
1735 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1736 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1737 wxPyEndBlockThreads(); \
1739 rval = PCLASS::CBNAME(); \
1742 bool CLASS::base_##CBNAME() const { \
1743 return PCLASS::CBNAME(); \
1746 //---------------------------------------------------------------------------
1748 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1749 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1750 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1753 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1754 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1757 wxPyBeginBlockThreads(); \
1758 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1759 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1760 wxPyEndBlockThreads(); \
1762 rval = PCLASS::CBNAME(a, b, c); \
1763 return (wxDragResult)rval; \
1765 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1766 return PCLASS::CBNAME(a, b, c); \
1769 //---------------------------------------------------------------------------
1771 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1772 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1774 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1775 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1776 wxPyBeginBlockThreads(); \
1778 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1780 PyObject* obj = wxPyMake_wxObject(&a); \
1781 PyObject* s = wx2PyString(b); \
1782 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1785 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1791 wxPyEndBlockThreads(); \
1795 //---------------------------------------------------------------------------
1797 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1798 bool CBNAME(wxDragResult a); \
1799 bool base_##CBNAME(wxDragResult a)
1802 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1803 bool CLASS::CBNAME(wxDragResult a) { \
1806 wxPyBeginBlockThreads(); \
1807 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1808 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1809 wxPyEndBlockThreads(); \
1811 rval = PCLASS::CBNAME(a); \
1814 bool CLASS::base_##CBNAME(wxDragResult a) { \
1815 return PCLASS::CBNAME(a); \
1818 //---------------------------------------------------------------------------
1820 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1821 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1824 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1825 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1826 wxPyBeginBlockThreads(); \
1828 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1829 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1830 wxPyEndBlockThreads(); \
1831 return (wxDragResult)rval; \
1834 //---------------------------------------------------------------------------
1836 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1837 bool CBNAME(int a, int b, const wxString& c)
1839 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1840 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1842 wxPyBeginBlockThreads(); \
1843 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1844 PyObject* s = wx2PyString(c); \
1845 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1848 wxPyEndBlockThreads(); \
1852 //---------------------------------------------------------------------------
1854 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1856 size_t base_##CBNAME()
1859 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1860 size_t CLASS::CBNAME() { \
1863 wxPyBeginBlockThreads(); \
1864 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1865 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1866 wxPyEndBlockThreads(); \
1868 rval = PCLASS::CBNAME(); \
1871 size_t CLASS::base_##CBNAME() { \
1872 return PCLASS::CBNAME(); \
1875 //---------------------------------------------------------------------------
1877 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1878 size_t CBNAME() const; \
1879 size_t base_##CBNAME() const
1882 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1883 size_t CLASS::CBNAME() const { \
1886 wxPyBeginBlockThreads(); \
1887 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1888 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1889 wxPyEndBlockThreads(); \
1891 rval = PCLASS::CBNAME(); \
1894 size_t CLASS::base_##CBNAME() const { \
1895 return PCLASS::CBNAME(); \
1898 //---------------------------------------------------------------------------
1900 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1901 wxDataFormat CBNAME(size_t a); \
1902 wxDataFormat base_##CBNAME(size_t a)
1905 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1906 wxDataFormat CLASS::CBNAME(size_t a) { \
1907 wxDataFormat rval=0; \
1909 wxPyBeginBlockThreads(); \
1910 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1912 wxDataFormat* ptr; \
1913 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1915 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1920 wxPyEndBlockThreads(); \
1922 rval = PCLASS::CBNAME(a); \
1925 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1926 return PCLASS::CBNAME(a); \
1929 //---------------------------------------------------------------------------
1931 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1932 void CBNAME(const Type& a); \
1933 void base_##CBNAME(const Type& a)
1936 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1937 void CLASS::CBNAME(const Type& a) { \
1939 wxPyBeginBlockThreads(); \
1940 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1941 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1942 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1945 wxPyEndBlockThreads(); \
1947 PCLASS::CBNAME(a); \
1949 void CLASS::base_##CBNAME(const Type& a) { \
1950 PCLASS::CBNAME(a); \
1954 //---------------------------------------------------------------------------
1956 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1957 void CBNAME(Type& a); \
1958 void base_##CBNAME(Type& a)
1961 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1962 void CLASS::CBNAME(Type& a) { \
1964 wxPyBeginBlockThreads(); \
1965 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1966 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1967 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1970 wxPyEndBlockThreads(); \
1972 PCLASS::CBNAME(a); \
1974 void CLASS::base_##CBNAME(Type& a) { \
1975 PCLASS::CBNAME(a); \
1978 //---------------------------------------------------------------------------
1980 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1981 bool CBNAME(Type& a); \
1982 bool base_##CBNAME(Type& a)
1985 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1986 bool CLASS::CBNAME(Type& a) { \
1989 wxPyBeginBlockThreads(); \
1990 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1991 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1992 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1995 wxPyEndBlockThreads(); \
1997 rv = PCLASS::CBNAME(a); \
2000 bool CLASS::base_##CBNAME(Type& a) { \
2001 return PCLASS::CBNAME(a); \
2004 //---------------------------------------------------------------------------
2006 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2007 bool CBNAME(Type& a)
2010 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2011 bool CLASS::CBNAME(Type& a) { \
2013 wxPyBeginBlockThreads(); \
2014 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2015 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2016 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2019 wxPyEndBlockThreads(); \
2023 //---------------------------------------------------------------------------
2025 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2026 wxString CBNAME(long a, long b) const; \
2027 wxString base_##CBNAME(long a, long b) const
2029 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2030 wxString CLASS::CBNAME(long a, long b) const { \
2033 wxPyBeginBlockThreads(); \
2034 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2036 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2038 rval = Py2wxString(ro); \
2042 wxPyEndBlockThreads(); \
2044 rval = PCLASS::CBNAME(a,b); \
2047 wxString CLASS::base_##CBNAME(long a, long b) const { \
2048 return PCLASS::CBNAME(a,b); \
2051 //---------------------------------------------------------------------------
2053 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2054 int CBNAME(long a) const; \
2055 int base_##CBNAME(long a) const
2058 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2059 int CLASS::CBNAME(long a) const { \
2062 wxPyBeginBlockThreads(); \
2063 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2065 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2067 rval = PyInt_AsLong(ro); \
2071 wxPyEndBlockThreads(); \
2073 rval = PCLASS::CBNAME(a); \
2076 int CLASS::base_##CBNAME(long a) const { \
2077 return PCLASS::CBNAME(a); \
2081 //---------------------------------------------------------------------------
2083 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2084 wxListItemAttr* CBNAME(long a) const; \
2085 wxListItemAttr* base_##CBNAME(long a) const
2088 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2089 wxListItemAttr *CLASS::CBNAME(long a) const { \
2090 wxListItemAttr *rval = NULL; \
2092 wxPyBeginBlockThreads(); \
2093 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2095 wxListItemAttr* ptr; \
2096 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2098 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2103 wxPyEndBlockThreads(); \
2105 rval = PCLASS::CBNAME(a); \
2108 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2109 return PCLASS::CBNAME(a); \
2112 //---------------------------------------------------------------------------
2114 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2115 bool CBNAME(wxMouseEvent& e); \
2116 bool base_##CBNAME(wxMouseEvent& e)
2118 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2119 bool CLASS::CBNAME(wxMouseEvent& e) { \
2122 wxPyBeginBlockThreads(); \
2123 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2125 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2126 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2128 rval = PyInt_AsLong(ro); \
2133 wxPyEndBlockThreads(); \
2135 return PCLASS::CBNAME(e); \
2138 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2139 return PCLASS::CBNAME(e); \
2143 //---------------------------------------------------------------------------
2145 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2146 wxWizardPage* CBNAME() const
2148 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2149 wxWizardPage* CLASS::CBNAME() const { \
2150 wxWizardPage* rv = NULL; \
2151 wxPyBeginBlockThreads(); \
2152 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2154 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2156 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2160 wxPyEndBlockThreads(); \
2164 //---------------------------------------------------------------------------
2166 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2167 wxBitmap CBNAME() const
2169 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2170 wxBitmap CLASS::CBNAME() const { \
2172 wxPyBeginBlockThreads(); \
2173 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2176 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2178 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2183 wxPyEndBlockThreads(); \
2187 //---------------------------------------------------------------------------
2189 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2192 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2193 wxObject* CLASS::CBNAME() { \
2194 wxObject* rv = NULL; \
2195 wxPyBeginBlockThreads(); \
2196 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2198 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2200 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2204 wxPyEndBlockThreads(); \
2208 //---------------------------------------------------------------------------
2210 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2211 wxObject* CBNAME(const wxString& a)
2213 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2214 wxObject* CLASS::CBNAME(const wxString& a) { \
2215 wxObject* rv = NULL; \
2216 wxPyBeginBlockThreads(); \
2217 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2218 PyObject* so = wx2PyString(a); \
2220 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2222 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2227 wxPyEndBlockThreads(); \
2231 //---------------------------------------------------------------------------
2233 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2234 bool CBNAME(wxXmlNode* a)
2237 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2238 bool CLASS::CBNAME(wxXmlNode* a) { \
2240 wxPyBeginBlockThreads(); \
2241 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2242 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2243 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2246 wxPyEndBlockThreads(); \
2250 //---------------------------------------------------------------------------
2252 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2253 wxCoord CBNAME(size_t a) const
2256 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2257 wxCoord CLASS::CBNAME(size_t a) const { \
2260 wxPyBeginBlockThreads(); \
2261 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2262 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2264 wxPyEndBlockThreads(); \
2268 //---------------------------------------------------------------------------
2270 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2271 void CBNAME(size_t a, size_t b) const; \
2272 void base_##CBNAME(size_t a, size_t b) const
2275 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2276 void CLASS::CBNAME(size_t a, size_t b) const { \
2278 wxPyBeginBlockThreads(); \
2279 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2280 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2281 wxPyEndBlockThreads(); \
2283 PCLASS::CBNAME(a,b); \
2285 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2286 PCLASS::CBNAME(a,b); \
2289 //---------------------------------------------------------------------------
2291 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2292 wxCoord CBNAME() const; \
2293 wxCoord base_##CBNAME() const
2296 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2297 wxCoord CLASS::CBNAME() const { \
2300 wxPyBeginBlockThreads(); \
2301 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2302 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2303 wxPyEndBlockThreads(); \
2305 rval = PCLASS::CBNAME(); \
2308 wxCoord CLASS::base_##CBNAME() const { \
2309 return PCLASS::CBNAME(); \
2312 //---------------------------------------------------------------------------
2314 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2315 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2318 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2319 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2321 wxPyBeginBlockThreads(); \
2322 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2323 PyObject* obj = wxPyMake_wxObject(&a); \
2324 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2325 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2328 wxPyEndBlockThreads(); \
2331 //---------------------------------------------------------------------------
2333 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2334 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2335 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2338 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2339 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2341 wxPyBeginBlockThreads(); \
2342 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2343 PyObject* obj = wxPyMake_wxObject(&a); \
2344 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2345 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2348 wxPyEndBlockThreads(); \
2350 PCLASS::CBNAME(a,b,c); \
2352 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2353 PCLASS::CBNAME(a,b,c); \
2356 //---------------------------------------------------------------------------
2359 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2360 wxString CBNAME(size_t a) const; \
2361 wxString base_##CBNAME(size_t a) const
2363 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2364 wxString CLASS::CBNAME(size_t a) const { \
2367 wxPyBeginBlockThreads(); \
2368 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2370 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2372 rval = Py2wxString(ro); \
2376 wxPyEndBlockThreads(); \
2378 rval = PCLASS::CBNAME(a); \
2381 wxString CLASS::base_##CBNAME(size_t a) const { \
2382 return PCLASS::CBNAME(a); \
2385 //---------------------------------------------------------------------------
2387 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2388 wxString CBNAME(size_t a) const
2390 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2391 wxString CLASS::CBNAME(size_t a) const { \
2394 wxPyBeginBlockThreads(); \
2395 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2397 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2399 rval = Py2wxString(ro); \
2403 wxPyEndBlockThreads(); \
2407 //---------------------------------------------------------------------------