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
);
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(bool init
);
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()
149 //---------------------------------------------------------------------------
150 // These are helpers used by the typemaps
152 #ifndef wxPyUSE_EXPORTED_API
154 wxString
* wxString_in_helper(PyObject
* source
);
156 byte
* byte_LIST_helper(PyObject
* source
);
157 int* int_LIST_helper(PyObject
* source
);
158 long* long_LIST_helper(PyObject
* source
);
159 char** string_LIST_helper(PyObject
* source
);
160 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
161 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
162 wxString
* wxString_LIST_helper(PyObject
* source
);
163 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
164 wxPen
** wxPen_LIST_helper(PyObject
* source
);
166 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
167 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
168 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
169 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
170 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
171 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
174 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
175 bool wxColour_typecheck(PyObject
* source
);
179 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
181 // If source is an object instance then it may already be the right type
182 if (wxPySwigInstance_Check(source
)) {
184 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
189 // otherwise a 2-tuple of integers is expected
190 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
191 PyObject
* o1
= PySequence_GetItem(source
, 0);
192 PyObject
* o2
= PySequence_GetItem(source
, 1);
193 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
198 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
206 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
207 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
213 // Other helpful stuff
214 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
215 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
217 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
218 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
220 #endif // wxPyUSE_EXPORTED_API
222 //---------------------------------------------------------------------------
224 #if PYTHON_API_VERSION < 1009
225 #define PySequence_Fast_GET_ITEM(o, i) \
226 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
229 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
230 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
231 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
233 //---------------------------------------------------------------------------
235 #ifndef wxPyUSE_EXPORTED_API
237 class wxPyCallback
: public wxObject
{
238 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
240 wxPyCallback(PyObject
* func
);
241 wxPyCallback(const wxPyCallback
& other
);
244 void EventThunker(wxEvent
& event
);
249 #endif // wxPyUSE_EXPORTED_API
250 //---------------------------------------------------------------------------
251 //---------------------------------------------------------------------------
252 // These Event classes can be derived from in Python and passed through the
253 // event system without loosing anything. They do this by keeping a reference
254 // to themselves and some special case handling in wxPyCallback::EventThunker.
258 class wxPyEvtSelfRef
{
263 void SetSelf(PyObject
* self
, bool clone
=False
);
264 PyObject
* GetSelf() const;
265 bool GetCloned() const { return m_cloned
; }
273 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
274 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
276 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
277 wxPyEvent(const wxPyEvent
& evt
);
280 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
284 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
285 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
287 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
288 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
291 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
296 //----------------------------------------------------------------------
297 // Forward decalre a few things used in the exported API
298 class wxPyClientData
;
300 class wxPyOORClientData
;
301 class wxPyCBInputStream
;
303 void wxPyClientData_dtor(wxPyClientData
* self
);
304 void wxPyUserData_dtor(wxPyUserData
* self
);
305 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
306 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
309 //---------------------------------------------------------------------------
310 // Export a C API in a struct. Other modules will be able to load this from
311 // the wx.core module and will then have safe access to these functions, even if
312 // in another shared library.
314 class wxPyCallbackHelper
;
315 struct swig_type_info
;
316 struct swig_const_info
;
319 // Make SunCC happy and make typedef's for these that are extern "C"
320 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
321 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
322 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
323 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
324 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
325 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
326 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
327 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
328 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
329 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
330 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
331 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
332 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
333 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
334 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
335 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
336 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
341 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
342 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
343 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
344 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
345 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
346 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
347 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
348 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
349 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
350 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
351 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
352 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
353 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
354 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
355 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
356 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
357 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
360 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
361 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
362 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
363 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
365 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
366 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
367 void (*p_wxPyBeginBlockThreads
)();
368 void (*p_wxPyEndBlockThreads
)();
370 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
372 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
373 wxString (*p_Py2wxString
)(PyObject
* source
);
374 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
376 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
377 int* (*p_int_LIST_helper
)(PyObject
* source
);
378 long* (*p_long_LIST_helper
)(PyObject
* source
);
379 char** (*p_string_LIST_helper
)(PyObject
* source
);
380 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
381 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
382 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
383 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
385 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
386 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
387 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
388 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
389 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
390 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
393 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
394 bool (*p_wxColour_typecheck
)(PyObject
* source
);
396 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
397 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
398 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
399 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
400 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
402 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
403 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
404 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
405 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
406 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
407 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
408 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
410 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
411 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
412 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
414 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
416 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
417 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
421 #ifdef wxPyUSE_EXPORTED_API
422 // Notice that this is static, not extern. This is by design, each module
423 // needs one, but doesn't have to use it.
424 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
425 #endif // wxPyUSE_EXPORTED_API
427 //---------------------------------------------------------------------------
429 // A wxObject that holds a reference to a Python object
430 class wxPyUserData
: public wxObject
{
432 wxPyUserData(PyObject
* obj
) {
438 #ifdef wxPyUSE_EXPORTED_API
439 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
441 wxPyUserData_dtor(this);
448 // A wxClientData that holds a refernece to a Python object
449 class wxPyClientData
: public wxClientData
{
451 wxPyClientData(PyObject
* obj
) {
457 #ifdef wxPyUSE_EXPORTED_API
458 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
460 wxPyClientData_dtor(this);
467 // Just like wxPyClientData, except when this object is destroyed it does some
468 // OOR magic on the Python Object.
469 class wxPyOORClientData
: public wxPyClientData
{
471 wxPyOORClientData(PyObject
* obj
)
472 : wxPyClientData(obj
) {}
474 ~wxPyOORClientData() {
475 #ifdef wxPyUSE_EXPORTED_API
476 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
478 wxPyOORClientData_dtor(this);
484 //---------------------------------------------------------------------------
485 // This class holds an instance of a Python Shadow Class object and assists
486 // with looking up and invoking Python callback methods from C++ virtual
487 // method redirections. For all classes which have virtuals which should be
488 // overridable in wxPython, a new subclass is created that contains a
489 // wxPyCallbackHelper.
492 class wxPyCallbackHelper
{
494 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
496 wxPyCallbackHelper() {
503 ~wxPyCallbackHelper() {
504 #ifdef wxPyUSE_EXPORTED_API
505 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
507 wxPyCBH_delete(this);
511 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
512 bool findCallback(const char* name
) const;
513 int callCallback(PyObject
* argTuple
) const;
514 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
515 PyObject
* GetLastFound() const { return m_lastFound
; }
520 PyObject
* m_lastFound
;
523 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
527 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
528 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
529 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
530 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
531 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
536 //---------------------------------------------------------------------------
538 // This is used in C++ classes that need to be able to make callback to
539 // "overloaded" python methods
542 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
543 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
545 private: wxPyCallbackHelper m_myInst
548 //---------------------------------------------------------------------------
549 // The wxPythonApp class
552 wxPYAPP_ASSERT_SUPPRESS
= 1,
553 wxPYAPP_ASSERT_EXCEPTION
= 2,
554 wxPYAPP_ASSERT_DIALOG
= 4,
555 wxPYAPP_ASSERT_LOG
= 8
558 class wxPyApp
: public wxApp
560 DECLARE_ABSTRACT_CLASS(wxPyApp
);
568 int GetAssertMode() { return m_assertMode
; }
569 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
571 virtual bool OnInitGui();
572 virtual int OnExit();
574 virtual void OnAssert(const wxChar
*file
,
579 // virtual int FilterEvent(wxEvent& event); // This one too????
582 static bool GetMacSupportPCMenuShortcuts();
583 static long GetMacAboutMenuItemId();
584 static long GetMacPreferencesMenuItemId();
585 static long GetMacExitMenuItemId();
586 static wxString
GetMacHelpMenuTitleName();
588 static void SetMacSupportPCMenuShortcuts(bool val
);
589 static void SetMacAboutMenuItemId(long val
);
590 static void SetMacPreferencesMenuItemId(long val
);
591 static void SetMacExitMenuItemId(long val
);
592 static void SetMacHelpMenuTitleName(const wxString
& val
);
595 void _BootstrapApp();
597 // implementation only
598 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
602 bool m_startupComplete
;
605 extern wxPyApp
*wxPythonApp
;
608 //----------------------------------------------------------------------
609 // These macros are used to implement the virtual methods that should
610 // redirect to a Python method if one exists. The names designate the
611 // return type, if any, as well as any parameter types.
612 //---------------------------------------------------------------------------
614 #define DEC_PYCALLBACK__(CBNAME) \
619 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
620 void CLASS::CBNAME() { \
622 wxPyBeginBlockThreads(); \
623 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
624 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
625 wxPyEndBlockThreads(); \
629 void CLASS::base_##CBNAME() { \
633 //---------------------------------------------------------------------------
635 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
636 bool CBNAME(int a, int b); \
637 bool base_##CBNAME(int a, int b)
640 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
641 bool CLASS::CBNAME(int a, int b) { \
642 bool rval=False, found; \
643 wxPyBeginBlockThreads(); \
644 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
645 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
646 wxPyEndBlockThreads(); \
648 rval = PCLASS::CBNAME(a,b); \
651 bool CLASS::base_##CBNAME(int a, int b) { \
652 return PCLASS::CBNAME(a,b); \
655 //---------------------------------------------------------------------------
657 #define DEC_PYCALLBACK_VOID_(CBNAME) \
662 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
663 void CLASS::CBNAME() { \
665 wxPyBeginBlockThreads(); \
666 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
667 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
668 wxPyEndBlockThreads(); \
672 void CLASS::base_##CBNAME() { \
676 //---------------------------------------------------------------------------
678 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
679 void CBNAME(int a, int b); \
680 void base_##CBNAME(int a, int b)
683 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
684 void CLASS::CBNAME(int a, int b) { \
686 wxPyBeginBlockThreads(); \
687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
688 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
689 wxPyEndBlockThreads(); \
691 PCLASS::CBNAME(a,b); \
693 void CLASS::base_##CBNAME(int a, int b) { \
694 PCLASS::CBNAME(a,b); \
697 //---------------------------------------------------------------------------
699 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
700 void CBNAME(int a); \
701 void base_##CBNAME(int a)
704 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
705 void CLASS::CBNAME(int a) { \
707 wxPyBeginBlockThreads(); \
708 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
709 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
710 wxPyEndBlockThreads(); \
714 void CLASS::base_##CBNAME(int a) { \
718 //---------------------------------------------------------------------------
720 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
721 void CBNAME(int a, int b, int c, int d); \
722 void base_##CBNAME(int a, int b, int c, int d)
725 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
726 void CLASS::CBNAME(int a, int b, int c, int d) { \
728 wxPyBeginBlockThreads(); \
729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
730 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
731 wxPyEndBlockThreads(); \
733 PCLASS::CBNAME(a,b,c,d); \
735 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
736 PCLASS::CBNAME(a,b,c,d); \
739 //---------------------------------------------------------------------------
740 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
741 void CBNAME(int a, int b, int c, int d, int e); \
742 void base_##CBNAME(int a, int b, int c, int d, int e)
745 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
746 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
748 wxPyBeginBlockThreads(); \
749 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
750 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
751 wxPyEndBlockThreads(); \
753 PCLASS::CBNAME(a,b,c,d,e); \
755 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
756 PCLASS::CBNAME(a,b,c,d,e); \
759 //---------------------------------------------------------------------------
761 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
762 void CBNAME(int* a, int* b) const; \
763 void base_##CBNAME(int* a, int* b) const
766 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
767 void CLASS::CBNAME(int* a, int* b) const { \
768 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
770 wxPyBeginBlockThreads(); \
771 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
773 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
775 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
776 PyObject* o1 = PySequence_GetItem(ro, 0); \
777 PyObject* o2 = PySequence_GetItem(ro, 1); \
778 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
779 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
782 PyErr_SetString(PyExc_TypeError, errmsg); \
787 PyErr_SetString(PyExc_TypeError, errmsg); \
792 wxPyEndBlockThreads(); \
794 PCLASS::CBNAME(a,b); \
796 void CLASS::base_##CBNAME(int* a, int* b) const { \
797 PCLASS::CBNAME(a,b); \
801 //---------------------------------------------------------------------------
803 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
804 wxSize CBNAME() const; \
805 wxSize base_##CBNAME() const
808 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
809 wxSize CLASS::CBNAME() const { \
810 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
811 bool found; wxSize rval(0,0); \
812 wxPyBeginBlockThreads(); \
813 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
815 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
817 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
818 PyObject* o1 = PySequence_GetItem(ro, 0); \
819 PyObject* o2 = PySequence_GetItem(ro, 1); \
820 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
821 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
824 PyErr_SetString(PyExc_TypeError, errmsg); \
829 PyErr_SetString(PyExc_TypeError, errmsg); \
834 wxPyEndBlockThreads(); \
836 return PCLASS::CBNAME(); \
840 wxSize CLASS::base_##CBNAME() const { \
841 return PCLASS::CBNAME(); \
845 //---------------------------------------------------------------------------
847 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
848 bool CBNAME(bool a); \
849 bool base_##CBNAME(bool a)
852 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
853 bool CLASS::CBNAME(bool a) { \
854 bool rval=False, found; \
855 wxPyBeginBlockThreads(); \
856 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
857 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
858 wxPyEndBlockThreads(); \
860 rval = PCLASS::CBNAME(a); \
863 bool CLASS::base_##CBNAME(bool a) { \
864 return PCLASS::CBNAME(a); \
867 //---------------------------------------------------------------------------
869 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
870 bool CBNAME(int a); \
871 bool base_##CBNAME(int a)
874 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
875 bool CLASS::CBNAME(int a) { \
876 bool rval=False, found; \
877 wxPyBeginBlockThreads(); \
878 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
879 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
880 wxPyEndBlockThreads(); \
882 rval = PCLASS::CBNAME(a); \
885 bool CLASS::base_##CBNAME(int a) { \
886 return PCLASS::CBNAME(a); \
889 //---------------------------------------------------------------------------
891 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
895 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
896 bool CLASS::CBNAME(int a) { \
898 wxPyBeginBlockThreads(); \
899 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
900 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
902 wxPyEndBlockThreads(); \
907 //---------------------------------------------------------------------------
909 #define DEC_PYCALLBACK__DC(CBNAME) \
910 void CBNAME(wxDC& a); \
911 void base_##CBNAME(wxDC& a)
914 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
915 void CLASS::CBNAME(wxDC& a) { \
917 wxPyBeginBlockThreads(); \
918 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
919 PyObject* obj = wxPyMake_wxObject(&a); \
920 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
923 wxPyEndBlockThreads(); \
927 void CLASS::base_##CBNAME(wxDC& a) { \
933 //---------------------------------------------------------------------------
935 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
936 void CBNAME(wxDC& a, bool b); \
937 void base_##CBNAME(wxDC& a, bool b)
940 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
941 void CLASS::CBNAME(wxDC& a, bool b) { \
943 wxPyBeginBlockThreads(); \
944 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
945 PyObject* obj = wxPyMake_wxObject(&a); \
946 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
949 wxPyEndBlockThreads(); \
951 PCLASS::CBNAME(a, b); \
953 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
954 PCLASS::CBNAME(a, b); \
957 //---------------------------------------------------------------------------
959 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
960 void CBNAME(wxDC& a, bool b); \
961 void base_##CBNAME(wxDC& a, bool b)
964 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
965 void CLASS::CBNAME(wxDC& a, bool b) { \
967 wxPyBeginBlockThreads(); \
968 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
969 PyObject* obj = wxPyMake_wxObject(&a); \
970 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
973 wxPyEndBlockThreads(); \
975 PCLASS::CBNAME(a, b); \
977 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
978 PCLASS::CBNAME(a, b); \
981 //---------------------------------------------------------------------------
983 #define DEC_PYCALLBACK__2DBL(CBNAME) \
984 void CBNAME(double a, double b); \
985 void base_##CBNAME(double a, double b)
988 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
989 void CLASS::CBNAME(double a, double b) { \
991 wxPyBeginBlockThreads(); \
992 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
993 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
994 wxPyEndBlockThreads(); \
996 PCLASS::CBNAME(a, b); \
998 void CLASS::base_##CBNAME(double a, double b) { \
999 PCLASS::CBNAME(a, b); \
1002 //---------------------------------------------------------------------------
1004 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1005 void CBNAME(double a, double b, int c, int d); \
1006 void base_##CBNAME(double a, double b, int c, int d)
1009 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1010 void CLASS::CBNAME(double a, double b, int c, int d) { \
1012 wxPyBeginBlockThreads(); \
1013 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1014 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1016 wxPyEndBlockThreads(); \
1018 PCLASS::CBNAME(a, b, c, d); \
1020 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1021 PCLASS::CBNAME(a, b, c, d); \
1024 //---------------------------------------------------------------------------
1026 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1027 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1028 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1031 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1032 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1034 wxPyBeginBlockThreads(); \
1035 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1036 PyObject* obj = wxPyMake_wxObject(&a); \
1037 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1040 wxPyEndBlockThreads(); \
1042 PCLASS::CBNAME(a, b, c, d, e, f); \
1044 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1045 PCLASS::CBNAME(a, b, c, d, e, f); \
1048 //---------------------------------------------------------------------------
1050 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1051 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1052 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1055 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1056 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1058 wxPyBeginBlockThreads(); \
1060 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1061 PyObject* obj = wxPyMake_wxObject(&a); \
1062 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1065 wxPyEndBlockThreads(); \
1067 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1070 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1071 return PCLASS::CBNAME(a, b, c, d, e, f); \
1074 //---------------------------------------------------------------------------
1076 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1077 void CBNAME(bool a, double b, double c, int d, int e); \
1078 void base_##CBNAME(bool a, double b, double c, int d, int e)
1081 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1082 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1084 wxPyBeginBlockThreads(); \
1085 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1086 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1088 wxPyEndBlockThreads(); \
1090 PCLASS::CBNAME(a, b, c, d, e); \
1092 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1093 PCLASS::CBNAME(a, b, c, d, e); \
1096 //---------------------------------------------------------------------------
1098 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1099 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1100 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1103 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1104 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1106 wxPyBeginBlockThreads(); \
1107 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1108 PyObject* obj = wxPyMake_wxObject(&a); \
1109 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1112 wxPyEndBlockThreads(); \
1114 PCLASS::CBNAME(a, b, c, d, e); \
1116 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1117 PCLASS::CBNAME(a, b, c, d, e); \
1120 //---------------------------------------------------------------------------
1122 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1123 void CBNAME(wxDC& a, bool b); \
1124 void base_##CBNAME(wxDC& a, bool b)
1127 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1128 void CLASS::CBNAME(wxDC& a, bool b) { \
1130 wxPyBeginBlockThreads(); \
1131 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1132 PyObject* obj = wxPyMake_wxObject(&a); \
1133 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1136 wxPyEndBlockThreads(); \
1138 PCLASS::CBNAME(a, b); \
1140 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1141 PCLASS::CBNAME(a, b); \
1144 //---------------------------------------------------------------------------
1146 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1147 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1148 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1151 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1152 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1155 wxPyBeginBlockThreads(); \
1156 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1157 PyObject* obj = wxPyMake_wxObject(a); \
1158 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1161 wxPyEndBlockThreads(); \
1163 PCLASS::CBNAME(a, b, c, d, e, f); \
1165 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1167 PCLASS::CBNAME(a, b, c, d, e, f); \
1170 //---------------------------------------------------------------------------
1172 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1173 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1174 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1177 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1178 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1180 wxPyBeginBlockThreads(); \
1181 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1182 PyObject* obj = wxPyMake_wxObject(a); \
1183 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1186 wxPyEndBlockThreads(); \
1188 PCLASS::CBNAME(a, b, c, d, e); \
1190 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1192 PCLASS::CBNAME(a, b, c, d, e); \
1195 //---------------------------------------------------------------------------
1197 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1198 void CBNAME(double a, double b, int c); \
1199 void base_##CBNAME(double a, double b, int c)
1202 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1203 void CLASS::CBNAME(double a, double b, int c) { \
1205 wxPyBeginBlockThreads(); \
1206 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1207 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1208 wxPyEndBlockThreads(); \
1210 PCLASS::CBNAME(a, b, c); \
1212 void CLASS::base_##CBNAME(double a, double b, int c) { \
1213 PCLASS::CBNAME(a, b, c); \
1216 //---------------------------------------------------------------------------
1218 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1219 void CBNAME(bool a, double b, double c, int d); \
1220 void base_##CBNAME(bool a, double b, double c, int d)
1223 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1224 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1226 wxPyBeginBlockThreads(); \
1227 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1228 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1229 wxPyEndBlockThreads(); \
1231 PCLASS::CBNAME(a, b, c, d); \
1233 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1234 PCLASS::CBNAME(a, b, c, d); \
1237 //---------------------------------------------------------------------------
1238 //---------------------------------------------------------------------------
1240 #define DEC_PYCALLBACK__STRING(CBNAME) \
1241 void CBNAME(const wxString& a); \
1242 void base_##CBNAME(const wxString& a)
1244 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1245 void CLASS::CBNAME(const wxString& a) { \
1247 wxPyBeginBlockThreads(); \
1248 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1249 PyObject* s = wx2PyString(a); \
1250 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1253 wxPyEndBlockThreads(); \
1255 PCLASS::CBNAME(a); \
1257 void CLASS::base_##CBNAME(const wxString& a) { \
1258 PCLASS::CBNAME(a); \
1261 //---------------------------------------------------------------------------
1263 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1264 bool CBNAME(const wxString& a); \
1265 bool base_##CBNAME(const wxString& a)
1267 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1268 bool CLASS::CBNAME(const wxString& a) { \
1271 wxPyBeginBlockThreads(); \
1272 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1273 PyObject* s = wx2PyString(a); \
1274 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1277 wxPyEndBlockThreads(); \
1279 rval = PCLASS::CBNAME(a); \
1282 bool CLASS::base_##CBNAME(const wxString& a) { \
1283 return PCLASS::CBNAME(a); \
1286 //---------------------------------------------------------------------------
1288 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1289 bool CBNAME(const wxString& a)
1291 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1292 bool CLASS::CBNAME(const wxString& a) { \
1294 wxPyBeginBlockThreads(); \
1295 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1296 PyObject* s = wx2PyString(a); \
1297 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1300 wxPyEndBlockThreads(); \
1304 //---------------------------------------------------------------------------
1306 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1307 wxString CBNAME(const wxString& a)
1309 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1310 wxString CLASS::CBNAME(const wxString& a) { \
1312 wxPyBeginBlockThreads(); \
1313 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1315 PyObject* s = wx2PyString(a); \
1316 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1319 rval = Py2wxString(ro); \
1323 wxPyEndBlockThreads(); \
1327 //---------------------------------------------------------------------------
1329 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1330 wxString CBNAME(const wxString& a); \
1331 wxString base_##CBNAME(const wxString& a)
1333 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1334 wxString CLASS::CBNAME(const wxString& a) { \
1337 wxPyBeginBlockThreads(); \
1338 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1340 PyObject* s = wx2PyString(a); \
1341 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1344 rval = Py2wxString(ro); \
1349 rval = PCLASS::CBNAME(a); \
1350 wxPyEndBlockThreads(); \
1354 //---------------------------------------------------------------------------
1356 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1357 wxString CBNAME(const wxString& a,int b)
1359 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1360 wxString CLASS::CBNAME(const wxString& a,int b) { \
1362 wxPyBeginBlockThreads(); \
1363 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1365 PyObject* s = wx2PyString(a); \
1366 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1369 rval = Py2wxString(ro); \
1373 wxPyEndBlockThreads(); \
1377 //---------------------------------------------------------------------------
1379 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1380 bool CBNAME(const wxString& a, const wxString& b); \
1381 bool base_##CBNAME(const wxString& a, const wxString& b)
1383 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1384 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1387 wxPyBeginBlockThreads(); \
1388 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1389 PyObject* s1 = wx2PyString(a); \
1390 PyObject* s2 = wx2PyString(b); \
1391 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1395 wxPyEndBlockThreads(); \
1397 rval = PCLASS::CBNAME(a, b); \
1400 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1401 return PCLASS::CBNAME(a, b); \
1404 //---------------------------------------------------------------------------
1406 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1407 wxString CBNAME(); \
1408 wxString base_##CBNAME()
1410 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1411 wxString CLASS::CBNAME() { \
1414 wxPyBeginBlockThreads(); \
1415 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1417 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1419 rval = Py2wxString(ro); \
1423 wxPyEndBlockThreads(); \
1425 rval = PCLASS::CBNAME(); \
1428 wxString CLASS::base_##CBNAME() { \
1429 return PCLASS::CBNAME(); \
1432 //---------------------------------------------------------------------------
1434 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1435 wxString CBNAME() const; \
1436 wxString base_##CBNAME() const;
1438 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1439 wxString CLASS::CBNAME() const { \
1442 wxPyBeginBlockThreads(); \
1443 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1445 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1447 rval = Py2wxString(ro); \
1451 wxPyEndBlockThreads(); \
1453 rval = PCLASS::CBNAME(); \
1456 wxString CLASS::base_##CBNAME() const { \
1457 return PCLASS::CBNAME(); \
1460 //---------------------------------------------------------------------------
1462 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1465 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1466 wxString CLASS::CBNAME() { \
1468 wxPyBeginBlockThreads(); \
1469 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1471 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1473 rval = Py2wxString(ro); \
1477 wxPyEndBlockThreads(); \
1481 //---------------------------------------------------------------------------
1483 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1484 wxString CBNAME() const;
1486 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1487 wxString CLASS::CBNAME() const { \
1489 wxPyBeginBlockThreads(); \
1490 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1492 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1494 rval = Py2wxString(ro); \
1498 wxPyEndBlockThreads(); \
1502 //---------------------------------------------------------------------------
1504 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1505 bool CBNAME(const wxHtmlTag& a)
1508 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1509 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1511 wxPyBeginBlockThreads(); \
1512 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1513 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1514 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1517 wxPyEndBlockThreads(); \
1521 //---------------------------------------------------------------------------
1523 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1524 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1525 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1527 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1528 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1530 wxPyBeginBlockThreads(); \
1531 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1532 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1533 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1536 wxPyEndBlockThreads(); \
1538 PCLASS::CBNAME(cell, x, y); \
1540 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1541 PCLASS::CBNAME(cell, x, y); \
1545 //---------------------------------------------------------------------------
1547 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1548 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1549 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1551 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1552 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1554 wxPyBeginBlockThreads(); \
1555 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1556 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1557 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1558 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1562 wxPyEndBlockThreads(); \
1564 PCLASS::CBNAME(cell, x, y, e); \
1566 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1567 PCLASS::CBNAME(cell, x, y, e); \
1572 //---------------------------------------------------------------------------
1574 #define DEC_PYCALLBACK___pure(CBNAME) \
1578 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1579 void CLASS::CBNAME() { \
1580 wxPyBeginBlockThreads(); \
1581 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1582 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1583 wxPyEndBlockThreads(); \
1586 //---------------------------------------------------------------------------
1588 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1592 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1593 wxSize CLASS::CBNAME() { \
1594 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1596 wxPyBeginBlockThreads(); \
1597 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1600 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1602 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1604 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1605 PyObject* o1 = PySequence_GetItem(ro, 0); \
1606 PyObject* o2 = PySequence_GetItem(ro, 1); \
1607 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1608 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1610 PyErr_SetString(PyExc_TypeError, errmsg); \
1615 PyErr_SetString(PyExc_TypeError, errmsg); \
1620 wxPyEndBlockThreads(); \
1624 //---------------------------------------------------------------------------
1626 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1627 bool CBNAME(wxWindow* a); \
1628 bool base_##CBNAME(wxWindow* a)
1631 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1632 bool CLASS::CBNAME(wxWindow* a) { \
1635 wxPyBeginBlockThreads(); \
1636 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1637 PyObject* obj = wxPyMake_wxObject(a); \
1638 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1641 wxPyEndBlockThreads(); \
1643 rval = PCLASS::CBNAME(a); \
1646 bool CLASS::base_##CBNAME(wxWindow* a) { \
1647 return PCLASS::CBNAME(a); \
1650 //---------------------------------------------------------------------------
1652 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1653 bool CBNAME(wxWindow* a, wxDC& b); \
1654 bool base_##CBNAME(wxWindow* a, wxDC& b)
1657 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1658 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1661 wxPyBeginBlockThreads(); \
1662 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1663 PyObject* win = wxPyMake_wxObject(a); \
1664 PyObject* dc = wxPyMake_wxObject(&b); \
1665 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1669 wxPyEndBlockThreads(); \
1671 rval = PCLASS::CBNAME(a, b); \
1674 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1675 return PCLASS::CBNAME(a, b); \
1678 //---------------------------------------------------------------------------
1680 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1681 void CBNAME(wxWindowBase* a); \
1682 void base_##CBNAME(wxWindowBase* a)
1685 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1686 void CLASS::CBNAME(wxWindowBase* a) { \
1688 wxPyBeginBlockThreads(); \
1689 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1690 PyObject* obj = wxPyMake_wxObject(a); \
1691 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1694 wxPyEndBlockThreads(); \
1696 PCLASS::CBNAME(a); \
1698 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1699 PCLASS::CBNAME(a); \
1702 //---------------------------------------------------------------------------
1704 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1706 bool base_##CBNAME()
1709 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1710 bool CLASS::CBNAME() { \
1713 wxPyBeginBlockThreads(); \
1714 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1715 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1716 wxPyEndBlockThreads(); \
1718 rval = PCLASS::CBNAME(); \
1721 bool CLASS::base_##CBNAME() { \
1722 return PCLASS::CBNAME(); \
1725 //---------------------------------------------------------------------------
1727 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1728 bool CBNAME() const; \
1729 bool base_##CBNAME() const
1732 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1733 bool CLASS::CBNAME() const { \
1736 wxPyBeginBlockThreads(); \
1737 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1738 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1739 wxPyEndBlockThreads(); \
1741 rval = PCLASS::CBNAME(); \
1744 bool CLASS::base_##CBNAME() const { \
1745 return PCLASS::CBNAME(); \
1748 //---------------------------------------------------------------------------
1750 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1751 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1752 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1755 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1756 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1759 wxPyBeginBlockThreads(); \
1760 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1761 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1762 wxPyEndBlockThreads(); \
1764 rval = PCLASS::CBNAME(a, b, c); \
1765 return (wxDragResult)rval; \
1767 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1768 return PCLASS::CBNAME(a, b, c); \
1771 //---------------------------------------------------------------------------
1773 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1774 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1776 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1777 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1778 wxPyBeginBlockThreads(); \
1780 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1782 PyObject* obj = wxPyMake_wxObject(&a); \
1783 PyObject* s = wx2PyString(b); \
1784 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1787 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1793 wxPyEndBlockThreads(); \
1797 //---------------------------------------------------------------------------
1799 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1800 bool CBNAME(wxDragResult a); \
1801 bool base_##CBNAME(wxDragResult a)
1804 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1805 bool CLASS::CBNAME(wxDragResult a) { \
1808 wxPyBeginBlockThreads(); \
1809 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1810 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1811 wxPyEndBlockThreads(); \
1813 rval = PCLASS::CBNAME(a); \
1816 bool CLASS::base_##CBNAME(wxDragResult a) { \
1817 return PCLASS::CBNAME(a); \
1820 //---------------------------------------------------------------------------
1822 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1823 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1826 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1827 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1828 wxPyBeginBlockThreads(); \
1830 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1831 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1832 wxPyEndBlockThreads(); \
1833 return (wxDragResult)rval; \
1836 //---------------------------------------------------------------------------
1838 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1839 bool CBNAME(int a, int b, const wxString& c)
1841 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1842 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1844 wxPyBeginBlockThreads(); \
1845 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1846 PyObject* s = wx2PyString(c); \
1847 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1850 wxPyEndBlockThreads(); \
1854 //---------------------------------------------------------------------------
1856 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1858 size_t base_##CBNAME()
1861 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1862 size_t CLASS::CBNAME() { \
1865 wxPyBeginBlockThreads(); \
1866 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1867 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1868 wxPyEndBlockThreads(); \
1870 rval = PCLASS::CBNAME(); \
1873 size_t CLASS::base_##CBNAME() { \
1874 return PCLASS::CBNAME(); \
1877 //---------------------------------------------------------------------------
1879 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1880 size_t CBNAME() const; \
1881 size_t base_##CBNAME() const
1884 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1885 size_t CLASS::CBNAME() const { \
1888 wxPyBeginBlockThreads(); \
1889 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1890 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1891 wxPyEndBlockThreads(); \
1893 rval = PCLASS::CBNAME(); \
1896 size_t CLASS::base_##CBNAME() const { \
1897 return PCLASS::CBNAME(); \
1900 //---------------------------------------------------------------------------
1902 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1903 wxDataFormat CBNAME(size_t a); \
1904 wxDataFormat base_##CBNAME(size_t a)
1907 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1908 wxDataFormat CLASS::CBNAME(size_t a) { \
1909 wxDataFormat rval=0; \
1911 wxPyBeginBlockThreads(); \
1912 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1914 wxDataFormat* ptr; \
1915 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1917 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1922 wxPyEndBlockThreads(); \
1924 rval = PCLASS::CBNAME(a); \
1927 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1928 return PCLASS::CBNAME(a); \
1931 //---------------------------------------------------------------------------
1933 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1934 void CBNAME(const Type& a); \
1935 void base_##CBNAME(const Type& a)
1938 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1939 void CLASS::CBNAME(const Type& a) { \
1941 wxPyBeginBlockThreads(); \
1942 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1943 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1944 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1947 wxPyEndBlockThreads(); \
1949 PCLASS::CBNAME(a); \
1951 void CLASS::base_##CBNAME(const Type& a) { \
1952 PCLASS::CBNAME(a); \
1956 //---------------------------------------------------------------------------
1958 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1959 void CBNAME(Type& a); \
1960 void base_##CBNAME(Type& a)
1963 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1964 void CLASS::CBNAME(Type& a) { \
1966 wxPyBeginBlockThreads(); \
1967 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1968 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1969 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1972 wxPyEndBlockThreads(); \
1974 PCLASS::CBNAME(a); \
1976 void CLASS::base_##CBNAME(Type& a) { \
1977 PCLASS::CBNAME(a); \
1980 //---------------------------------------------------------------------------
1982 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1983 bool CBNAME(Type& a); \
1984 bool base_##CBNAME(Type& a)
1987 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1988 bool CLASS::CBNAME(Type& a) { \
1991 wxPyBeginBlockThreads(); \
1992 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1993 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1994 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1997 wxPyEndBlockThreads(); \
1999 rv = PCLASS::CBNAME(a); \
2002 bool CLASS::base_##CBNAME(Type& a) { \
2003 return PCLASS::CBNAME(a); \
2006 //---------------------------------------------------------------------------
2008 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2009 bool CBNAME(Type& a)
2012 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2013 bool CLASS::CBNAME(Type& a) { \
2015 wxPyBeginBlockThreads(); \
2016 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2017 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2018 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2021 wxPyEndBlockThreads(); \
2025 //---------------------------------------------------------------------------
2027 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2028 wxString CBNAME(long a, long b) const; \
2029 wxString base_##CBNAME(long a, long b) const
2031 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2032 wxString CLASS::CBNAME(long a, long b) const { \
2035 wxPyBeginBlockThreads(); \
2036 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2038 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2040 rval = Py2wxString(ro); \
2044 wxPyEndBlockThreads(); \
2046 rval = PCLASS::CBNAME(a,b); \
2049 wxString CLASS::base_##CBNAME(long a, long b) const { \
2050 return PCLASS::CBNAME(a,b); \
2053 //---------------------------------------------------------------------------
2055 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2056 int CBNAME(long a) const; \
2057 int base_##CBNAME(long a) const
2060 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2061 int CLASS::CBNAME(long a) const { \
2064 wxPyBeginBlockThreads(); \
2065 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2067 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2069 rval = PyInt_AsLong(ro); \
2073 wxPyEndBlockThreads(); \
2075 rval = PCLASS::CBNAME(a); \
2078 int CLASS::base_##CBNAME(long a) const { \
2079 return PCLASS::CBNAME(a); \
2083 //---------------------------------------------------------------------------
2085 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2086 wxListItemAttr* CBNAME(long a) const; \
2087 wxListItemAttr* base_##CBNAME(long a) const
2090 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2091 wxListItemAttr *CLASS::CBNAME(long a) const { \
2092 wxListItemAttr *rval = NULL; \
2094 wxPyBeginBlockThreads(); \
2095 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2097 wxListItemAttr* ptr; \
2098 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2100 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2105 wxPyEndBlockThreads(); \
2107 rval = PCLASS::CBNAME(a); \
2110 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2111 return PCLASS::CBNAME(a); \
2114 //---------------------------------------------------------------------------
2116 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2117 bool CBNAME(wxMouseEvent& e); \
2118 bool base_##CBNAME(wxMouseEvent& e)
2120 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2121 bool CLASS::CBNAME(wxMouseEvent& e) { \
2124 wxPyBeginBlockThreads(); \
2125 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2127 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2128 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2130 rval = PyInt_AsLong(ro); \
2135 wxPyEndBlockThreads(); \
2137 return PCLASS::CBNAME(e); \
2140 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2141 return PCLASS::CBNAME(e); \
2145 //---------------------------------------------------------------------------
2147 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2148 wxWizardPage* CBNAME() const
2150 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2151 wxWizardPage* CLASS::CBNAME() const { \
2152 wxWizardPage* rv = NULL; \
2153 wxPyBeginBlockThreads(); \
2154 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2156 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2158 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2162 wxPyEndBlockThreads(); \
2166 //---------------------------------------------------------------------------
2168 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2169 wxBitmap CBNAME() const
2171 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2172 wxBitmap CLASS::CBNAME() const { \
2174 wxPyBeginBlockThreads(); \
2175 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2178 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2180 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2185 wxPyEndBlockThreads(); \
2189 //---------------------------------------------------------------------------
2191 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2194 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2195 wxObject* CLASS::CBNAME() { \
2196 wxObject* rv = NULL; \
2197 wxPyBeginBlockThreads(); \
2198 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2200 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2202 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2206 wxPyEndBlockThreads(); \
2210 //---------------------------------------------------------------------------
2212 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2213 wxObject* CBNAME(const wxString& a)
2215 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2216 wxObject* CLASS::CBNAME(const wxString& a) { \
2217 wxObject* rv = NULL; \
2218 wxPyBeginBlockThreads(); \
2219 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2220 PyObject* so = wx2PyString(a); \
2222 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2224 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2229 wxPyEndBlockThreads(); \
2233 //---------------------------------------------------------------------------
2235 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2236 bool CBNAME(wxXmlNode* a)
2239 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2240 bool CLASS::CBNAME(wxXmlNode* a) { \
2242 wxPyBeginBlockThreads(); \
2243 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2244 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2245 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2248 wxPyEndBlockThreads(); \
2252 //---------------------------------------------------------------------------
2254 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2255 wxCoord CBNAME(size_t a) const
2258 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2259 wxCoord CLASS::CBNAME(size_t a) const { \
2262 wxPyBeginBlockThreads(); \
2263 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2264 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2266 wxPyEndBlockThreads(); \
2270 //---------------------------------------------------------------------------
2272 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2273 void CBNAME(size_t a, size_t b) const; \
2274 void base_##CBNAME(size_t a, size_t b) const
2277 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2278 void CLASS::CBNAME(size_t a, size_t b) const { \
2280 wxPyBeginBlockThreads(); \
2281 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2282 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2283 wxPyEndBlockThreads(); \
2285 PCLASS::CBNAME(a,b); \
2287 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2288 PCLASS::CBNAME(a,b); \
2291 //---------------------------------------------------------------------------
2293 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2294 wxCoord CBNAME() const; \
2295 wxCoord base_##CBNAME() const
2298 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2299 wxCoord CLASS::CBNAME() const { \
2302 wxPyBeginBlockThreads(); \
2303 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2304 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2305 wxPyEndBlockThreads(); \
2307 rval = PCLASS::CBNAME(); \
2310 wxCoord CLASS::base_##CBNAME() const { \
2311 return PCLASS::CBNAME(); \
2314 //---------------------------------------------------------------------------
2316 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2317 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2320 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2321 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2323 wxPyBeginBlockThreads(); \
2324 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2325 PyObject* obj = wxPyMake_wxObject(&a); \
2326 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2327 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2330 wxPyEndBlockThreads(); \
2333 //---------------------------------------------------------------------------
2335 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2336 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2337 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2340 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2341 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2343 wxPyBeginBlockThreads(); \
2344 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2345 PyObject* obj = wxPyMake_wxObject(&a); \
2346 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2347 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2350 wxPyEndBlockThreads(); \
2352 PCLASS::CBNAME(a,b,c); \
2354 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2355 PCLASS::CBNAME(a,b,c); \
2358 //---------------------------------------------------------------------------
2361 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2362 wxString CBNAME(size_t a) const; \
2363 wxString base_##CBNAME(size_t a) const
2365 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2366 wxString CLASS::CBNAME(size_t a) const { \
2369 wxPyBeginBlockThreads(); \
2370 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2372 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2374 rval = Py2wxString(ro); \
2378 wxPyEndBlockThreads(); \
2380 rval = PCLASS::CBNAME(a); \
2383 wxString CLASS::base_##CBNAME(size_t a) const { \
2384 return PCLASS::CBNAME(a); \
2387 //---------------------------------------------------------------------------
2389 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2390 wxString CBNAME(size_t a) const
2392 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2393 wxString CLASS::CBNAME(size_t a) const { \
2396 wxPyBeginBlockThreads(); \
2397 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2399 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2401 rval = Py2wxString(ro); \
2405 wxPyEndBlockThreads(); \
2409 //---------------------------------------------------------------------------