1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/clipbrd.h>
24 #include <wx/colordlg.h>
25 #include <wx/config.h>
26 #include <wx/cshelp.h>
27 #include <wx/dcbuffer.h>
28 #include <wx/dcmirror.h>
30 #include <wx/dirctrl.h>
31 #include <wx/dirdlg.h>
33 #include <wx/docview.h>
34 #include <wx/encconv.h>
35 #include <wx/fdrepdlg.h>
36 #include <wx/fileconf.h>
37 #include <wx/filesys.h>
38 #include <wx/fontdlg.h>
39 #include <wx/fs_inet.h>
40 #include <wx/fs_mem.h>
41 #include <wx/fs_zip.h>
42 #include <wx/gbsizer.h>
43 #include <wx/geometry.h>
44 #include <wx/htmllbox.h>
46 #include <wx/imaglist.h>
48 #include <wx/laywin.h>
49 #include <wx/listbook.h>
50 #include <wx/minifram.h>
51 #include <wx/notebook.h>
53 #include <wx/printdlg.h>
54 #include <wx/process.h>
55 #include <wx/progdlg.h>
56 #include <wx/sashwin.h>
57 #include <wx/spinbutt.h>
58 #include <wx/spinctrl.h>
59 #include <wx/splash.h>
60 #include <wx/splitter.h>
61 #include <wx/statline.h>
62 #include <wx/stream.h>
63 #include <wx/sysopt.h>
64 #include <wx/taskbar.h>
65 #include <wx/tglbtn.h>
66 #include <wx/tipwin.h>
67 #include <wx/tooltip.h>
69 #include <wx/vscroll.h>
73 # pragma warning(disable:4800)
74 # pragma warning(disable:4190)
77 #ifdef __WXMAC__ // avoid a bug in Carbon headers
81 //---------------------------------------------------------------------------
83 typedef unsigned char byte
;
84 typedef wxPoint2DDouble wxPoint2D
;
86 const bool True
= true;
87 const bool False
= false;
90 #ifndef wxPyUSE_EXPORTED_API
92 void __wxPyPreStart(PyObject
*);
94 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
95 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
98 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
101 bool wxPyCheckSwigType(const wxChar
* className
);
102 PyObject
* wxPyConstructObject(void* ptr
,
103 const wxChar
* className
,
105 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
106 const wxChar
* className
);
107 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
110 PyObject
* wx2PyString(const wxString
& src
);
111 wxString
Py2wxString(PyObject
* source
);
113 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
114 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
115 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
117 PyObject
* wxPy_ConvertList(wxListBase
* list
);
118 long wxPyGetWinHandle(wxWindow
* win
);
120 void wxPy_ReinitStockObjects(int pass
);
122 bool wxPyInstance_Check(PyObject
* obj
);
123 bool wxPySwigInstance_Check(PyObject
* obj
);
126 #endif // wxPyUSE_EXPORTED_API
127 //---------------------------------------------------------------------------
129 // if we want to handle threads and Python threads are available...
130 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
131 #define WXP_WITH_THREAD
132 #else // no Python threads...
133 #undef WXP_WITH_THREAD
136 #ifndef wxPyUSE_EXPORTED_API
138 // For Python --> C++
139 PyThreadState
* wxPyBeginAllowThreads();
140 void wxPyEndAllowThreads(PyThreadState
* state
);
142 // For C++ --> Python
143 void wxPyBeginBlockThreads();
144 void wxPyEndBlockThreads();
146 #endif // wxPyUSE_EXPORTED_API
148 #define wxPyBLOCK_THREADS(stmt) wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads()
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
;
320 // Make SunCC happy and make typedef's for these that are extern "C"
321 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
322 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
323 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
324 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
325 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
326 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
327 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
328 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
329 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
330 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
331 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
332 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
333 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
334 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
335 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
336 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
337 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
342 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
343 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
344 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
345 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
346 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
347 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
348 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
349 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
350 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
351 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
352 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
353 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
354 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
355 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
356 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
357 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
358 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????
583 static bool GetMacSupportPCMenuShortcuts();
584 static long GetMacAboutMenuItemId();
585 static long GetMacPreferencesMenuItemId();
586 static long GetMacExitMenuItemId();
587 static wxString
GetMacHelpMenuTitleName();
589 static void SetMacSupportPCMenuShortcuts(bool val
);
590 static void SetMacAboutMenuItemId(long val
);
591 static void SetMacPreferencesMenuItemId(long val
);
592 static void SetMacExitMenuItemId(long val
);
593 static void SetMacHelpMenuTitleName(const wxString
& val
);
596 void _BootstrapApp();
598 // implementation only
599 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
603 bool m_startupComplete
;
606 extern wxPyApp
*wxPythonApp
;
609 //----------------------------------------------------------------------
610 // These macros are used to implement the virtual methods that should
611 // redirect to a Python method if one exists. The names designate the
612 // return type, if any, as well as any parameter types.
613 //---------------------------------------------------------------------------
615 #define DEC_PYCALLBACK__(CBNAME) \
620 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
621 void CLASS::CBNAME() { \
623 wxPyBeginBlockThreads(); \
624 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
625 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
626 wxPyEndBlockThreads(); \
630 void CLASS::base_##CBNAME() { \
634 //---------------------------------------------------------------------------
636 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
637 bool CBNAME(int a, int b); \
638 bool base_##CBNAME(int a, int b)
641 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
642 bool CLASS::CBNAME(int a, int b) { \
643 bool rval=False, found; \
644 wxPyBeginBlockThreads(); \
645 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
646 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
647 wxPyEndBlockThreads(); \
649 rval = PCLASS::CBNAME(a,b); \
652 bool CLASS::base_##CBNAME(int a, int b) { \
653 return PCLASS::CBNAME(a,b); \
656 //---------------------------------------------------------------------------
658 #define DEC_PYCALLBACK_VOID_(CBNAME) \
663 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
664 void CLASS::CBNAME() { \
666 wxPyBeginBlockThreads(); \
667 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
668 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
669 wxPyEndBlockThreads(); \
673 void CLASS::base_##CBNAME() { \
677 //---------------------------------------------------------------------------
679 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
680 void CBNAME(int a, int b); \
681 void base_##CBNAME(int a, int b)
684 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
685 void CLASS::CBNAME(int a, int b) { \
687 wxPyBeginBlockThreads(); \
688 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
689 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
690 wxPyEndBlockThreads(); \
692 PCLASS::CBNAME(a,b); \
694 void CLASS::base_##CBNAME(int a, int b) { \
695 PCLASS::CBNAME(a,b); \
698 //---------------------------------------------------------------------------
700 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
701 void CBNAME(int a); \
702 void base_##CBNAME(int a)
705 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
706 void CLASS::CBNAME(int a) { \
708 wxPyBeginBlockThreads(); \
709 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
710 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
711 wxPyEndBlockThreads(); \
715 void CLASS::base_##CBNAME(int a) { \
719 //---------------------------------------------------------------------------
721 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
722 void CBNAME(int a, int b, int c, int d); \
723 void base_##CBNAME(int a, int b, int c, int d)
726 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
727 void CLASS::CBNAME(int a, int b, int c, int d) { \
729 wxPyBeginBlockThreads(); \
730 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
731 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
732 wxPyEndBlockThreads(); \
734 PCLASS::CBNAME(a,b,c,d); \
736 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
737 PCLASS::CBNAME(a,b,c,d); \
740 //---------------------------------------------------------------------------
741 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
742 void CBNAME(int a, int b, int c, int d, int e); \
743 void base_##CBNAME(int a, int b, int c, int d, int e)
746 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
747 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
749 wxPyBeginBlockThreads(); \
750 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
751 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
752 wxPyEndBlockThreads(); \
754 PCLASS::CBNAME(a,b,c,d,e); \
756 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
757 PCLASS::CBNAME(a,b,c,d,e); \
760 //---------------------------------------------------------------------------
762 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
763 void CBNAME(int* a, int* b) const; \
764 void base_##CBNAME(int* a, int* b) const
767 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
768 void CLASS::CBNAME(int* a, int* b) const { \
769 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
771 wxPyBeginBlockThreads(); \
772 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
774 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
776 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
777 PyObject* o1 = PySequence_GetItem(ro, 0); \
778 PyObject* o2 = PySequence_GetItem(ro, 1); \
779 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
780 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
783 PyErr_SetString(PyExc_TypeError, errmsg); \
788 PyErr_SetString(PyExc_TypeError, errmsg); \
793 wxPyEndBlockThreads(); \
795 PCLASS::CBNAME(a,b); \
797 void CLASS::base_##CBNAME(int* a, int* b) const { \
798 PCLASS::CBNAME(a,b); \
802 //---------------------------------------------------------------------------
804 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
805 wxSize CBNAME() const; \
806 wxSize base_##CBNAME() const
809 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
810 wxSize CLASS::CBNAME() const { \
811 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
812 bool found; wxSize rval(0,0); \
813 wxPyBeginBlockThreads(); \
814 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
816 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
818 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
819 PyObject* o1 = PySequence_GetItem(ro, 0); \
820 PyObject* o2 = PySequence_GetItem(ro, 1); \
821 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
822 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
825 PyErr_SetString(PyExc_TypeError, errmsg); \
830 PyErr_SetString(PyExc_TypeError, errmsg); \
835 wxPyEndBlockThreads(); \
837 return PCLASS::CBNAME(); \
841 wxSize CLASS::base_##CBNAME() const { \
842 return PCLASS::CBNAME(); \
846 //---------------------------------------------------------------------------
848 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
849 bool CBNAME(bool a); \
850 bool base_##CBNAME(bool a)
853 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
854 bool CLASS::CBNAME(bool a) { \
855 bool rval=False, found; \
856 wxPyBeginBlockThreads(); \
857 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
858 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
859 wxPyEndBlockThreads(); \
861 rval = PCLASS::CBNAME(a); \
864 bool CLASS::base_##CBNAME(bool a) { \
865 return PCLASS::CBNAME(a); \
868 //---------------------------------------------------------------------------
870 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
871 bool CBNAME(int a); \
872 bool base_##CBNAME(int a)
875 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
876 bool CLASS::CBNAME(int a) { \
877 bool rval=False, found; \
878 wxPyBeginBlockThreads(); \
879 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
880 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
881 wxPyEndBlockThreads(); \
883 rval = PCLASS::CBNAME(a); \
886 bool CLASS::base_##CBNAME(int a) { \
887 return PCLASS::CBNAME(a); \
890 //---------------------------------------------------------------------------
892 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
896 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
897 bool CLASS::CBNAME(int a) { \
899 wxPyBeginBlockThreads(); \
900 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
901 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
903 wxPyEndBlockThreads(); \
908 //---------------------------------------------------------------------------
910 #define DEC_PYCALLBACK__DC(CBNAME) \
911 void CBNAME(wxDC& a); \
912 void base_##CBNAME(wxDC& a)
915 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
916 void CLASS::CBNAME(wxDC& a) { \
918 wxPyBeginBlockThreads(); \
919 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
920 PyObject* obj = wxPyMake_wxObject(&a); \
921 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
924 wxPyEndBlockThreads(); \
928 void CLASS::base_##CBNAME(wxDC& a) { \
934 //---------------------------------------------------------------------------
936 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
937 void CBNAME(wxDC& a, bool b); \
938 void base_##CBNAME(wxDC& a, bool b)
941 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
942 void CLASS::CBNAME(wxDC& a, bool b) { \
944 wxPyBeginBlockThreads(); \
945 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
946 PyObject* obj = wxPyMake_wxObject(&a); \
947 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
950 wxPyEndBlockThreads(); \
952 PCLASS::CBNAME(a, b); \
954 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
955 PCLASS::CBNAME(a, b); \
958 //---------------------------------------------------------------------------
960 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
961 void CBNAME(wxDC& a, bool b); \
962 void base_##CBNAME(wxDC& a, bool b)
965 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
966 void CLASS::CBNAME(wxDC& a, bool b) { \
968 wxPyBeginBlockThreads(); \
969 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
970 PyObject* obj = wxPyMake_wxObject(&a); \
971 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
974 wxPyEndBlockThreads(); \
976 PCLASS::CBNAME(a, b); \
978 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
979 PCLASS::CBNAME(a, b); \
982 //---------------------------------------------------------------------------
984 #define DEC_PYCALLBACK__2DBL(CBNAME) \
985 void CBNAME(double a, double b); \
986 void base_##CBNAME(double a, double b)
989 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
990 void CLASS::CBNAME(double a, double b) { \
992 wxPyBeginBlockThreads(); \
993 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
994 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
995 wxPyEndBlockThreads(); \
997 PCLASS::CBNAME(a, b); \
999 void CLASS::base_##CBNAME(double a, double b) { \
1000 PCLASS::CBNAME(a, b); \
1003 //---------------------------------------------------------------------------
1005 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1006 void CBNAME(double a, double b, int c, int d); \
1007 void base_##CBNAME(double a, double b, int c, int d)
1010 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1011 void CLASS::CBNAME(double a, double b, int c, int d) { \
1013 wxPyBeginBlockThreads(); \
1014 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1015 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1017 wxPyEndBlockThreads(); \
1019 PCLASS::CBNAME(a, b, c, d); \
1021 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1022 PCLASS::CBNAME(a, b, c, d); \
1025 //---------------------------------------------------------------------------
1027 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1028 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1029 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1032 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1033 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1035 wxPyBeginBlockThreads(); \
1036 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1037 PyObject* obj = wxPyMake_wxObject(&a); \
1038 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1041 wxPyEndBlockThreads(); \
1043 PCLASS::CBNAME(a, b, c, d, e, f); \
1045 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1046 PCLASS::CBNAME(a, b, c, d, e, f); \
1049 //---------------------------------------------------------------------------
1051 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1052 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1053 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1056 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1057 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1059 wxPyBeginBlockThreads(); \
1061 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1062 PyObject* obj = wxPyMake_wxObject(&a); \
1063 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1066 wxPyEndBlockThreads(); \
1068 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1071 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1072 return PCLASS::CBNAME(a, b, c, d, e, f); \
1075 //---------------------------------------------------------------------------
1077 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1078 void CBNAME(bool a, double b, double c, int d, int e); \
1079 void base_##CBNAME(bool a, double b, double c, int d, int e)
1082 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1083 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1085 wxPyBeginBlockThreads(); \
1086 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1087 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1089 wxPyEndBlockThreads(); \
1091 PCLASS::CBNAME(a, b, c, d, e); \
1093 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1094 PCLASS::CBNAME(a, b, c, d, e); \
1097 //---------------------------------------------------------------------------
1099 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1100 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1101 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1104 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1105 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1107 wxPyBeginBlockThreads(); \
1108 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1109 PyObject* obj = wxPyMake_wxObject(&a); \
1110 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1113 wxPyEndBlockThreads(); \
1115 PCLASS::CBNAME(a, b, c, d, e); \
1117 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1118 PCLASS::CBNAME(a, b, c, d, e); \
1121 //---------------------------------------------------------------------------
1123 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1124 void CBNAME(wxDC& a, bool b); \
1125 void base_##CBNAME(wxDC& a, bool b)
1128 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1129 void CLASS::CBNAME(wxDC& a, bool b) { \
1131 wxPyBeginBlockThreads(); \
1132 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1133 PyObject* obj = wxPyMake_wxObject(&a); \
1134 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1137 wxPyEndBlockThreads(); \
1139 PCLASS::CBNAME(a, b); \
1141 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1142 PCLASS::CBNAME(a, b); \
1145 //---------------------------------------------------------------------------
1147 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1148 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1149 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1152 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1153 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1156 wxPyBeginBlockThreads(); \
1157 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1158 PyObject* obj = wxPyMake_wxObject(a); \
1159 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1162 wxPyEndBlockThreads(); \
1164 PCLASS::CBNAME(a, b, c, d, e, f); \
1166 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1168 PCLASS::CBNAME(a, b, c, d, e, f); \
1171 //---------------------------------------------------------------------------
1173 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1174 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1175 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1178 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1179 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1181 wxPyBeginBlockThreads(); \
1182 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1183 PyObject* obj = wxPyMake_wxObject(a); \
1184 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1187 wxPyEndBlockThreads(); \
1189 PCLASS::CBNAME(a, b, c, d, e); \
1191 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1193 PCLASS::CBNAME(a, b, c, d, e); \
1196 //---------------------------------------------------------------------------
1198 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1199 void CBNAME(double a, double b, int c); \
1200 void base_##CBNAME(double a, double b, int c)
1203 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1204 void CLASS::CBNAME(double a, double b, int c) { \
1206 wxPyBeginBlockThreads(); \
1207 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1208 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1209 wxPyEndBlockThreads(); \
1211 PCLASS::CBNAME(a, b, c); \
1213 void CLASS::base_##CBNAME(double a, double b, int c) { \
1214 PCLASS::CBNAME(a, b, c); \
1217 //---------------------------------------------------------------------------
1219 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1220 void CBNAME(bool a, double b, double c, int d); \
1221 void base_##CBNAME(bool a, double b, double c, int d)
1224 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1225 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1227 wxPyBeginBlockThreads(); \
1228 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1229 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1230 wxPyEndBlockThreads(); \
1232 PCLASS::CBNAME(a, b, c, d); \
1234 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1235 PCLASS::CBNAME(a, b, c, d); \
1238 //---------------------------------------------------------------------------
1239 //---------------------------------------------------------------------------
1241 #define DEC_PYCALLBACK__STRING(CBNAME) \
1242 void CBNAME(const wxString& a); \
1243 void base_##CBNAME(const wxString& a)
1245 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1246 void CLASS::CBNAME(const wxString& a) { \
1248 wxPyBeginBlockThreads(); \
1249 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1250 PyObject* s = wx2PyString(a); \
1251 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1254 wxPyEndBlockThreads(); \
1256 PCLASS::CBNAME(a); \
1258 void CLASS::base_##CBNAME(const wxString& a) { \
1259 PCLASS::CBNAME(a); \
1262 //---------------------------------------------------------------------------
1264 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1265 bool CBNAME(const wxString& a); \
1266 bool base_##CBNAME(const wxString& a)
1268 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1269 bool CLASS::CBNAME(const wxString& a) { \
1272 wxPyBeginBlockThreads(); \
1273 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1274 PyObject* s = wx2PyString(a); \
1275 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1278 wxPyEndBlockThreads(); \
1280 rval = PCLASS::CBNAME(a); \
1283 bool CLASS::base_##CBNAME(const wxString& a) { \
1284 return PCLASS::CBNAME(a); \
1287 //---------------------------------------------------------------------------
1289 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1290 bool CBNAME(const wxString& a)
1292 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1293 bool CLASS::CBNAME(const wxString& a) { \
1295 wxPyBeginBlockThreads(); \
1296 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1297 PyObject* s = wx2PyString(a); \
1298 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1301 wxPyEndBlockThreads(); \
1305 //---------------------------------------------------------------------------
1307 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1308 wxString CBNAME(const wxString& a)
1310 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1311 wxString CLASS::CBNAME(const wxString& a) { \
1313 wxPyBeginBlockThreads(); \
1314 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1316 PyObject* s = wx2PyString(a); \
1317 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1320 rval = Py2wxString(ro); \
1324 wxPyEndBlockThreads(); \
1328 //---------------------------------------------------------------------------
1330 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1331 wxString CBNAME(const wxString& a); \
1332 wxString base_##CBNAME(const wxString& a)
1334 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1335 wxString CLASS::CBNAME(const wxString& a) { \
1338 wxPyBeginBlockThreads(); \
1339 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1341 PyObject* s = wx2PyString(a); \
1342 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1345 rval = Py2wxString(ro); \
1350 rval = PCLASS::CBNAME(a); \
1351 wxPyEndBlockThreads(); \
1355 //---------------------------------------------------------------------------
1357 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1358 wxString CBNAME(const wxString& a,int b)
1360 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1361 wxString CLASS::CBNAME(const wxString& a,int b) { \
1363 wxPyBeginBlockThreads(); \
1364 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1366 PyObject* s = wx2PyString(a); \
1367 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1370 rval = Py2wxString(ro); \
1374 wxPyEndBlockThreads(); \
1378 //---------------------------------------------------------------------------
1380 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1381 bool CBNAME(const wxString& a, const wxString& b); \
1382 bool base_##CBNAME(const wxString& a, const wxString& b)
1384 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1385 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1388 wxPyBeginBlockThreads(); \
1389 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1390 PyObject* s1 = wx2PyString(a); \
1391 PyObject* s2 = wx2PyString(b); \
1392 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1396 wxPyEndBlockThreads(); \
1398 rval = PCLASS::CBNAME(a, b); \
1401 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1402 return PCLASS::CBNAME(a, b); \
1405 //---------------------------------------------------------------------------
1407 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1408 wxString CBNAME(); \
1409 wxString base_##CBNAME()
1411 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1412 wxString CLASS::CBNAME() { \
1415 wxPyBeginBlockThreads(); \
1416 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1418 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1420 rval = Py2wxString(ro); \
1424 wxPyEndBlockThreads(); \
1426 rval = PCLASS::CBNAME(); \
1429 wxString CLASS::base_##CBNAME() { \
1430 return PCLASS::CBNAME(); \
1433 //---------------------------------------------------------------------------
1435 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1436 wxString CBNAME() const; \
1437 wxString base_##CBNAME() const;
1439 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1440 wxString CLASS::CBNAME() const { \
1443 wxPyBeginBlockThreads(); \
1444 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1446 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1448 rval = Py2wxString(ro); \
1452 wxPyEndBlockThreads(); \
1454 rval = PCLASS::CBNAME(); \
1457 wxString CLASS::base_##CBNAME() const { \
1458 return PCLASS::CBNAME(); \
1461 //---------------------------------------------------------------------------
1463 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1466 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1467 wxString CLASS::CBNAME() { \
1469 wxPyBeginBlockThreads(); \
1470 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1472 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1474 rval = Py2wxString(ro); \
1478 wxPyEndBlockThreads(); \
1482 //---------------------------------------------------------------------------
1484 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1485 wxString CBNAME() const;
1487 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1488 wxString CLASS::CBNAME() const { \
1490 wxPyBeginBlockThreads(); \
1491 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1493 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1495 rval = Py2wxString(ro); \
1499 wxPyEndBlockThreads(); \
1503 //---------------------------------------------------------------------------
1505 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1506 bool CBNAME(const wxHtmlTag& a)
1509 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1510 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1512 wxPyBeginBlockThreads(); \
1513 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1514 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1515 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1518 wxPyEndBlockThreads(); \
1522 //---------------------------------------------------------------------------
1524 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1525 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1526 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1528 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1529 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1531 wxPyBeginBlockThreads(); \
1532 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1533 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1534 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1537 wxPyEndBlockThreads(); \
1539 PCLASS::CBNAME(cell, x, y); \
1541 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1542 PCLASS::CBNAME(cell, x, y); \
1546 //---------------------------------------------------------------------------
1548 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1549 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1550 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1552 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1553 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1555 wxPyBeginBlockThreads(); \
1556 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1557 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1558 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1559 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1563 wxPyEndBlockThreads(); \
1565 PCLASS::CBNAME(cell, x, y, e); \
1567 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1568 PCLASS::CBNAME(cell, x, y, e); \
1573 //---------------------------------------------------------------------------
1575 #define DEC_PYCALLBACK___pure(CBNAME) \
1579 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1580 void CLASS::CBNAME() { \
1581 wxPyBeginBlockThreads(); \
1582 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1583 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1584 wxPyEndBlockThreads(); \
1587 //---------------------------------------------------------------------------
1589 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1593 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1594 wxSize CLASS::CBNAME() { \
1595 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1597 wxPyBeginBlockThreads(); \
1598 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1601 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1603 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1605 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1606 PyObject* o1 = PySequence_GetItem(ro, 0); \
1607 PyObject* o2 = PySequence_GetItem(ro, 1); \
1608 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1609 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1611 PyErr_SetString(PyExc_TypeError, errmsg); \
1616 PyErr_SetString(PyExc_TypeError, errmsg); \
1621 wxPyEndBlockThreads(); \
1625 //---------------------------------------------------------------------------
1627 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1628 bool CBNAME(wxWindow* a); \
1629 bool base_##CBNAME(wxWindow* a)
1632 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1633 bool CLASS::CBNAME(wxWindow* a) { \
1636 wxPyBeginBlockThreads(); \
1637 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1638 PyObject* obj = wxPyMake_wxObject(a); \
1639 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1642 wxPyEndBlockThreads(); \
1644 rval = PCLASS::CBNAME(a); \
1647 bool CLASS::base_##CBNAME(wxWindow* a) { \
1648 return PCLASS::CBNAME(a); \
1651 //---------------------------------------------------------------------------
1653 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1654 bool CBNAME(wxWindow* a, wxDC& b); \
1655 bool base_##CBNAME(wxWindow* a, wxDC& b)
1658 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1659 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1662 wxPyBeginBlockThreads(); \
1663 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1664 PyObject* win = wxPyMake_wxObject(a); \
1665 PyObject* dc = wxPyMake_wxObject(&b); \
1666 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1670 wxPyEndBlockThreads(); \
1672 rval = PCLASS::CBNAME(a, b); \
1675 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1676 return PCLASS::CBNAME(a, b); \
1679 //---------------------------------------------------------------------------
1681 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1682 void CBNAME(wxWindowBase* a); \
1683 void base_##CBNAME(wxWindowBase* a)
1686 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1687 void CLASS::CBNAME(wxWindowBase* a) { \
1689 wxPyBeginBlockThreads(); \
1690 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1691 PyObject* obj = wxPyMake_wxObject(a); \
1692 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1695 wxPyEndBlockThreads(); \
1697 PCLASS::CBNAME(a); \
1699 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1700 PCLASS::CBNAME(a); \
1703 //---------------------------------------------------------------------------
1705 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1707 bool base_##CBNAME()
1710 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1711 bool CLASS::CBNAME() { \
1714 wxPyBeginBlockThreads(); \
1715 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1716 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1717 wxPyEndBlockThreads(); \
1719 rval = PCLASS::CBNAME(); \
1722 bool CLASS::base_##CBNAME() { \
1723 return PCLASS::CBNAME(); \
1726 //---------------------------------------------------------------------------
1728 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1729 bool CBNAME() const; \
1730 bool base_##CBNAME() const
1733 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1734 bool CLASS::CBNAME() const { \
1737 wxPyBeginBlockThreads(); \
1738 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1739 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1740 wxPyEndBlockThreads(); \
1742 rval = PCLASS::CBNAME(); \
1745 bool CLASS::base_##CBNAME() const { \
1746 return PCLASS::CBNAME(); \
1749 //---------------------------------------------------------------------------
1751 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1752 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1753 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1756 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1757 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1760 wxPyBeginBlockThreads(); \
1761 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1762 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1763 wxPyEndBlockThreads(); \
1765 rval = PCLASS::CBNAME(a, b, c); \
1766 return (wxDragResult)rval; \
1768 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1769 return PCLASS::CBNAME(a, b, c); \
1772 //---------------------------------------------------------------------------
1774 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1775 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1777 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1778 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1779 wxPyBeginBlockThreads(); \
1781 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1783 PyObject* obj = wxPyMake_wxObject(&a); \
1784 PyObject* s = wx2PyString(b); \
1785 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1788 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1794 wxPyEndBlockThreads(); \
1798 //---------------------------------------------------------------------------
1800 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1801 bool CBNAME(wxDragResult a); \
1802 bool base_##CBNAME(wxDragResult a)
1805 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1806 bool CLASS::CBNAME(wxDragResult a) { \
1809 wxPyBeginBlockThreads(); \
1810 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1811 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1812 wxPyEndBlockThreads(); \
1814 rval = PCLASS::CBNAME(a); \
1817 bool CLASS::base_##CBNAME(wxDragResult a) { \
1818 return PCLASS::CBNAME(a); \
1821 //---------------------------------------------------------------------------
1823 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1824 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1827 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1828 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1829 wxPyBeginBlockThreads(); \
1831 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1832 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1833 wxPyEndBlockThreads(); \
1834 return (wxDragResult)rval; \
1837 //---------------------------------------------------------------------------
1839 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1840 bool CBNAME(int a, int b, const wxString& c)
1842 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1843 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1845 wxPyBeginBlockThreads(); \
1846 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1847 PyObject* s = wx2PyString(c); \
1848 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1851 wxPyEndBlockThreads(); \
1855 //---------------------------------------------------------------------------
1857 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1859 size_t base_##CBNAME()
1862 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1863 size_t CLASS::CBNAME() { \
1866 wxPyBeginBlockThreads(); \
1867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1868 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1869 wxPyEndBlockThreads(); \
1871 rval = PCLASS::CBNAME(); \
1874 size_t CLASS::base_##CBNAME() { \
1875 return PCLASS::CBNAME(); \
1878 //---------------------------------------------------------------------------
1880 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1881 size_t CBNAME() const; \
1882 size_t base_##CBNAME() const
1885 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1886 size_t CLASS::CBNAME() const { \
1889 wxPyBeginBlockThreads(); \
1890 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1891 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1892 wxPyEndBlockThreads(); \
1894 rval = PCLASS::CBNAME(); \
1897 size_t CLASS::base_##CBNAME() const { \
1898 return PCLASS::CBNAME(); \
1901 //---------------------------------------------------------------------------
1903 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1904 wxDataFormat CBNAME(size_t a); \
1905 wxDataFormat base_##CBNAME(size_t a)
1908 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1909 wxDataFormat CLASS::CBNAME(size_t a) { \
1910 wxDataFormat rval=0; \
1912 wxPyBeginBlockThreads(); \
1913 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1915 wxDataFormat* ptr; \
1916 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1918 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1923 wxPyEndBlockThreads(); \
1925 rval = PCLASS::CBNAME(a); \
1928 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1929 return PCLASS::CBNAME(a); \
1932 //---------------------------------------------------------------------------
1934 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1935 void CBNAME(const Type& a); \
1936 void base_##CBNAME(const Type& a)
1939 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1940 void CLASS::CBNAME(const Type& a) { \
1942 wxPyBeginBlockThreads(); \
1943 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1944 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1945 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1948 wxPyEndBlockThreads(); \
1950 PCLASS::CBNAME(a); \
1952 void CLASS::base_##CBNAME(const Type& a) { \
1953 PCLASS::CBNAME(a); \
1957 //---------------------------------------------------------------------------
1959 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1960 void CBNAME(Type& a); \
1961 void base_##CBNAME(Type& a)
1964 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1965 void CLASS::CBNAME(Type& a) { \
1967 wxPyBeginBlockThreads(); \
1968 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1969 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1970 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1973 wxPyEndBlockThreads(); \
1975 PCLASS::CBNAME(a); \
1977 void CLASS::base_##CBNAME(Type& a) { \
1978 PCLASS::CBNAME(a); \
1981 //---------------------------------------------------------------------------
1983 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1984 bool CBNAME(Type& a); \
1985 bool base_##CBNAME(Type& a)
1988 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1989 bool CLASS::CBNAME(Type& a) { \
1992 wxPyBeginBlockThreads(); \
1993 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1994 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1995 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1998 wxPyEndBlockThreads(); \
2000 rv = PCLASS::CBNAME(a); \
2003 bool CLASS::base_##CBNAME(Type& a) { \
2004 return PCLASS::CBNAME(a); \
2007 //---------------------------------------------------------------------------
2009 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2010 bool CBNAME(Type& a)
2013 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2014 bool CLASS::CBNAME(Type& a) { \
2016 wxPyBeginBlockThreads(); \
2017 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2018 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2019 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2022 wxPyEndBlockThreads(); \
2026 //---------------------------------------------------------------------------
2028 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2029 wxString CBNAME(long a, long b) const; \
2030 wxString base_##CBNAME(long a, long b) const
2032 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2033 wxString CLASS::CBNAME(long a, long b) const { \
2036 wxPyBeginBlockThreads(); \
2037 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2039 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2041 rval = Py2wxString(ro); \
2045 wxPyEndBlockThreads(); \
2047 rval = PCLASS::CBNAME(a,b); \
2050 wxString CLASS::base_##CBNAME(long a, long b) const { \
2051 return PCLASS::CBNAME(a,b); \
2054 //---------------------------------------------------------------------------
2056 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2057 int CBNAME(long a) const; \
2058 int base_##CBNAME(long a) const
2061 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2062 int CLASS::CBNAME(long a) const { \
2065 wxPyBeginBlockThreads(); \
2066 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2068 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2070 rval = PyInt_AsLong(ro); \
2074 wxPyEndBlockThreads(); \
2076 rval = PCLASS::CBNAME(a); \
2079 int CLASS::base_##CBNAME(long a) const { \
2080 return PCLASS::CBNAME(a); \
2084 //---------------------------------------------------------------------------
2086 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2087 wxListItemAttr* CBNAME(long a) const; \
2088 wxListItemAttr* base_##CBNAME(long a) const
2091 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2092 wxListItemAttr *CLASS::CBNAME(long a) const { \
2093 wxListItemAttr *rval = NULL; \
2095 wxPyBeginBlockThreads(); \
2096 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2098 wxListItemAttr* ptr; \
2099 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2101 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2106 wxPyEndBlockThreads(); \
2108 rval = PCLASS::CBNAME(a); \
2111 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2112 return PCLASS::CBNAME(a); \
2115 //---------------------------------------------------------------------------
2117 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2118 bool CBNAME(wxMouseEvent& e); \
2119 bool base_##CBNAME(wxMouseEvent& e)
2121 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2122 bool CLASS::CBNAME(wxMouseEvent& e) { \
2125 wxPyBeginBlockThreads(); \
2126 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2128 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2129 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2131 rval = PyInt_AsLong(ro); \
2136 wxPyEndBlockThreads(); \
2138 return PCLASS::CBNAME(e); \
2141 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2142 return PCLASS::CBNAME(e); \
2146 //---------------------------------------------------------------------------
2148 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2149 wxWizardPage* CBNAME() const
2151 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2152 wxWizardPage* CLASS::CBNAME() const { \
2153 wxWizardPage* rv = NULL; \
2154 wxPyBeginBlockThreads(); \
2155 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2157 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2159 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2163 wxPyEndBlockThreads(); \
2167 //---------------------------------------------------------------------------
2169 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2170 wxBitmap CBNAME() const
2172 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2173 wxBitmap CLASS::CBNAME() const { \
2175 wxPyBeginBlockThreads(); \
2176 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2179 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2181 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2186 wxPyEndBlockThreads(); \
2190 //---------------------------------------------------------------------------
2192 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2195 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2196 wxObject* CLASS::CBNAME() { \
2197 wxObject* rv = NULL; \
2198 wxPyBeginBlockThreads(); \
2199 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2201 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2203 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2207 wxPyEndBlockThreads(); \
2211 //---------------------------------------------------------------------------
2213 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2214 wxObject* CBNAME(const wxString& a)
2216 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2217 wxObject* CLASS::CBNAME(const wxString& a) { \
2218 wxObject* rv = NULL; \
2219 wxPyBeginBlockThreads(); \
2220 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2221 PyObject* so = wx2PyString(a); \
2223 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2225 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2230 wxPyEndBlockThreads(); \
2234 //---------------------------------------------------------------------------
2236 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2237 bool CBNAME(wxXmlNode* a)
2240 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2241 bool CLASS::CBNAME(wxXmlNode* a) { \
2243 wxPyBeginBlockThreads(); \
2244 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2245 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2246 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2249 wxPyEndBlockThreads(); \
2253 //---------------------------------------------------------------------------
2255 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2256 wxCoord CBNAME(size_t a) const
2259 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2260 wxCoord CLASS::CBNAME(size_t a) const { \
2263 wxPyBeginBlockThreads(); \
2264 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2265 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2267 wxPyEndBlockThreads(); \
2271 //---------------------------------------------------------------------------
2273 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2274 void CBNAME(size_t a, size_t b) const; \
2275 void base_##CBNAME(size_t a, size_t b) const
2278 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2279 void CLASS::CBNAME(size_t a, size_t b) const { \
2281 wxPyBeginBlockThreads(); \
2282 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2283 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2284 wxPyEndBlockThreads(); \
2286 PCLASS::CBNAME(a,b); \
2288 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2289 PCLASS::CBNAME(a,b); \
2292 //---------------------------------------------------------------------------
2294 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2295 wxCoord CBNAME() const; \
2296 wxCoord base_##CBNAME() const
2299 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2300 wxCoord CLASS::CBNAME() const { \
2303 wxPyBeginBlockThreads(); \
2304 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2305 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2306 wxPyEndBlockThreads(); \
2308 rval = PCLASS::CBNAME(); \
2311 wxCoord CLASS::base_##CBNAME() const { \
2312 return PCLASS::CBNAME(); \
2315 //---------------------------------------------------------------------------
2317 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2318 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2321 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2322 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2324 wxPyBeginBlockThreads(); \
2325 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2326 PyObject* obj = wxPyMake_wxObject(&a); \
2327 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2328 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2331 wxPyEndBlockThreads(); \
2334 //---------------------------------------------------------------------------
2336 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2337 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2338 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2341 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2342 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2344 wxPyBeginBlockThreads(); \
2345 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2346 PyObject* obj = wxPyMake_wxObject(&a); \
2347 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2348 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2351 wxPyEndBlockThreads(); \
2353 PCLASS::CBNAME(a,b,c); \
2355 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2356 PCLASS::CBNAME(a,b,c); \
2359 //---------------------------------------------------------------------------
2362 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2363 wxString CBNAME(size_t a) const; \
2364 wxString base_##CBNAME(size_t a) const
2366 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2367 wxString CLASS::CBNAME(size_t a) const { \
2370 wxPyBeginBlockThreads(); \
2371 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2373 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2375 rval = Py2wxString(ro); \
2379 wxPyEndBlockThreads(); \
2381 rval = PCLASS::CBNAME(a); \
2384 wxString CLASS::base_##CBNAME(size_t a) const { \
2385 return PCLASS::CBNAME(a); \
2388 //---------------------------------------------------------------------------
2390 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2391 wxString CBNAME(size_t a) const
2393 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2394 wxString CLASS::CBNAME(size_t a) const { \
2397 wxPyBeginBlockThreads(); \
2398 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2400 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2402 rval = Py2wxString(ro); \
2406 wxPyEndBlockThreads(); \
2410 //---------------------------------------------------------------------------