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 char* 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;
519 PyObject
* m_lastFound
;
522 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
526 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
527 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
528 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
529 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
530 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
535 //---------------------------------------------------------------------------
537 // This is used in C++ classes that need to be able to make callback to
538 // "overloaded" python methods
541 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
542 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
544 private: wxPyCallbackHelper m_myInst
547 //---------------------------------------------------------------------------
548 // The wxPythonApp class
551 wxPYAPP_ASSERT_SUPPRESS
= 1,
552 wxPYAPP_ASSERT_EXCEPTION
= 2,
553 wxPYAPP_ASSERT_DIALOG
= 4,
554 wxPYAPP_ASSERT_LOG
= 8
557 class wxPyApp
: public wxApp
559 DECLARE_ABSTRACT_CLASS(wxPyApp
);
567 int GetAssertMode() { return m_assertMode
; }
568 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
570 virtual bool OnInitGui();
571 virtual int OnExit();
573 virtual void OnAssert(const wxChar
*file
,
578 // virtual int FilterEvent(wxEvent& event); // This one too????
581 static bool GetMacSupportPCMenuShortcuts();
582 static long GetMacAboutMenuItemId();
583 static long GetMacPreferencesMenuItemId();
584 static long GetMacExitMenuItemId();
585 static wxString
GetMacHelpMenuTitleName();
587 static void SetMacSupportPCMenuShortcuts(bool val
);
588 static void SetMacAboutMenuItemId(long val
);
589 static void SetMacPreferencesMenuItemId(long val
);
590 static void SetMacExitMenuItemId(long val
);
591 static void SetMacHelpMenuTitleName(const wxString
& val
);
594 void _BootstrapApp();
596 // implementation only
597 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
601 bool m_startupComplete
;
604 extern wxPyApp
*wxPythonApp
;
607 //----------------------------------------------------------------------
608 // These macros are used to implement the virtual methods that should
609 // redirect to a Python method if one exists. The names designate the
610 // return type, if any, as well as any parameter types.
611 //---------------------------------------------------------------------------
613 #define DEC_PYCALLBACK__(CBNAME) \
618 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
619 void CLASS::CBNAME() { \
621 wxPyBeginBlockThreads(); \
622 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
623 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
624 wxPyEndBlockThreads(); \
628 void CLASS::base_##CBNAME() { \
632 //---------------------------------------------------------------------------
634 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
635 bool CBNAME(int a, int b); \
636 bool base_##CBNAME(int a, int b)
639 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
640 bool CLASS::CBNAME(int a, int b) { \
641 bool rval=False, found; \
642 wxPyBeginBlockThreads(); \
643 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
644 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
645 wxPyEndBlockThreads(); \
647 rval = PCLASS::CBNAME(a,b); \
650 bool CLASS::base_##CBNAME(int a, int b) { \
651 return PCLASS::CBNAME(a,b); \
654 //---------------------------------------------------------------------------
656 #define DEC_PYCALLBACK_VOID_(CBNAME) \
661 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
662 void CLASS::CBNAME() { \
664 wxPyBeginBlockThreads(); \
665 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
666 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
667 wxPyEndBlockThreads(); \
671 void CLASS::base_##CBNAME() { \
675 //---------------------------------------------------------------------------
677 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
678 void CBNAME(int a, int b); \
679 void base_##CBNAME(int a, int b)
682 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
683 void CLASS::CBNAME(int a, int b) { \
685 wxPyBeginBlockThreads(); \
686 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
687 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
688 wxPyEndBlockThreads(); \
690 PCLASS::CBNAME(a,b); \
692 void CLASS::base_##CBNAME(int a, int b) { \
693 PCLASS::CBNAME(a,b); \
696 //---------------------------------------------------------------------------
698 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
699 void CBNAME(int a); \
700 void base_##CBNAME(int a)
703 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
704 void CLASS::CBNAME(int a) { \
706 wxPyBeginBlockThreads(); \
707 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
708 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
709 wxPyEndBlockThreads(); \
713 void CLASS::base_##CBNAME(int a) { \
717 //---------------------------------------------------------------------------
719 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
720 void CBNAME(int a, int b, int c, int d); \
721 void base_##CBNAME(int a, int b, int c, int d)
724 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
725 void CLASS::CBNAME(int a, int b, int c, int d) { \
727 wxPyBeginBlockThreads(); \
728 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
729 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
730 wxPyEndBlockThreads(); \
732 PCLASS::CBNAME(a,b,c,d); \
734 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
735 PCLASS::CBNAME(a,b,c,d); \
738 //---------------------------------------------------------------------------
739 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
740 void CBNAME(int a, int b, int c, int d, int e); \
741 void base_##CBNAME(int a, int b, int c, int d, int e)
744 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
745 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
747 wxPyBeginBlockThreads(); \
748 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
749 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
750 wxPyEndBlockThreads(); \
752 PCLASS::CBNAME(a,b,c,d,e); \
754 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
755 PCLASS::CBNAME(a,b,c,d,e); \
758 //---------------------------------------------------------------------------
760 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
761 void CBNAME(int* a, int* b) const; \
762 void base_##CBNAME(int* a, int* b) const
765 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
766 void CLASS::CBNAME(int* a, int* b) const { \
767 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
769 wxPyBeginBlockThreads(); \
770 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
772 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
774 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
775 PyObject* o1 = PySequence_GetItem(ro, 0); \
776 PyObject* o2 = PySequence_GetItem(ro, 1); \
777 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
778 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
781 PyErr_SetString(PyExc_TypeError, errmsg); \
786 PyErr_SetString(PyExc_TypeError, errmsg); \
791 wxPyEndBlockThreads(); \
793 PCLASS::CBNAME(a,b); \
795 void CLASS::base_##CBNAME(int* a, int* b) const { \
796 PCLASS::CBNAME(a,b); \
800 //---------------------------------------------------------------------------
802 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
803 wxSize CBNAME() const; \
804 wxSize base_##CBNAME() const
807 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
808 wxSize CLASS::CBNAME() const { \
809 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
810 bool found; wxSize rval(0,0); \
811 wxPyBeginBlockThreads(); \
812 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
814 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
816 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
817 PyObject* o1 = PySequence_GetItem(ro, 0); \
818 PyObject* o2 = PySequence_GetItem(ro, 1); \
819 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
820 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
823 PyErr_SetString(PyExc_TypeError, errmsg); \
828 PyErr_SetString(PyExc_TypeError, errmsg); \
833 wxPyEndBlockThreads(); \
835 return PCLASS::CBNAME(); \
839 wxSize CLASS::base_##CBNAME() const { \
840 return PCLASS::CBNAME(); \
844 //---------------------------------------------------------------------------
846 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
847 bool CBNAME(bool a); \
848 bool base_##CBNAME(bool a)
851 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
852 bool CLASS::CBNAME(bool a) { \
853 bool rval=False, found; \
854 wxPyBeginBlockThreads(); \
855 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
856 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
857 wxPyEndBlockThreads(); \
859 rval = PCLASS::CBNAME(a); \
862 bool CLASS::base_##CBNAME(bool a) { \
863 return PCLASS::CBNAME(a); \
866 //---------------------------------------------------------------------------
868 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
869 bool CBNAME(int a); \
870 bool base_##CBNAME(int a)
873 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
874 bool CLASS::CBNAME(int a) { \
875 bool rval=False, found; \
876 wxPyBeginBlockThreads(); \
877 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
878 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
879 wxPyEndBlockThreads(); \
881 rval = PCLASS::CBNAME(a); \
884 bool CLASS::base_##CBNAME(int a) { \
885 return PCLASS::CBNAME(a); \
888 //---------------------------------------------------------------------------
890 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
894 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
895 bool CLASS::CBNAME(int a) { \
897 wxPyBeginBlockThreads(); \
898 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
899 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
901 wxPyEndBlockThreads(); \
906 //---------------------------------------------------------------------------
908 #define DEC_PYCALLBACK__DC(CBNAME) \
909 void CBNAME(wxDC& a); \
910 void base_##CBNAME(wxDC& a)
913 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
914 void CLASS::CBNAME(wxDC& a) { \
916 wxPyBeginBlockThreads(); \
917 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
918 PyObject* obj = wxPyMake_wxObject(&a); \
919 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
922 wxPyEndBlockThreads(); \
926 void CLASS::base_##CBNAME(wxDC& a) { \
932 //---------------------------------------------------------------------------
934 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
935 void CBNAME(wxDC& a, bool b); \
936 void base_##CBNAME(wxDC& a, bool b)
939 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
940 void CLASS::CBNAME(wxDC& a, bool b) { \
942 wxPyBeginBlockThreads(); \
943 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
944 PyObject* obj = wxPyMake_wxObject(&a); \
945 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
948 wxPyEndBlockThreads(); \
950 PCLASS::CBNAME(a, b); \
952 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
953 PCLASS::CBNAME(a, b); \
956 //---------------------------------------------------------------------------
958 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
959 void CBNAME(wxDC& a, bool b); \
960 void base_##CBNAME(wxDC& a, bool b)
963 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
964 void CLASS::CBNAME(wxDC& a, bool b) { \
966 wxPyBeginBlockThreads(); \
967 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
968 PyObject* obj = wxPyMake_wxObject(&a); \
969 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
972 wxPyEndBlockThreads(); \
974 PCLASS::CBNAME(a, b); \
976 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
977 PCLASS::CBNAME(a, b); \
980 //---------------------------------------------------------------------------
982 #define DEC_PYCALLBACK__2DBL(CBNAME) \
983 void CBNAME(double a, double b); \
984 void base_##CBNAME(double a, double b)
987 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
988 void CLASS::CBNAME(double a, double b) { \
990 wxPyBeginBlockThreads(); \
991 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
992 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
993 wxPyEndBlockThreads(); \
995 PCLASS::CBNAME(a, b); \
997 void CLASS::base_##CBNAME(double a, double b) { \
998 PCLASS::CBNAME(a, b); \
1001 //---------------------------------------------------------------------------
1003 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1004 void CBNAME(double a, double b, int c, int d); \
1005 void base_##CBNAME(double a, double b, int c, int d)
1008 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1009 void CLASS::CBNAME(double a, double b, int c, int d) { \
1011 wxPyBeginBlockThreads(); \
1012 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1013 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1015 wxPyEndBlockThreads(); \
1017 PCLASS::CBNAME(a, b, c, d); \
1019 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1020 PCLASS::CBNAME(a, b, c, d); \
1023 //---------------------------------------------------------------------------
1025 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1026 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1027 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1030 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1031 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1033 wxPyBeginBlockThreads(); \
1034 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1035 PyObject* obj = wxPyMake_wxObject(&a); \
1036 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1039 wxPyEndBlockThreads(); \
1041 PCLASS::CBNAME(a, b, c, d, e, f); \
1043 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1044 PCLASS::CBNAME(a, b, c, d, e, f); \
1047 //---------------------------------------------------------------------------
1049 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1050 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1051 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1054 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1055 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1057 wxPyBeginBlockThreads(); \
1059 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1060 PyObject* obj = wxPyMake_wxObject(&a); \
1061 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1064 wxPyEndBlockThreads(); \
1066 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1069 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1070 return PCLASS::CBNAME(a, b, c, d, e, f); \
1073 //---------------------------------------------------------------------------
1075 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1076 void CBNAME(bool a, double b, double c, int d, int e); \
1077 void base_##CBNAME(bool a, double b, double c, int d, int e)
1080 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1081 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1083 wxPyBeginBlockThreads(); \
1084 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1085 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1087 wxPyEndBlockThreads(); \
1089 PCLASS::CBNAME(a, b, c, d, e); \
1091 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1092 PCLASS::CBNAME(a, b, c, d, e); \
1095 //---------------------------------------------------------------------------
1097 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1098 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1099 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1102 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1103 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1105 wxPyBeginBlockThreads(); \
1106 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1107 PyObject* obj = wxPyMake_wxObject(&a); \
1108 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1111 wxPyEndBlockThreads(); \
1113 PCLASS::CBNAME(a, b, c, d, e); \
1115 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1116 PCLASS::CBNAME(a, b, c, d, e); \
1119 //---------------------------------------------------------------------------
1121 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1122 void CBNAME(wxDC& a, bool b); \
1123 void base_##CBNAME(wxDC& a, bool b)
1126 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1127 void CLASS::CBNAME(wxDC& a, bool b) { \
1129 wxPyBeginBlockThreads(); \
1130 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1131 PyObject* obj = wxPyMake_wxObject(&a); \
1132 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1135 wxPyEndBlockThreads(); \
1137 PCLASS::CBNAME(a, b); \
1139 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1140 PCLASS::CBNAME(a, b); \
1143 //---------------------------------------------------------------------------
1145 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1146 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1147 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1150 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1151 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1154 wxPyBeginBlockThreads(); \
1155 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1156 PyObject* obj = wxPyMake_wxObject(a); \
1157 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1160 wxPyEndBlockThreads(); \
1162 PCLASS::CBNAME(a, b, c, d, e, f); \
1164 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1166 PCLASS::CBNAME(a, b, c, d, e, f); \
1169 //---------------------------------------------------------------------------
1171 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1172 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1173 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1176 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1177 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1179 wxPyBeginBlockThreads(); \
1180 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1181 PyObject* obj = wxPyMake_wxObject(a); \
1182 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1185 wxPyEndBlockThreads(); \
1187 PCLASS::CBNAME(a, b, c, d, e); \
1189 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1191 PCLASS::CBNAME(a, b, c, d, e); \
1194 //---------------------------------------------------------------------------
1196 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1197 void CBNAME(double a, double b, int c); \
1198 void base_##CBNAME(double a, double b, int c)
1201 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1202 void CLASS::CBNAME(double a, double b, int c) { \
1204 wxPyBeginBlockThreads(); \
1205 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1206 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1207 wxPyEndBlockThreads(); \
1209 PCLASS::CBNAME(a, b, c); \
1211 void CLASS::base_##CBNAME(double a, double b, int c) { \
1212 PCLASS::CBNAME(a, b, c); \
1215 //---------------------------------------------------------------------------
1217 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1218 void CBNAME(bool a, double b, double c, int d); \
1219 void base_##CBNAME(bool a, double b, double c, int d)
1222 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1223 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1225 wxPyBeginBlockThreads(); \
1226 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1227 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1228 wxPyEndBlockThreads(); \
1230 PCLASS::CBNAME(a, b, c, d); \
1232 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1233 PCLASS::CBNAME(a, b, c, d); \
1236 //---------------------------------------------------------------------------
1237 //---------------------------------------------------------------------------
1239 #define DEC_PYCALLBACK__STRING(CBNAME) \
1240 void CBNAME(const wxString& a); \
1241 void base_##CBNAME(const wxString& a)
1243 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1244 void CLASS::CBNAME(const wxString& a) { \
1246 wxPyBeginBlockThreads(); \
1247 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1248 PyObject* s = wx2PyString(a); \
1249 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1252 wxPyEndBlockThreads(); \
1254 PCLASS::CBNAME(a); \
1256 void CLASS::base_##CBNAME(const wxString& a) { \
1257 PCLASS::CBNAME(a); \
1260 //---------------------------------------------------------------------------
1262 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1263 bool CBNAME(const wxString& a); \
1264 bool base_##CBNAME(const wxString& a)
1266 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1267 bool CLASS::CBNAME(const wxString& a) { \
1270 wxPyBeginBlockThreads(); \
1271 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1272 PyObject* s = wx2PyString(a); \
1273 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1276 wxPyEndBlockThreads(); \
1278 rval = PCLASS::CBNAME(a); \
1281 bool CLASS::base_##CBNAME(const wxString& a) { \
1282 return PCLASS::CBNAME(a); \
1285 //---------------------------------------------------------------------------
1287 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1288 bool CBNAME(const wxString& a)
1290 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1291 bool CLASS::CBNAME(const wxString& a) { \
1293 wxPyBeginBlockThreads(); \
1294 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1295 PyObject* s = wx2PyString(a); \
1296 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1299 wxPyEndBlockThreads(); \
1303 //---------------------------------------------------------------------------
1305 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1306 wxString CBNAME(const wxString& a)
1308 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1309 wxString CLASS::CBNAME(const wxString& a) { \
1311 wxPyBeginBlockThreads(); \
1312 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1314 PyObject* s = wx2PyString(a); \
1315 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1318 rval = Py2wxString(ro); \
1322 wxPyEndBlockThreads(); \
1326 //---------------------------------------------------------------------------
1328 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1329 wxString CBNAME(const wxString& a); \
1330 wxString base_##CBNAME(const wxString& a)
1332 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1333 wxString CLASS::CBNAME(const wxString& a) { \
1336 wxPyBeginBlockThreads(); \
1337 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1339 PyObject* s = wx2PyString(a); \
1340 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1343 rval = Py2wxString(ro); \
1348 rval = PCLASS::CBNAME(a); \
1349 wxPyEndBlockThreads(); \
1353 //---------------------------------------------------------------------------
1355 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1356 wxString CBNAME(const wxString& a,int b)
1358 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1359 wxString CLASS::CBNAME(const wxString& a,int b) { \
1361 wxPyBeginBlockThreads(); \
1362 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1364 PyObject* s = wx2PyString(a); \
1365 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1368 rval = Py2wxString(ro); \
1372 wxPyEndBlockThreads(); \
1376 //---------------------------------------------------------------------------
1378 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1379 bool CBNAME(const wxString& a, const wxString& b); \
1380 bool base_##CBNAME(const wxString& a, const wxString& b)
1382 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1383 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1386 wxPyBeginBlockThreads(); \
1387 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1388 PyObject* s1 = wx2PyString(a); \
1389 PyObject* s2 = wx2PyString(b); \
1390 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1394 wxPyEndBlockThreads(); \
1396 rval = PCLASS::CBNAME(a, b); \
1399 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1400 return PCLASS::CBNAME(a, b); \
1403 //---------------------------------------------------------------------------
1405 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1406 wxString CBNAME(); \
1407 wxString base_##CBNAME()
1409 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1410 wxString CLASS::CBNAME() { \
1413 wxPyBeginBlockThreads(); \
1414 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1416 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1418 rval = Py2wxString(ro); \
1422 wxPyEndBlockThreads(); \
1424 rval = PCLASS::CBNAME(); \
1427 wxString CLASS::base_##CBNAME() { \
1428 return PCLASS::CBNAME(); \
1431 //---------------------------------------------------------------------------
1433 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1434 wxString CBNAME() const; \
1435 wxString base_##CBNAME() const;
1437 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1438 wxString CLASS::CBNAME() const { \
1441 wxPyBeginBlockThreads(); \
1442 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1444 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1446 rval = Py2wxString(ro); \
1450 wxPyEndBlockThreads(); \
1452 rval = PCLASS::CBNAME(); \
1455 wxString CLASS::base_##CBNAME() const { \
1456 return PCLASS::CBNAME(); \
1459 //---------------------------------------------------------------------------
1461 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1464 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1465 wxString CLASS::CBNAME() { \
1467 wxPyBeginBlockThreads(); \
1468 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1470 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1472 rval = Py2wxString(ro); \
1476 wxPyEndBlockThreads(); \
1480 //---------------------------------------------------------------------------
1482 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1483 wxString CBNAME() const;
1485 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1486 wxString CLASS::CBNAME() const { \
1488 wxPyBeginBlockThreads(); \
1489 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1491 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1493 rval = Py2wxString(ro); \
1497 wxPyEndBlockThreads(); \
1501 //---------------------------------------------------------------------------
1503 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1504 bool CBNAME(const wxHtmlTag& a)
1507 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1508 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1510 wxPyBeginBlockThreads(); \
1511 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1512 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1513 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1516 wxPyEndBlockThreads(); \
1520 //---------------------------------------------------------------------------
1522 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1523 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1524 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1526 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1527 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1529 wxPyBeginBlockThreads(); \
1530 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1531 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1532 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1535 wxPyEndBlockThreads(); \
1537 PCLASS::CBNAME(cell, x, y); \
1539 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1540 PCLASS::CBNAME(cell, x, y); \
1544 //---------------------------------------------------------------------------
1546 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1547 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1548 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1550 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1551 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1553 wxPyBeginBlockThreads(); \
1554 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1555 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1556 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1557 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1561 wxPyEndBlockThreads(); \
1563 PCLASS::CBNAME(cell, x, y, e); \
1565 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1566 PCLASS::CBNAME(cell, x, y, e); \
1571 //---------------------------------------------------------------------------
1573 #define DEC_PYCALLBACK___pure(CBNAME) \
1577 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1578 void CLASS::CBNAME() { \
1579 wxPyBeginBlockThreads(); \
1580 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1581 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1582 wxPyEndBlockThreads(); \
1585 //---------------------------------------------------------------------------
1587 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1591 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1592 wxSize CLASS::CBNAME() { \
1593 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1595 wxPyBeginBlockThreads(); \
1596 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1599 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1601 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1603 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1604 PyObject* o1 = PySequence_GetItem(ro, 0); \
1605 PyObject* o2 = PySequence_GetItem(ro, 1); \
1606 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1607 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1609 PyErr_SetString(PyExc_TypeError, errmsg); \
1614 PyErr_SetString(PyExc_TypeError, errmsg); \
1619 wxPyEndBlockThreads(); \
1623 //---------------------------------------------------------------------------
1625 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1626 bool CBNAME(wxWindow* a); \
1627 bool base_##CBNAME(wxWindow* a)
1630 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1631 bool CLASS::CBNAME(wxWindow* a) { \
1634 wxPyBeginBlockThreads(); \
1635 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1636 PyObject* obj = wxPyMake_wxObject(a); \
1637 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1640 wxPyEndBlockThreads(); \
1642 rval = PCLASS::CBNAME(a); \
1645 bool CLASS::base_##CBNAME(wxWindow* a) { \
1646 return PCLASS::CBNAME(a); \
1649 //---------------------------------------------------------------------------
1651 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1652 bool CBNAME(wxWindow* a, wxDC& b); \
1653 bool base_##CBNAME(wxWindow* a, wxDC& b)
1656 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1657 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1660 wxPyBeginBlockThreads(); \
1661 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1662 PyObject* win = wxPyMake_wxObject(a); \
1663 PyObject* dc = wxPyMake_wxObject(&b); \
1664 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1668 wxPyEndBlockThreads(); \
1670 rval = PCLASS::CBNAME(a, b); \
1673 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1674 return PCLASS::CBNAME(a, b); \
1677 //---------------------------------------------------------------------------
1679 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1680 void CBNAME(wxWindowBase* a); \
1681 void base_##CBNAME(wxWindowBase* a)
1684 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1685 void CLASS::CBNAME(wxWindowBase* a) { \
1687 wxPyBeginBlockThreads(); \
1688 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1689 PyObject* obj = wxPyMake_wxObject(a); \
1690 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1693 wxPyEndBlockThreads(); \
1695 PCLASS::CBNAME(a); \
1697 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1698 PCLASS::CBNAME(a); \
1701 //---------------------------------------------------------------------------
1703 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1705 bool base_##CBNAME()
1708 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1709 bool CLASS::CBNAME() { \
1712 wxPyBeginBlockThreads(); \
1713 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1714 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1715 wxPyEndBlockThreads(); \
1717 rval = PCLASS::CBNAME(); \
1720 bool CLASS::base_##CBNAME() { \
1721 return PCLASS::CBNAME(); \
1724 //---------------------------------------------------------------------------
1726 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1727 bool CBNAME() const; \
1728 bool base_##CBNAME() const
1731 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1732 bool CLASS::CBNAME() const { \
1735 wxPyBeginBlockThreads(); \
1736 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1737 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1738 wxPyEndBlockThreads(); \
1740 rval = PCLASS::CBNAME(); \
1743 bool CLASS::base_##CBNAME() const { \
1744 return PCLASS::CBNAME(); \
1747 //---------------------------------------------------------------------------
1749 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1750 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1751 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1754 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1755 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1758 wxPyBeginBlockThreads(); \
1759 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1760 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1761 wxPyEndBlockThreads(); \
1763 rval = PCLASS::CBNAME(a, b, c); \
1764 return (wxDragResult)rval; \
1766 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1767 return PCLASS::CBNAME(a, b, c); \
1770 //---------------------------------------------------------------------------
1772 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1773 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1775 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1776 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1777 wxPyBeginBlockThreads(); \
1779 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1781 PyObject* obj = wxPyMake_wxObject(&a); \
1782 PyObject* s = wx2PyString(b); \
1783 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1786 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1792 wxPyEndBlockThreads(); \
1796 //---------------------------------------------------------------------------
1798 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1799 bool CBNAME(wxDragResult a); \
1800 bool base_##CBNAME(wxDragResult a)
1803 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1804 bool CLASS::CBNAME(wxDragResult a) { \
1807 wxPyBeginBlockThreads(); \
1808 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1809 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1810 wxPyEndBlockThreads(); \
1812 rval = PCLASS::CBNAME(a); \
1815 bool CLASS::base_##CBNAME(wxDragResult a) { \
1816 return PCLASS::CBNAME(a); \
1819 //---------------------------------------------------------------------------
1821 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1822 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1825 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1826 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1827 wxPyBeginBlockThreads(); \
1829 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1830 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1831 wxPyEndBlockThreads(); \
1832 return (wxDragResult)rval; \
1835 //---------------------------------------------------------------------------
1837 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1838 bool CBNAME(int a, int b, const wxString& c)
1840 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1841 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1843 wxPyBeginBlockThreads(); \
1844 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1845 PyObject* s = wx2PyString(c); \
1846 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1849 wxPyEndBlockThreads(); \
1853 //---------------------------------------------------------------------------
1855 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1857 size_t base_##CBNAME()
1860 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1861 size_t CLASS::CBNAME() { \
1864 wxPyBeginBlockThreads(); \
1865 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1866 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1867 wxPyEndBlockThreads(); \
1869 rval = PCLASS::CBNAME(); \
1872 size_t CLASS::base_##CBNAME() { \
1873 return PCLASS::CBNAME(); \
1876 //---------------------------------------------------------------------------
1878 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1879 size_t CBNAME() const; \
1880 size_t base_##CBNAME() const
1883 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1884 size_t CLASS::CBNAME() const { \
1887 wxPyBeginBlockThreads(); \
1888 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1889 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1890 wxPyEndBlockThreads(); \
1892 rval = PCLASS::CBNAME(); \
1895 size_t CLASS::base_##CBNAME() const { \
1896 return PCLASS::CBNAME(); \
1899 //---------------------------------------------------------------------------
1901 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1902 wxDataFormat CBNAME(size_t a); \
1903 wxDataFormat base_##CBNAME(size_t a)
1906 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1907 wxDataFormat CLASS::CBNAME(size_t a) { \
1908 wxDataFormat rval=0; \
1910 wxPyBeginBlockThreads(); \
1911 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1913 wxDataFormat* ptr; \
1914 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1916 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1921 wxPyEndBlockThreads(); \
1923 rval = PCLASS::CBNAME(a); \
1926 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1927 return PCLASS::CBNAME(a); \
1930 //---------------------------------------------------------------------------
1932 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1933 void CBNAME(const Type& a); \
1934 void base_##CBNAME(const Type& a)
1937 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1938 void CLASS::CBNAME(const Type& a) { \
1940 wxPyBeginBlockThreads(); \
1941 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1942 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1943 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1946 wxPyEndBlockThreads(); \
1948 PCLASS::CBNAME(a); \
1950 void CLASS::base_##CBNAME(const Type& a) { \
1951 PCLASS::CBNAME(a); \
1955 //---------------------------------------------------------------------------
1957 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1958 void CBNAME(Type& a); \
1959 void base_##CBNAME(Type& a)
1962 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1963 void CLASS::CBNAME(Type& a) { \
1965 wxPyBeginBlockThreads(); \
1966 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1967 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1968 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1971 wxPyEndBlockThreads(); \
1973 PCLASS::CBNAME(a); \
1975 void CLASS::base_##CBNAME(Type& a) { \
1976 PCLASS::CBNAME(a); \
1979 //---------------------------------------------------------------------------
1981 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1982 bool CBNAME(Type& a); \
1983 bool base_##CBNAME(Type& a)
1986 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1987 bool CLASS::CBNAME(Type& a) { \
1990 wxPyBeginBlockThreads(); \
1991 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1992 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1993 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1996 wxPyEndBlockThreads(); \
1998 rv = PCLASS::CBNAME(a); \
2001 bool CLASS::base_##CBNAME(Type& a) { \
2002 return PCLASS::CBNAME(a); \
2005 //---------------------------------------------------------------------------
2007 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2008 bool CBNAME(Type& a)
2011 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2012 bool CLASS::CBNAME(Type& a) { \
2014 wxPyBeginBlockThreads(); \
2015 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2016 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2017 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2020 wxPyEndBlockThreads(); \
2024 //---------------------------------------------------------------------------
2026 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2027 wxString CBNAME(long a, long b) const; \
2028 wxString base_##CBNAME(long a, long b) const
2030 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2031 wxString CLASS::CBNAME(long a, long b) const { \
2034 wxPyBeginBlockThreads(); \
2035 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2037 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2039 rval = Py2wxString(ro); \
2043 wxPyEndBlockThreads(); \
2045 rval = PCLASS::CBNAME(a,b); \
2048 wxString CLASS::base_##CBNAME(long a, long b) const { \
2049 return PCLASS::CBNAME(a,b); \
2052 //---------------------------------------------------------------------------
2054 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2055 int CBNAME(long a) const; \
2056 int base_##CBNAME(long a) const
2059 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2060 int CLASS::CBNAME(long a) const { \
2063 wxPyBeginBlockThreads(); \
2064 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2066 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2068 rval = PyInt_AsLong(ro); \
2072 wxPyEndBlockThreads(); \
2074 rval = PCLASS::CBNAME(a); \
2077 int CLASS::base_##CBNAME(long a) const { \
2078 return PCLASS::CBNAME(a); \
2082 //---------------------------------------------------------------------------
2084 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2085 wxListItemAttr* CBNAME(long a) const; \
2086 wxListItemAttr* base_##CBNAME(long a) const
2089 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2090 wxListItemAttr *CLASS::CBNAME(long a) const { \
2091 wxListItemAttr *rval = NULL; \
2093 wxPyBeginBlockThreads(); \
2094 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2096 wxListItemAttr* ptr; \
2097 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2099 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2104 wxPyEndBlockThreads(); \
2106 rval = PCLASS::CBNAME(a); \
2109 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2110 return PCLASS::CBNAME(a); \
2113 //---------------------------------------------------------------------------
2115 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2116 bool CBNAME(wxMouseEvent& e); \
2117 bool base_##CBNAME(wxMouseEvent& e)
2119 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2120 bool CLASS::CBNAME(wxMouseEvent& e) { \
2123 wxPyBeginBlockThreads(); \
2124 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2126 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2127 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2129 rval = PyInt_AsLong(ro); \
2134 wxPyEndBlockThreads(); \
2136 return PCLASS::CBNAME(e); \
2139 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2140 return PCLASS::CBNAME(e); \
2144 //---------------------------------------------------------------------------
2146 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2147 wxWizardPage* CBNAME() const
2149 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2150 wxWizardPage* CLASS::CBNAME() const { \
2151 wxWizardPage* rv = NULL; \
2152 wxPyBeginBlockThreads(); \
2153 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2155 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2157 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2161 wxPyEndBlockThreads(); \
2165 //---------------------------------------------------------------------------
2167 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2168 wxBitmap CBNAME() const
2170 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2171 wxBitmap CLASS::CBNAME() const { \
2173 wxPyBeginBlockThreads(); \
2174 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2177 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2179 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2184 wxPyEndBlockThreads(); \
2188 //---------------------------------------------------------------------------
2190 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2193 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2194 wxObject* CLASS::CBNAME() { \
2195 wxObject* rv = NULL; \
2196 wxPyBeginBlockThreads(); \
2197 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2199 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2201 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2205 wxPyEndBlockThreads(); \
2209 //---------------------------------------------------------------------------
2211 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2212 wxObject* CBNAME(const wxString& a)
2214 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2215 wxObject* CLASS::CBNAME(const wxString& a) { \
2216 wxObject* rv = NULL; \
2217 wxPyBeginBlockThreads(); \
2218 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2219 PyObject* so = wx2PyString(a); \
2221 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2223 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2228 wxPyEndBlockThreads(); \
2232 //---------------------------------------------------------------------------
2234 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2235 bool CBNAME(wxXmlNode* a)
2238 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2239 bool CLASS::CBNAME(wxXmlNode* a) { \
2241 wxPyBeginBlockThreads(); \
2242 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2243 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2244 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2247 wxPyEndBlockThreads(); \
2251 //---------------------------------------------------------------------------
2253 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2254 wxCoord CBNAME(size_t a) const
2257 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2258 wxCoord CLASS::CBNAME(size_t a) const { \
2261 wxPyBeginBlockThreads(); \
2262 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2263 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2265 wxPyEndBlockThreads(); \
2269 //---------------------------------------------------------------------------
2271 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2272 void CBNAME(size_t a, size_t b) const; \
2273 void base_##CBNAME(size_t a, size_t b) const
2276 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2277 void CLASS::CBNAME(size_t a, size_t b) const { \
2279 wxPyBeginBlockThreads(); \
2280 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2281 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2282 wxPyEndBlockThreads(); \
2284 PCLASS::CBNAME(a,b); \
2286 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2287 PCLASS::CBNAME(a,b); \
2290 //---------------------------------------------------------------------------
2292 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2293 wxCoord CBNAME() const; \
2294 wxCoord base_##CBNAME() const
2297 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2298 wxCoord CLASS::CBNAME() const { \
2301 wxPyBeginBlockThreads(); \
2302 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2303 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2304 wxPyEndBlockThreads(); \
2306 rval = PCLASS::CBNAME(); \
2309 wxCoord CLASS::base_##CBNAME() const { \
2310 return PCLASS::CBNAME(); \
2313 //---------------------------------------------------------------------------
2315 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2316 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2319 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2320 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2322 wxPyBeginBlockThreads(); \
2323 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2324 PyObject* obj = wxPyMake_wxObject(&a); \
2325 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2326 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2329 wxPyEndBlockThreads(); \
2332 //---------------------------------------------------------------------------
2334 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2335 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2336 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2339 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2340 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2342 wxPyBeginBlockThreads(); \
2343 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2344 PyObject* obj = wxPyMake_wxObject(&a); \
2345 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2346 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2349 wxPyEndBlockThreads(); \
2351 PCLASS::CBNAME(a,b,c); \
2353 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2354 PCLASS::CBNAME(a,b,c); \
2357 //---------------------------------------------------------------------------
2360 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2361 wxString CBNAME(size_t a) const; \
2362 wxString base_##CBNAME(size_t a) const
2364 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2365 wxString CLASS::CBNAME(size_t a) const { \
2368 wxPyBeginBlockThreads(); \
2369 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2371 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2373 rval = Py2wxString(ro); \
2377 wxPyEndBlockThreads(); \
2379 rval = PCLASS::CBNAME(a); \
2382 wxString CLASS::base_##CBNAME(size_t a) const { \
2383 return PCLASS::CBNAME(a); \
2386 //---------------------------------------------------------------------------
2388 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2389 wxString CBNAME(size_t a) const
2391 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2392 wxString CLASS::CBNAME(size_t a) const { \
2395 wxPyBeginBlockThreads(); \
2396 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2398 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2400 rval = Py2wxString(ro); \
2404 wxPyEndBlockThreads(); \
2408 //---------------------------------------------------------------------------