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/dcmirror.h>
29 #include <wx/dirctrl.h>
30 #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
);
94 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
97 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
100 bool wxPyCheckSwigType(const wxChar
* className
);
101 PyObject
* wxPyConstructObject(void* ptr
,
102 const wxChar
* className
,
104 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
105 const wxChar
* className
);
106 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
109 PyObject
* wx2PyString(const wxString
& src
);
110 wxString
Py2wxString(PyObject
* source
);
112 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
113 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
114 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
116 PyObject
* wxPy_ConvertList(wxListBase
* list
);
117 long wxPyGetWinHandle(wxWindow
* win
);
119 void wxPy_ReinitStockObjects(int pass
);
121 bool wxPyInstance_Check(PyObject
* obj
);
122 bool wxPySwigInstance_Check(PyObject
* obj
);
125 #endif // wxPyUSE_EXPORTED_API
126 //---------------------------------------------------------------------------
128 // if we want to handle threads and Python threads are available...
129 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
130 #define WXP_WITH_THREAD
131 #else // no Python threads...
132 #undef WXP_WITH_THREAD
135 #ifndef wxPyUSE_EXPORTED_API
137 // For Python --> C++
138 PyThreadState
* wxPyBeginAllowThreads();
139 void wxPyEndAllowThreads(PyThreadState
* state
);
141 // For C++ --> Python
142 void wxPyBeginBlockThreads();
143 void wxPyEndBlockThreads();
145 #endif // wxPyUSE_EXPORTED_API
147 #define wxPyBLOCK_THREADS(stmt) { wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(); }
148 #define wxPyRaiseNotImplemented() wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
150 //---------------------------------------------------------------------------
151 // These are helpers used by the typemaps
153 #ifndef wxPyUSE_EXPORTED_API
155 wxString
* wxString_in_helper(PyObject
* source
);
157 byte
* byte_LIST_helper(PyObject
* source
);
158 int* int_LIST_helper(PyObject
* source
);
159 long* long_LIST_helper(PyObject
* source
);
160 char** string_LIST_helper(PyObject
* source
);
161 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
162 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
163 wxString
* wxString_LIST_helper(PyObject
* source
);
164 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
165 wxPen
** wxPen_LIST_helper(PyObject
* source
);
167 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
168 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
169 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
170 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
171 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
172 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
175 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
176 bool wxColour_typecheck(PyObject
* source
);
180 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
182 // If source is an object instance then it may already be the right type
183 if (wxPySwigInstance_Check(source
)) {
185 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
190 // otherwise a 2-tuple of integers is expected
191 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
192 PyObject
* o1
= PySequence_GetItem(source
, 0);
193 PyObject
* o2
= PySequence_GetItem(source
, 1);
194 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
199 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
207 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
208 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
214 // Other helpful stuff
215 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
216 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
218 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
219 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
221 #endif // wxPyUSE_EXPORTED_API
223 //---------------------------------------------------------------------------
225 #if PYTHON_API_VERSION < 1009
226 #define PySequence_Fast_GET_ITEM(o, i) \
227 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
230 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
231 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
232 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
234 //---------------------------------------------------------------------------
236 #ifndef wxPyUSE_EXPORTED_API
238 class wxPyCallback
: public wxObject
{
239 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
241 wxPyCallback(PyObject
* func
);
242 wxPyCallback(const wxPyCallback
& other
);
245 void EventThunker(wxEvent
& event
);
250 #endif // wxPyUSE_EXPORTED_API
251 //---------------------------------------------------------------------------
252 //---------------------------------------------------------------------------
253 // These Event classes can be derived from in Python and passed through the
254 // event system without loosing anything. They do this by keeping a reference
255 // to themselves and some special case handling in wxPyCallback::EventThunker.
259 class wxPyEvtSelfRef
{
264 void SetSelf(PyObject
* self
, bool clone
=False
);
265 PyObject
* GetSelf() const;
266 bool GetCloned() const { return m_cloned
; }
274 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
275 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
277 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
278 wxPyEvent(const wxPyEvent
& evt
);
281 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
285 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
286 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
288 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
289 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
292 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
297 //----------------------------------------------------------------------
298 // Forward decalre a few things used in the exported API
299 class wxPyClientData
;
301 class wxPyOORClientData
;
302 class wxPyCBInputStream
;
304 void wxPyClientData_dtor(wxPyClientData
* self
);
305 void wxPyUserData_dtor(wxPyUserData
* self
);
306 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
307 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
310 //---------------------------------------------------------------------------
311 // Export a C API in a struct. Other modules will be able to load this from
312 // the wx.core module and will then have safe access to these functions, even if
313 // in another shared library.
315 class wxPyCallbackHelper
;
316 struct swig_type_info
;
317 struct swig_const_info
;
319 typedef double (*py_objasdbl_conv
)(PyObject
*obj
);
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
;
361 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
362 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
363 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
364 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
366 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
367 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
368 void (*p_wxPyBeginBlockThreads
)();
369 void (*p_wxPyEndBlockThreads
)();
371 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
373 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
374 wxString (*p_Py2wxString
)(PyObject
* source
);
375 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
377 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
378 int* (*p_int_LIST_helper
)(PyObject
* source
);
379 long* (*p_long_LIST_helper
)(PyObject
* source
);
380 char** (*p_string_LIST_helper
)(PyObject
* source
);
381 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
382 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
383 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
384 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
386 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
387 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
388 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
389 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
390 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
391 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
394 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
395 bool (*p_wxColour_typecheck
)(PyObject
* source
);
397 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
398 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
399 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
400 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
401 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
403 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
404 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
405 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
406 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
407 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
408 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
409 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
411 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
412 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
413 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
415 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
417 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
418 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
422 #ifdef wxPyUSE_EXPORTED_API
423 // Notice that this is static, not extern. This is by design, each module
424 // needs one, but doesn't have to use it.
425 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
426 #endif // wxPyUSE_EXPORTED_API
428 //---------------------------------------------------------------------------
430 // A wxObject that holds a reference to a Python object
431 class wxPyUserData
: public wxObject
{
433 wxPyUserData(PyObject
* obj
) {
439 #ifdef wxPyUSE_EXPORTED_API
440 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
442 wxPyUserData_dtor(this);
449 // A wxClientData that holds a refernece to a Python object
450 class wxPyClientData
: public wxClientData
{
452 wxPyClientData(PyObject
* obj
) {
458 #ifdef wxPyUSE_EXPORTED_API
459 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
461 wxPyClientData_dtor(this);
468 // Just like wxPyClientData, except when this object is destroyed it does some
469 // OOR magic on the Python Object.
470 class wxPyOORClientData
: public wxPyClientData
{
472 wxPyOORClientData(PyObject
* obj
)
473 : wxPyClientData(obj
) {}
475 ~wxPyOORClientData() {
476 #ifdef wxPyUSE_EXPORTED_API
477 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
479 wxPyOORClientData_dtor(this);
485 //---------------------------------------------------------------------------
486 // This class holds an instance of a Python Shadow Class object and assists
487 // with looking up and invoking Python callback methods from C++ virtual
488 // method redirections. For all classes which have virtuals which should be
489 // overridable in wxPython, a new subclass is created that contains a
490 // wxPyCallbackHelper.
493 class wxPyCallbackHelper
{
495 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
497 wxPyCallbackHelper() {
504 ~wxPyCallbackHelper() {
505 #ifdef wxPyUSE_EXPORTED_API
506 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
508 wxPyCBH_delete(this);
512 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
513 bool findCallback(const char* name
) const;
514 int callCallback(PyObject
* argTuple
) const;
515 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
516 PyObject
* GetLastFound() const { return m_lastFound
; }
521 PyObject
* m_lastFound
;
524 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
528 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
529 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
530 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
531 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
532 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
537 //---------------------------------------------------------------------------
539 // This is used in C++ classes that need to be able to make callback to
540 // "overloaded" python methods
543 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
544 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
546 private: wxPyCallbackHelper m_myInst
549 //---------------------------------------------------------------------------
550 // The wxPythonApp class
553 wxPYAPP_ASSERT_SUPPRESS
= 1,
554 wxPYAPP_ASSERT_EXCEPTION
= 2,
555 wxPYAPP_ASSERT_DIALOG
= 4,
556 wxPYAPP_ASSERT_LOG
= 8
559 class wxPyApp
: public wxApp
561 DECLARE_ABSTRACT_CLASS(wxPyApp
);
569 int GetAssertMode() { return m_assertMode
; }
570 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
572 virtual bool OnInitGui();
573 virtual int OnExit();
575 virtual void OnAssert(const wxChar
*file
,
580 // virtual int FilterEvent(wxEvent& event); // This one too????
582 // For catching Apple Events
583 virtual void MacOpenFile(const wxString
&fileName
);
584 virtual void MacPrintFile(const wxString
&fileName
);
585 virtual void MacNewFile();
586 virtual void MacReopenApp();
588 static bool GetMacSupportPCMenuShortcuts();
589 static long GetMacAboutMenuItemId();
590 static long GetMacPreferencesMenuItemId();
591 static long GetMacExitMenuItemId();
592 static wxString
GetMacHelpMenuTitleName();
594 static void SetMacSupportPCMenuShortcuts(bool val
);
595 static void SetMacAboutMenuItemId(long val
);
596 static void SetMacPreferencesMenuItemId(long val
);
597 static void SetMacExitMenuItemId(long val
);
598 static void SetMacHelpMenuTitleName(const wxString
& val
);
601 void _BootstrapApp();
603 // implementation only
604 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
608 bool m_startupComplete
;
611 extern wxPyApp
*wxPythonApp
;
614 //----------------------------------------------------------------------
615 // These macros are used to implement the virtual methods that should
616 // redirect to a Python method if one exists. The names designate the
617 // return type, if any, as well as any parameter types.
618 //---------------------------------------------------------------------------
620 #define DEC_PYCALLBACK__(CBNAME) \
625 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
626 void CLASS::CBNAME() { \
628 wxPyBeginBlockThreads(); \
629 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
630 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
631 wxPyEndBlockThreads(); \
635 void CLASS::base_##CBNAME() { \
639 //---------------------------------------------------------------------------
641 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
642 bool CBNAME(int a, int b); \
643 bool base_##CBNAME(int a, int b)
646 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
647 bool CLASS::CBNAME(int a, int b) { \
648 bool rval=False, found; \
649 wxPyBeginBlockThreads(); \
650 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
651 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
652 wxPyEndBlockThreads(); \
654 rval = PCLASS::CBNAME(a,b); \
657 bool CLASS::base_##CBNAME(int a, int b) { \
658 return PCLASS::CBNAME(a,b); \
661 //---------------------------------------------------------------------------
663 #define DEC_PYCALLBACK_VOID_(CBNAME) \
668 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
669 void CLASS::CBNAME() { \
671 wxPyBeginBlockThreads(); \
672 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
673 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
674 wxPyEndBlockThreads(); \
678 void CLASS::base_##CBNAME() { \
682 //---------------------------------------------------------------------------
684 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
685 void CBNAME(int a, int b); \
686 void base_##CBNAME(int a, int b)
689 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
690 void CLASS::CBNAME(int a, int b) { \
692 wxPyBeginBlockThreads(); \
693 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
694 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
695 wxPyEndBlockThreads(); \
697 PCLASS::CBNAME(a,b); \
699 void CLASS::base_##CBNAME(int a, int b) { \
700 PCLASS::CBNAME(a,b); \
703 //---------------------------------------------------------------------------
705 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
706 void CBNAME(int a); \
707 void base_##CBNAME(int a)
710 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
711 void CLASS::CBNAME(int a) { \
713 wxPyBeginBlockThreads(); \
714 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
715 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
716 wxPyEndBlockThreads(); \
720 void CLASS::base_##CBNAME(int a) { \
724 //---------------------------------------------------------------------------
726 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
727 void CBNAME(int a, int b, int c, int d); \
728 void base_##CBNAME(int a, int b, int c, int d)
731 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
732 void CLASS::CBNAME(int a, int b, int c, int d) { \
734 wxPyBeginBlockThreads(); \
735 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
736 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
737 wxPyEndBlockThreads(); \
739 PCLASS::CBNAME(a,b,c,d); \
741 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
742 PCLASS::CBNAME(a,b,c,d); \
745 //---------------------------------------------------------------------------
746 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
747 void CBNAME(int a, int b, int c, int d, int e); \
748 void base_##CBNAME(int a, int b, int c, int d, int e)
751 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
752 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
754 wxPyBeginBlockThreads(); \
755 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
756 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
757 wxPyEndBlockThreads(); \
759 PCLASS::CBNAME(a,b,c,d,e); \
761 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
762 PCLASS::CBNAME(a,b,c,d,e); \
765 //---------------------------------------------------------------------------
767 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
768 void CBNAME(int* a, int* b) const; \
769 void base_##CBNAME(int* a, int* b) const
772 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
773 void CLASS::CBNAME(int* a, int* b) const { \
774 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
776 wxPyBeginBlockThreads(); \
777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
779 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
781 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
782 PyObject* o1 = PySequence_GetItem(ro, 0); \
783 PyObject* o2 = PySequence_GetItem(ro, 1); \
784 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
785 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
788 PyErr_SetString(PyExc_TypeError, errmsg); \
793 PyErr_SetString(PyExc_TypeError, errmsg); \
798 wxPyEndBlockThreads(); \
800 PCLASS::CBNAME(a,b); \
802 void CLASS::base_##CBNAME(int* a, int* b) const { \
803 PCLASS::CBNAME(a,b); \
807 //---------------------------------------------------------------------------
809 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
810 wxSize CBNAME() const; \
811 wxSize base_##CBNAME() const
814 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
815 wxSize CLASS::CBNAME() const { \
816 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
817 bool found; wxSize rval(0,0); \
818 wxPyBeginBlockThreads(); \
819 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
821 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
823 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
824 PyObject* o1 = PySequence_GetItem(ro, 0); \
825 PyObject* o2 = PySequence_GetItem(ro, 1); \
826 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
827 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
830 PyErr_SetString(PyExc_TypeError, errmsg); \
835 PyErr_SetString(PyExc_TypeError, errmsg); \
840 wxPyEndBlockThreads(); \
842 return PCLASS::CBNAME(); \
846 wxSize CLASS::base_##CBNAME() const { \
847 return PCLASS::CBNAME(); \
851 //---------------------------------------------------------------------------
853 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
854 bool CBNAME(bool a); \
855 bool base_##CBNAME(bool a)
858 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
859 bool CLASS::CBNAME(bool a) { \
860 bool rval=False, found; \
861 wxPyBeginBlockThreads(); \
862 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
863 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
864 wxPyEndBlockThreads(); \
866 rval = PCLASS::CBNAME(a); \
869 bool CLASS::base_##CBNAME(bool a) { \
870 return PCLASS::CBNAME(a); \
873 //---------------------------------------------------------------------------
875 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
876 bool CBNAME(int a); \
877 bool base_##CBNAME(int a)
880 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
881 bool CLASS::CBNAME(int a) { \
882 bool rval=False, found; \
883 wxPyBeginBlockThreads(); \
884 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
885 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
886 wxPyEndBlockThreads(); \
888 rval = PCLASS::CBNAME(a); \
891 bool CLASS::base_##CBNAME(int a) { \
892 return PCLASS::CBNAME(a); \
895 //---------------------------------------------------------------------------
897 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
901 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
902 bool CLASS::CBNAME(int a) { \
904 wxPyBeginBlockThreads(); \
905 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
906 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
908 wxPyEndBlockThreads(); \
913 //---------------------------------------------------------------------------
915 #define DEC_PYCALLBACK__DC(CBNAME) \
916 void CBNAME(wxDC& a); \
917 void base_##CBNAME(wxDC& a)
920 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
921 void CLASS::CBNAME(wxDC& a) { \
923 wxPyBeginBlockThreads(); \
924 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
925 PyObject* obj = wxPyMake_wxObject(&a); \
926 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
929 wxPyEndBlockThreads(); \
933 void CLASS::base_##CBNAME(wxDC& a) { \
939 //---------------------------------------------------------------------------
941 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
942 void CBNAME(wxDC& a, bool b); \
943 void base_##CBNAME(wxDC& a, bool b)
946 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
947 void CLASS::CBNAME(wxDC& a, bool b) { \
949 wxPyBeginBlockThreads(); \
950 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
951 PyObject* obj = wxPyMake_wxObject(&a); \
952 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
955 wxPyEndBlockThreads(); \
957 PCLASS::CBNAME(a, b); \
959 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
960 PCLASS::CBNAME(a, b); \
963 //---------------------------------------------------------------------------
965 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
966 void CBNAME(wxDC& a, bool b); \
967 void base_##CBNAME(wxDC& a, bool b)
970 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
971 void CLASS::CBNAME(wxDC& a, bool b) { \
973 wxPyBeginBlockThreads(); \
974 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
975 PyObject* obj = wxPyMake_wxObject(&a); \
976 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
979 wxPyEndBlockThreads(); \
981 PCLASS::CBNAME(a, b); \
983 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
984 PCLASS::CBNAME(a, b); \
987 //---------------------------------------------------------------------------
989 #define DEC_PYCALLBACK__2DBL(CBNAME) \
990 void CBNAME(double a, double b); \
991 void base_##CBNAME(double a, double b)
994 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
995 void CLASS::CBNAME(double a, double b) { \
997 wxPyBeginBlockThreads(); \
998 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
999 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1000 wxPyEndBlockThreads(); \
1002 PCLASS::CBNAME(a, b); \
1004 void CLASS::base_##CBNAME(double a, double b) { \
1005 PCLASS::CBNAME(a, b); \
1008 //---------------------------------------------------------------------------
1010 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1011 void CBNAME(double a, double b, int c, int d); \
1012 void base_##CBNAME(double a, double b, int c, int d)
1015 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1016 void CLASS::CBNAME(double a, double b, int c, int d) { \
1018 wxPyBeginBlockThreads(); \
1019 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1020 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1022 wxPyEndBlockThreads(); \
1024 PCLASS::CBNAME(a, b, c, d); \
1026 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1027 PCLASS::CBNAME(a, b, c, d); \
1030 //---------------------------------------------------------------------------
1032 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1033 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1034 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1037 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1038 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1040 wxPyBeginBlockThreads(); \
1041 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1042 PyObject* obj = wxPyMake_wxObject(&a); \
1043 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1046 wxPyEndBlockThreads(); \
1048 PCLASS::CBNAME(a, b, c, d, e, f); \
1050 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1051 PCLASS::CBNAME(a, b, c, d, e, f); \
1054 //---------------------------------------------------------------------------
1056 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1057 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1058 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1061 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1062 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1064 wxPyBeginBlockThreads(); \
1066 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1067 PyObject* obj = wxPyMake_wxObject(&a); \
1068 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1071 wxPyEndBlockThreads(); \
1073 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1076 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1077 return PCLASS::CBNAME(a, b, c, d, e, f); \
1080 //---------------------------------------------------------------------------
1082 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1083 void CBNAME(bool a, double b, double c, int d, int e); \
1084 void base_##CBNAME(bool a, double b, double c, int d, int e)
1087 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1088 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1090 wxPyBeginBlockThreads(); \
1091 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1092 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1094 wxPyEndBlockThreads(); \
1096 PCLASS::CBNAME(a, b, c, d, e); \
1098 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1099 PCLASS::CBNAME(a, b, c, d, e); \
1102 //---------------------------------------------------------------------------
1104 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1105 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1106 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1109 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1110 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1112 wxPyBeginBlockThreads(); \
1113 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1114 PyObject* obj = wxPyMake_wxObject(&a); \
1115 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1118 wxPyEndBlockThreads(); \
1120 PCLASS::CBNAME(a, b, c, d, e); \
1122 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1123 PCLASS::CBNAME(a, b, c, d, e); \
1126 //---------------------------------------------------------------------------
1128 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1129 void CBNAME(wxDC& a, bool b); \
1130 void base_##CBNAME(wxDC& a, bool b)
1133 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1134 void CLASS::CBNAME(wxDC& a, bool b) { \
1136 wxPyBeginBlockThreads(); \
1137 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1138 PyObject* obj = wxPyMake_wxObject(&a); \
1139 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1142 wxPyEndBlockThreads(); \
1144 PCLASS::CBNAME(a, b); \
1146 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1147 PCLASS::CBNAME(a, b); \
1150 //---------------------------------------------------------------------------
1152 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1153 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1154 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1157 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1158 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1161 wxPyBeginBlockThreads(); \
1162 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1163 PyObject* obj = wxPyMake_wxObject(a); \
1164 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1167 wxPyEndBlockThreads(); \
1169 PCLASS::CBNAME(a, b, c, d, e, f); \
1171 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1173 PCLASS::CBNAME(a, b, c, d, e, f); \
1176 //---------------------------------------------------------------------------
1178 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1179 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1180 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1183 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1184 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1186 wxPyBeginBlockThreads(); \
1187 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1188 PyObject* obj = wxPyMake_wxObject(a); \
1189 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1192 wxPyEndBlockThreads(); \
1194 PCLASS::CBNAME(a, b, c, d, e); \
1196 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1198 PCLASS::CBNAME(a, b, c, d, e); \
1201 //---------------------------------------------------------------------------
1203 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1204 void CBNAME(double a, double b, int c); \
1205 void base_##CBNAME(double a, double b, int c)
1208 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1209 void CLASS::CBNAME(double a, double b, int c) { \
1211 wxPyBeginBlockThreads(); \
1212 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1213 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1214 wxPyEndBlockThreads(); \
1216 PCLASS::CBNAME(a, b, c); \
1218 void CLASS::base_##CBNAME(double a, double b, int c) { \
1219 PCLASS::CBNAME(a, b, c); \
1222 //---------------------------------------------------------------------------
1224 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1225 void CBNAME(bool a, double b, double c, int d); \
1226 void base_##CBNAME(bool a, double b, double c, int d)
1229 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1230 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1232 wxPyBeginBlockThreads(); \
1233 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1234 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1235 wxPyEndBlockThreads(); \
1237 PCLASS::CBNAME(a, b, c, d); \
1239 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1240 PCLASS::CBNAME(a, b, c, d); \
1243 //---------------------------------------------------------------------------
1244 //---------------------------------------------------------------------------
1246 #define DEC_PYCALLBACK__STRING(CBNAME) \
1247 void CBNAME(const wxString& a); \
1248 void base_##CBNAME(const wxString& a)
1250 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1251 void CLASS::CBNAME(const wxString& a) { \
1253 wxPyBeginBlockThreads(); \
1254 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1255 PyObject* s = wx2PyString(a); \
1256 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1259 wxPyEndBlockThreads(); \
1261 PCLASS::CBNAME(a); \
1263 void CLASS::base_##CBNAME(const wxString& a) { \
1264 PCLASS::CBNAME(a); \
1267 //---------------------------------------------------------------------------
1269 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1270 bool CBNAME(const wxString& a); \
1271 bool base_##CBNAME(const wxString& a)
1273 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1274 bool CLASS::CBNAME(const wxString& a) { \
1277 wxPyBeginBlockThreads(); \
1278 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1279 PyObject* s = wx2PyString(a); \
1280 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1283 wxPyEndBlockThreads(); \
1285 rval = PCLASS::CBNAME(a); \
1288 bool CLASS::base_##CBNAME(const wxString& a) { \
1289 return PCLASS::CBNAME(a); \
1292 //---------------------------------------------------------------------------
1294 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1295 bool CBNAME(const wxString& a)
1297 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1298 bool CLASS::CBNAME(const wxString& a) { \
1300 wxPyBeginBlockThreads(); \
1301 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1302 PyObject* s = wx2PyString(a); \
1303 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1306 wxPyEndBlockThreads(); \
1310 //---------------------------------------------------------------------------
1312 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1313 wxString CBNAME(const wxString& a)
1315 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1316 wxString CLASS::CBNAME(const wxString& a) { \
1318 wxPyBeginBlockThreads(); \
1319 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1321 PyObject* s = wx2PyString(a); \
1322 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1325 rval = Py2wxString(ro); \
1329 wxPyEndBlockThreads(); \
1333 //---------------------------------------------------------------------------
1335 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1336 wxString CBNAME(const wxString& a); \
1337 wxString base_##CBNAME(const wxString& a)
1339 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1340 wxString CLASS::CBNAME(const wxString& a) { \
1343 wxPyBeginBlockThreads(); \
1344 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1346 PyObject* s = wx2PyString(a); \
1347 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1350 rval = Py2wxString(ro); \
1355 rval = PCLASS::CBNAME(a); \
1356 wxPyEndBlockThreads(); \
1360 //---------------------------------------------------------------------------
1362 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1363 wxString CBNAME(const wxString& a,int b)
1365 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1366 wxString CLASS::CBNAME(const wxString& a,int b) { \
1368 wxPyBeginBlockThreads(); \
1369 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1371 PyObject* s = wx2PyString(a); \
1372 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1375 rval = Py2wxString(ro); \
1379 wxPyEndBlockThreads(); \
1383 //---------------------------------------------------------------------------
1385 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1386 bool CBNAME(const wxString& a, const wxString& b); \
1387 bool base_##CBNAME(const wxString& a, const wxString& b)
1389 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1390 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1393 wxPyBeginBlockThreads(); \
1394 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1395 PyObject* s1 = wx2PyString(a); \
1396 PyObject* s2 = wx2PyString(b); \
1397 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1401 wxPyEndBlockThreads(); \
1403 rval = PCLASS::CBNAME(a, b); \
1406 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1407 return PCLASS::CBNAME(a, b); \
1410 //---------------------------------------------------------------------------
1412 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1413 wxString CBNAME(); \
1414 wxString base_##CBNAME()
1416 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1417 wxString CLASS::CBNAME() { \
1420 wxPyBeginBlockThreads(); \
1421 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1423 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1425 rval = Py2wxString(ro); \
1429 wxPyEndBlockThreads(); \
1431 rval = PCLASS::CBNAME(); \
1434 wxString CLASS::base_##CBNAME() { \
1435 return PCLASS::CBNAME(); \
1438 //---------------------------------------------------------------------------
1440 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1441 wxString CBNAME() const; \
1442 wxString base_##CBNAME() const;
1444 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1445 wxString CLASS::CBNAME() const { \
1448 wxPyBeginBlockThreads(); \
1449 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1451 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1453 rval = Py2wxString(ro); \
1457 wxPyEndBlockThreads(); \
1459 rval = PCLASS::CBNAME(); \
1462 wxString CLASS::base_##CBNAME() const { \
1463 return PCLASS::CBNAME(); \
1466 //---------------------------------------------------------------------------
1468 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1471 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1472 wxString CLASS::CBNAME() { \
1474 wxPyBeginBlockThreads(); \
1475 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1477 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1479 rval = Py2wxString(ro); \
1483 wxPyEndBlockThreads(); \
1487 //---------------------------------------------------------------------------
1489 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1490 wxString CBNAME() const;
1492 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1493 wxString CLASS::CBNAME() const { \
1495 wxPyBeginBlockThreads(); \
1496 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1498 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1500 rval = Py2wxString(ro); \
1504 wxPyEndBlockThreads(); \
1508 //---------------------------------------------------------------------------
1510 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1511 bool CBNAME(const wxHtmlTag& a)
1514 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1515 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1517 wxPyBeginBlockThreads(); \
1518 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1519 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1520 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1523 wxPyEndBlockThreads(); \
1527 //---------------------------------------------------------------------------
1529 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1530 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1531 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1533 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1534 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1536 wxPyBeginBlockThreads(); \
1537 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1538 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1539 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1542 wxPyEndBlockThreads(); \
1544 PCLASS::CBNAME(cell, x, y); \
1546 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1547 PCLASS::CBNAME(cell, x, y); \
1551 //---------------------------------------------------------------------------
1553 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1554 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1555 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1557 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1558 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1560 wxPyBeginBlockThreads(); \
1561 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1562 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1563 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1564 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1568 wxPyEndBlockThreads(); \
1570 PCLASS::CBNAME(cell, x, y, e); \
1572 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1573 PCLASS::CBNAME(cell, x, y, e); \
1578 //---------------------------------------------------------------------------
1580 #define DEC_PYCALLBACK___pure(CBNAME) \
1584 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1585 void CLASS::CBNAME() { \
1586 wxPyBeginBlockThreads(); \
1587 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1588 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1589 wxPyEndBlockThreads(); \
1592 //---------------------------------------------------------------------------
1594 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1598 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1599 wxSize CLASS::CBNAME() { \
1600 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1602 wxPyBeginBlockThreads(); \
1603 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1606 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1608 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1610 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1611 PyObject* o1 = PySequence_GetItem(ro, 0); \
1612 PyObject* o2 = PySequence_GetItem(ro, 1); \
1613 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1614 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1616 PyErr_SetString(PyExc_TypeError, errmsg); \
1621 PyErr_SetString(PyExc_TypeError, errmsg); \
1626 wxPyEndBlockThreads(); \
1630 //---------------------------------------------------------------------------
1632 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1633 bool CBNAME(wxWindow* a); \
1634 bool base_##CBNAME(wxWindow* a)
1637 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1638 bool CLASS::CBNAME(wxWindow* a) { \
1641 wxPyBeginBlockThreads(); \
1642 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1643 PyObject* obj = wxPyMake_wxObject(a); \
1644 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1647 wxPyEndBlockThreads(); \
1649 rval = PCLASS::CBNAME(a); \
1652 bool CLASS::base_##CBNAME(wxWindow* a) { \
1653 return PCLASS::CBNAME(a); \
1656 //---------------------------------------------------------------------------
1658 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1659 bool CBNAME(wxWindow* a, wxDC& b); \
1660 bool base_##CBNAME(wxWindow* a, wxDC& b)
1663 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1664 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1667 wxPyBeginBlockThreads(); \
1668 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1669 PyObject* win = wxPyMake_wxObject(a); \
1670 PyObject* dc = wxPyMake_wxObject(&b); \
1671 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1675 wxPyEndBlockThreads(); \
1677 rval = PCLASS::CBNAME(a, b); \
1680 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1681 return PCLASS::CBNAME(a, b); \
1684 //---------------------------------------------------------------------------
1686 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1687 void CBNAME(wxWindowBase* a); \
1688 void base_##CBNAME(wxWindowBase* a)
1691 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1692 void CLASS::CBNAME(wxWindowBase* a) { \
1694 wxPyBeginBlockThreads(); \
1695 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1696 PyObject* obj = wxPyMake_wxObject(a); \
1697 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1700 wxPyEndBlockThreads(); \
1702 PCLASS::CBNAME(a); \
1704 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1705 PCLASS::CBNAME(a); \
1708 //---------------------------------------------------------------------------
1710 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1712 bool base_##CBNAME()
1715 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1716 bool CLASS::CBNAME() { \
1719 wxPyBeginBlockThreads(); \
1720 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1721 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1722 wxPyEndBlockThreads(); \
1724 rval = PCLASS::CBNAME(); \
1727 bool CLASS::base_##CBNAME() { \
1728 return PCLASS::CBNAME(); \
1731 //---------------------------------------------------------------------------
1733 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1734 bool CBNAME() const; \
1735 bool base_##CBNAME() const
1738 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1739 bool CLASS::CBNAME() const { \
1742 wxPyBeginBlockThreads(); \
1743 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1744 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1745 wxPyEndBlockThreads(); \
1747 rval = PCLASS::CBNAME(); \
1750 bool CLASS::base_##CBNAME() const { \
1751 return PCLASS::CBNAME(); \
1754 //---------------------------------------------------------------------------
1756 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1757 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1758 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1761 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1762 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1765 wxPyBeginBlockThreads(); \
1766 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1767 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1768 wxPyEndBlockThreads(); \
1770 rval = PCLASS::CBNAME(a, b, c); \
1771 return (wxDragResult)rval; \
1773 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1774 return PCLASS::CBNAME(a, b, c); \
1777 //---------------------------------------------------------------------------
1779 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1780 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1782 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1783 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1784 wxPyBeginBlockThreads(); \
1786 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1788 PyObject* obj = wxPyMake_wxObject(&a); \
1789 PyObject* s = wx2PyString(b); \
1790 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1793 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1799 wxPyEndBlockThreads(); \
1803 //---------------------------------------------------------------------------
1805 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1806 bool CBNAME(wxDragResult a); \
1807 bool base_##CBNAME(wxDragResult a)
1810 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1811 bool CLASS::CBNAME(wxDragResult a) { \
1814 wxPyBeginBlockThreads(); \
1815 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1816 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1817 wxPyEndBlockThreads(); \
1819 rval = PCLASS::CBNAME(a); \
1822 bool CLASS::base_##CBNAME(wxDragResult a) { \
1823 return PCLASS::CBNAME(a); \
1826 //---------------------------------------------------------------------------
1828 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1829 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1832 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1833 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1834 wxPyBeginBlockThreads(); \
1836 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1837 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1838 wxPyEndBlockThreads(); \
1839 return (wxDragResult)rval; \
1842 //---------------------------------------------------------------------------
1844 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1845 bool CBNAME(int a, int b, const wxString& c)
1847 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1848 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1850 wxPyBeginBlockThreads(); \
1851 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1852 PyObject* s = wx2PyString(c); \
1853 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1856 wxPyEndBlockThreads(); \
1860 //---------------------------------------------------------------------------
1862 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1864 size_t base_##CBNAME()
1867 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1868 size_t CLASS::CBNAME() { \
1871 wxPyBeginBlockThreads(); \
1872 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1873 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1874 wxPyEndBlockThreads(); \
1876 rval = PCLASS::CBNAME(); \
1879 size_t CLASS::base_##CBNAME() { \
1880 return PCLASS::CBNAME(); \
1883 //---------------------------------------------------------------------------
1885 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1886 size_t CBNAME() const; \
1887 size_t base_##CBNAME() const
1890 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1891 size_t CLASS::CBNAME() const { \
1894 wxPyBeginBlockThreads(); \
1895 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1896 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1897 wxPyEndBlockThreads(); \
1899 rval = PCLASS::CBNAME(); \
1902 size_t CLASS::base_##CBNAME() const { \
1903 return PCLASS::CBNAME(); \
1906 //---------------------------------------------------------------------------
1908 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1909 wxDataFormat CBNAME(size_t a); \
1910 wxDataFormat base_##CBNAME(size_t a)
1913 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1914 wxDataFormat CLASS::CBNAME(size_t a) { \
1915 wxDataFormat rval=0; \
1917 wxPyBeginBlockThreads(); \
1918 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1920 wxDataFormat* ptr; \
1921 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1923 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1928 wxPyEndBlockThreads(); \
1930 rval = PCLASS::CBNAME(a); \
1933 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1934 return PCLASS::CBNAME(a); \
1937 //---------------------------------------------------------------------------
1939 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1940 void CBNAME(const Type& a); \
1941 void base_##CBNAME(const Type& a)
1944 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1945 void CLASS::CBNAME(const Type& a) { \
1947 wxPyBeginBlockThreads(); \
1948 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1949 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1950 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1953 wxPyEndBlockThreads(); \
1955 PCLASS::CBNAME(a); \
1957 void CLASS::base_##CBNAME(const Type& a) { \
1958 PCLASS::CBNAME(a); \
1962 //---------------------------------------------------------------------------
1964 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1965 void CBNAME(Type& a); \
1966 void base_##CBNAME(Type& a)
1969 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1970 void CLASS::CBNAME(Type& a) { \
1972 wxPyBeginBlockThreads(); \
1973 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1974 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1975 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1978 wxPyEndBlockThreads(); \
1980 PCLASS::CBNAME(a); \
1982 void CLASS::base_##CBNAME(Type& a) { \
1983 PCLASS::CBNAME(a); \
1986 //---------------------------------------------------------------------------
1988 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1989 bool CBNAME(Type& a); \
1990 bool base_##CBNAME(Type& a)
1993 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1994 bool CLASS::CBNAME(Type& a) { \
1997 wxPyBeginBlockThreads(); \
1998 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1999 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2000 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2003 wxPyEndBlockThreads(); \
2005 rv = PCLASS::CBNAME(a); \
2008 bool CLASS::base_##CBNAME(Type& a) { \
2009 return PCLASS::CBNAME(a); \
2012 //---------------------------------------------------------------------------
2014 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2015 bool CBNAME(Type& a)
2018 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2019 bool CLASS::CBNAME(Type& a) { \
2021 wxPyBeginBlockThreads(); \
2022 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2023 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2024 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2027 wxPyEndBlockThreads(); \
2031 //---------------------------------------------------------------------------
2033 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2034 wxString CBNAME(long a, long b) const; \
2035 wxString base_##CBNAME(long a, long b) const
2037 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2038 wxString CLASS::CBNAME(long a, long b) const { \
2041 wxPyBeginBlockThreads(); \
2042 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2044 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2046 rval = Py2wxString(ro); \
2050 wxPyEndBlockThreads(); \
2052 rval = PCLASS::CBNAME(a,b); \
2055 wxString CLASS::base_##CBNAME(long a, long b) const { \
2056 return PCLASS::CBNAME(a,b); \
2059 //---------------------------------------------------------------------------
2061 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2062 int CBNAME(long a) const; \
2063 int base_##CBNAME(long a) const
2066 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2067 int CLASS::CBNAME(long a) const { \
2070 wxPyBeginBlockThreads(); \
2071 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2073 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2075 rval = PyInt_AsLong(ro); \
2079 wxPyEndBlockThreads(); \
2081 rval = PCLASS::CBNAME(a); \
2084 int CLASS::base_##CBNAME(long a) const { \
2085 return PCLASS::CBNAME(a); \
2089 //---------------------------------------------------------------------------
2091 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2092 wxListItemAttr* CBNAME(long a) const; \
2093 wxListItemAttr* base_##CBNAME(long a) const
2096 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2097 wxListItemAttr *CLASS::CBNAME(long a) const { \
2098 wxListItemAttr *rval = NULL; \
2100 wxPyBeginBlockThreads(); \
2101 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2103 wxListItemAttr* ptr; \
2104 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2106 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2111 wxPyEndBlockThreads(); \
2113 rval = PCLASS::CBNAME(a); \
2116 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2117 return PCLASS::CBNAME(a); \
2120 //---------------------------------------------------------------------------
2122 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2123 bool CBNAME(wxMouseEvent& e); \
2124 bool base_##CBNAME(wxMouseEvent& e)
2126 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2127 bool CLASS::CBNAME(wxMouseEvent& e) { \
2130 wxPyBeginBlockThreads(); \
2131 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2133 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2134 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2136 rval = PyInt_AsLong(ro); \
2141 wxPyEndBlockThreads(); \
2143 return PCLASS::CBNAME(e); \
2146 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2147 return PCLASS::CBNAME(e); \
2151 //---------------------------------------------------------------------------
2153 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2154 wxWizardPage* CBNAME() const
2156 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2157 wxWizardPage* CLASS::CBNAME() const { \
2158 wxWizardPage* rv = NULL; \
2159 wxPyBeginBlockThreads(); \
2160 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2162 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2164 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2168 wxPyEndBlockThreads(); \
2172 //---------------------------------------------------------------------------
2174 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2175 wxBitmap CBNAME() const
2177 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2178 wxBitmap CLASS::CBNAME() const { \
2180 wxPyBeginBlockThreads(); \
2181 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2184 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2186 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2191 wxPyEndBlockThreads(); \
2195 //---------------------------------------------------------------------------
2197 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2200 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2201 wxObject* CLASS::CBNAME() { \
2202 wxObject* rv = NULL; \
2203 wxPyBeginBlockThreads(); \
2204 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2206 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2208 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2212 wxPyEndBlockThreads(); \
2216 //---------------------------------------------------------------------------
2218 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2219 wxObject* CBNAME(const wxString& a)
2221 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2222 wxObject* CLASS::CBNAME(const wxString& a) { \
2223 wxObject* rv = NULL; \
2224 wxPyBeginBlockThreads(); \
2225 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2226 PyObject* so = wx2PyString(a); \
2228 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2230 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2235 wxPyEndBlockThreads(); \
2239 //---------------------------------------------------------------------------
2241 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2242 bool CBNAME(wxXmlNode* a)
2245 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2246 bool CLASS::CBNAME(wxXmlNode* a) { \
2248 wxPyBeginBlockThreads(); \
2249 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2250 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2251 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2254 wxPyEndBlockThreads(); \
2258 //---------------------------------------------------------------------------
2260 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2261 wxCoord CBNAME(size_t a) const
2264 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2265 wxCoord CLASS::CBNAME(size_t a) const { \
2268 wxPyBeginBlockThreads(); \
2269 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2270 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2272 wxPyEndBlockThreads(); \
2276 //---------------------------------------------------------------------------
2278 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2279 void CBNAME(size_t a, size_t b) const; \
2280 void base_##CBNAME(size_t a, size_t b) const
2283 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2284 void CLASS::CBNAME(size_t a, size_t b) const { \
2286 wxPyBeginBlockThreads(); \
2287 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2288 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2289 wxPyEndBlockThreads(); \
2291 PCLASS::CBNAME(a,b); \
2293 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2294 PCLASS::CBNAME(a,b); \
2297 //---------------------------------------------------------------------------
2299 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2300 wxCoord CBNAME() const; \
2301 wxCoord base_##CBNAME() const
2304 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2305 wxCoord CLASS::CBNAME() const { \
2308 wxPyBeginBlockThreads(); \
2309 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2310 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2311 wxPyEndBlockThreads(); \
2313 rval = PCLASS::CBNAME(); \
2316 wxCoord CLASS::base_##CBNAME() const { \
2317 return PCLASS::CBNAME(); \
2320 //---------------------------------------------------------------------------
2322 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2323 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2326 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2327 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2329 wxPyBeginBlockThreads(); \
2330 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2331 PyObject* obj = wxPyMake_wxObject(&a); \
2332 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2333 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2336 wxPyEndBlockThreads(); \
2339 //---------------------------------------------------------------------------
2341 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2342 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2343 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2346 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2347 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2349 wxPyBeginBlockThreads(); \
2350 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2351 PyObject* obj = wxPyMake_wxObject(&a); \
2352 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2353 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2356 wxPyEndBlockThreads(); \
2358 PCLASS::CBNAME(a,b,c); \
2360 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2361 PCLASS::CBNAME(a,b,c); \
2364 //---------------------------------------------------------------------------
2367 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2368 wxString CBNAME(size_t a) const; \
2369 wxString base_##CBNAME(size_t a) const
2371 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2372 wxString CLASS::CBNAME(size_t a) const { \
2375 wxPyBeginBlockThreads(); \
2376 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2378 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2380 rval = Py2wxString(ro); \
2384 wxPyEndBlockThreads(); \
2386 rval = PCLASS::CBNAME(a); \
2389 wxString CLASS::base_##CBNAME(size_t a) const { \
2390 return PCLASS::CBNAME(a); \
2393 //---------------------------------------------------------------------------
2395 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2396 wxString CBNAME(size_t a) const
2398 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2399 wxString CLASS::CBNAME(size_t a) const { \
2402 wxPyBeginBlockThreads(); \
2403 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2405 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2407 rval = Py2wxString(ro); \
2411 wxPyEndBlockThreads(); \
2415 //---------------------------------------------------------------------------