1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/clipbrd.h>
24 #include <wx/colordlg.h>
25 #include <wx/config.h>
26 #include <wx/cshelp.h>
27 #include <wx/dcbuffer.h>
28 #include <wx/dcmirror.h>
30 #include <wx/dirctrl.h>
31 #include <wx/dirdlg.h>
33 #include <wx/docview.h>
34 #include <wx/encconv.h>
35 #include <wx/fdrepdlg.h>
36 #include <wx/fileconf.h>
37 #include <wx/filesys.h>
38 #include <wx/fontdlg.h>
39 #include <wx/fs_inet.h>
40 #include <wx/fs_mem.h>
41 #include <wx/fs_zip.h>
42 #include <wx/gbsizer.h>
43 #include <wx/geometry.h>
44 #include <wx/htmllbox.h>
46 #include <wx/imaglist.h>
48 #include <wx/laywin.h>
49 #include <wx/listbook.h>
50 #include <wx/minifram.h>
51 #include <wx/notebook.h>
53 #include <wx/printdlg.h>
54 #include <wx/process.h>
55 #include <wx/progdlg.h>
56 #include <wx/sashwin.h>
57 #include <wx/spinbutt.h>
58 #include <wx/spinctrl.h>
59 #include <wx/splash.h>
60 #include <wx/splitter.h>
61 #include <wx/statline.h>
62 #include <wx/stream.h>
63 #include <wx/sysopt.h>
64 #include <wx/taskbar.h>
65 #include <wx/tglbtn.h>
66 #include <wx/tipwin.h>
67 #include <wx/tooltip.h>
69 #include <wx/vscroll.h>
73 # pragma warning(disable:4800)
74 # pragma warning(disable:4190)
77 #ifdef __WXMAC__ // avoid a bug in Carbon headers
81 //---------------------------------------------------------------------------
83 typedef unsigned char byte
;
84 typedef wxPoint2DDouble wxPoint2D
;
86 const bool True
= true;
87 const bool False
= false;
90 #ifndef wxPyUSE_EXPORTED_API
92 void __wxPyPreStart(PyObject
*);
94 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
95 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
98 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
101 bool wxPyCheckSwigType(const wxChar
* className
);
102 PyObject
* wxPyConstructObject(void* ptr
,
103 const wxChar
* className
,
105 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
106 const wxChar
* className
);
107 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
110 PyObject
* wx2PyString(const wxString
& src
);
111 wxString
Py2wxString(PyObject
* source
);
113 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
114 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
115 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
117 PyObject
* wxPy_ConvertList(wxListBase
* list
);
118 long wxPyGetWinHandle(wxWindow
* win
);
120 void wxPy_ReinitStockObjects(int pass
);
122 bool wxPyInstance_Check(PyObject
* obj
);
123 bool wxPySwigInstance_Check(PyObject
* obj
);
126 #endif // wxPyUSE_EXPORTED_API
127 //---------------------------------------------------------------------------
129 // if we want to handle threads and Python threads are available...
130 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
131 #define WXP_WITH_THREAD
132 #else // no Python threads...
133 #undef WXP_WITH_THREAD
136 #ifndef wxPyUSE_EXPORTED_API
138 // For Python --> C++
139 PyThreadState
* wxPyBeginAllowThreads();
140 void wxPyEndAllowThreads(PyThreadState
* state
);
142 // For C++ --> Python
143 void wxPyBeginBlockThreads();
144 void wxPyEndBlockThreads();
146 #endif // wxPyUSE_EXPORTED_API
148 #define wxPyBLOCK_THREADS(stmt) { wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(); }
149 #define wxPyRaiseNotImplemented() wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
151 //---------------------------------------------------------------------------
152 // These are helpers used by the typemaps
154 #ifndef wxPyUSE_EXPORTED_API
156 wxString
* wxString_in_helper(PyObject
* source
);
158 byte
* byte_LIST_helper(PyObject
* source
);
159 int* int_LIST_helper(PyObject
* source
);
160 long* long_LIST_helper(PyObject
* source
);
161 char** string_LIST_helper(PyObject
* source
);
162 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
163 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
164 wxString
* wxString_LIST_helper(PyObject
* source
);
165 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
166 wxPen
** wxPen_LIST_helper(PyObject
* source
);
168 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
169 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
170 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
171 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
172 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
173 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
176 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
177 bool wxColour_typecheck(PyObject
* source
);
181 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
183 // If source is an object instance then it may already be the right type
184 if (wxPySwigInstance_Check(source
)) {
186 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
191 // otherwise a 2-tuple of integers is expected
192 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
193 PyObject
* o1
= PySequence_GetItem(source
, 0);
194 PyObject
* o2
= PySequence_GetItem(source
, 1);
195 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
200 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
208 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
209 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
215 // Other helpful stuff
216 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
217 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
219 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
220 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
222 #endif // wxPyUSE_EXPORTED_API
224 //---------------------------------------------------------------------------
226 #if PYTHON_API_VERSION < 1009
227 #define PySequence_Fast_GET_ITEM(o, i) \
228 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
231 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
232 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
233 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
235 //---------------------------------------------------------------------------
237 #ifndef wxPyUSE_EXPORTED_API
239 class wxPyCallback
: public wxObject
{
240 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
242 wxPyCallback(PyObject
* func
);
243 wxPyCallback(const wxPyCallback
& other
);
246 void EventThunker(wxEvent
& event
);
251 #endif // wxPyUSE_EXPORTED_API
252 //---------------------------------------------------------------------------
253 //---------------------------------------------------------------------------
254 // These Event classes can be derived from in Python and passed through the
255 // event system without loosing anything. They do this by keeping a reference
256 // to themselves and some special case handling in wxPyCallback::EventThunker.
260 class wxPyEvtSelfRef
{
265 void SetSelf(PyObject
* self
, bool clone
=False
);
266 PyObject
* GetSelf() const;
267 bool GetCloned() const { return m_cloned
; }
275 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
276 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
278 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
279 wxPyEvent(const wxPyEvent
& evt
);
282 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
286 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
287 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
289 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
290 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
293 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
298 //----------------------------------------------------------------------
299 // Forward decalre a few things used in the exported API
300 class wxPyClientData
;
302 class wxPyOORClientData
;
303 class wxPyCBInputStream
;
305 void wxPyClientData_dtor(wxPyClientData
* self
);
306 void wxPyUserData_dtor(wxPyUserData
* self
);
307 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
308 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
311 //---------------------------------------------------------------------------
312 // Export a C API in a struct. Other modules will be able to load this from
313 // the wx.core module and will then have safe access to these functions, even if
314 // in another shared library.
316 class wxPyCallbackHelper
;
317 struct swig_type_info
;
318 struct swig_const_info
;
321 // Make SunCC happy and make typedef's for these that are extern "C"
322 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
323 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
324 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
325 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
326 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
327 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
328 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
329 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
330 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
331 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
332 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
333 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
334 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
335 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
336 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
337 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
338 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
340 typedef char* (*p_SWIG_PyObj_AsCharPtr_t
)(PyObject
*obj
, swig_type_info
* pchar_info
);
341 typedef PyObject
* (*p_SWIG_PyObj_FromCharPtr_t
)(const char* cptr
);
342 typedef unsigned long (*p_SWIG_PyObj_AsUnsignedLong_t
)(PyObject
* obj
);
343 typedef long (*p_SWIG_PyObj_AsLongInRange_t
)(PyObject
* obj
, const char* type
,
344 long min_value
, long max_value
);
345 typedef unsigned long (*p_SWIG_PyObj_AsUnsignedLongInRange_t
)(PyObject
*obj
, const char* type
,
346 unsigned long max_value
);
347 typedef char * (*p_SWIG_PyObj_AsNewCharPtr_t
)(PyObject
*obj
, swig_type_info
* pchar_info
);
348 typedef void (*p_SWIG_PyObj_AsCharPtrAndSize_t
)(PyObject
*obj
, swig_type_info
* pchar_info
,
349 char** cptr
, size_t* size
);
350 typedef void (*p_SWIG_PyObj_AsCharArray_t
)(PyObject
*obj
, swig_type_info
* pchar_info
,
351 char* carray
, size_t size
);
352 typedef PyObject
* (*p_SWIG_PyObj_FromCharArray_t
)(const char* carray
, size_t size
);
353 typedef float (*p_SWIG_PyObj_AsFloatConv_t
)(PyObject
*obj
, py_objasdbl_conv pyconv
);
360 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
361 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
362 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
363 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
364 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
365 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
366 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
367 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
368 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
369 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
370 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
371 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
372 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
373 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
374 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
375 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
376 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
378 p_SWIG_PyObj_AsCharPtr_t p_SWIG_PyObj_AsCharPtr
;
379 p_SWIG_PyObj_FromCharPtr_t p_SWIG_PyObj_FromCharPtr
;
380 p_SWIG_PyObj_AsUnsignedLong_t p_SWIG_PyObj_AsUnsignedLong
;
381 p_SWIG_PyObj_AsLongInRange_t p_SWIG_PyObj_AsLongInRange
;
382 p_SWIG_PyObj_AsUnsignedLongInRange_t p_SWIG_PyObj_AsUnsignedLongInRange
;
383 p_SWIG_PyObj_AsNewCharPtr_t p_SWIG_PyObj_AsNewCharPtr
;
384 p_SWIG_PyObj_AsCharPtrAndSize_t p_SWIG_PyObj_AsCharPtrAndSize
;
385 p_SWIG_PyObj_AsCharArray_t p_SWIG_PyObj_AsCharArray
;
386 p_SWIG_PyObj_FromCharArray_t p_SWIG_PyObj_FromCharArray
;
387 p_SWIG_PyObj_AsFloatConv_t p_SWIG_PyObj_AsFloatConv
;
389 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
390 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
391 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
392 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
394 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
395 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
396 void (*p_wxPyBeginBlockThreads
)();
397 void (*p_wxPyEndBlockThreads
)();
399 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
401 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
402 wxString (*p_Py2wxString
)(PyObject
* source
);
403 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
405 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
406 int* (*p_int_LIST_helper
)(PyObject
* source
);
407 long* (*p_long_LIST_helper
)(PyObject
* source
);
408 char** (*p_string_LIST_helper
)(PyObject
* source
);
409 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
410 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
411 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
412 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
414 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
415 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
416 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
417 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
418 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
419 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
422 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
423 bool (*p_wxColour_typecheck
)(PyObject
* source
);
425 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
426 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
427 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
428 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
429 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
431 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
432 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
433 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
434 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
435 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
436 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
437 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
439 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
440 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
441 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
443 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
445 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
446 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
450 #ifdef wxPyUSE_EXPORTED_API
451 // Notice that this is static, not extern. This is by design, each module
452 // needs one, but doesn't have to use it.
453 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
454 #endif // wxPyUSE_EXPORTED_API
456 //---------------------------------------------------------------------------
458 // A wxObject that holds a reference to a Python object
459 class wxPyUserData
: public wxObject
{
461 wxPyUserData(PyObject
* obj
) {
467 #ifdef wxPyUSE_EXPORTED_API
468 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
470 wxPyUserData_dtor(this);
477 // A wxClientData that holds a refernece to a Python object
478 class wxPyClientData
: public wxClientData
{
480 wxPyClientData(PyObject
* obj
) {
486 #ifdef wxPyUSE_EXPORTED_API
487 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
489 wxPyClientData_dtor(this);
496 // Just like wxPyClientData, except when this object is destroyed it does some
497 // OOR magic on the Python Object.
498 class wxPyOORClientData
: public wxPyClientData
{
500 wxPyOORClientData(PyObject
* obj
)
501 : wxPyClientData(obj
) {}
503 ~wxPyOORClientData() {
504 #ifdef wxPyUSE_EXPORTED_API
505 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
507 wxPyOORClientData_dtor(this);
513 //---------------------------------------------------------------------------
514 // This class holds an instance of a Python Shadow Class object and assists
515 // with looking up and invoking Python callback methods from C++ virtual
516 // method redirections. For all classes which have virtuals which should be
517 // overridable in wxPython, a new subclass is created that contains a
518 // wxPyCallbackHelper.
521 class wxPyCallbackHelper
{
523 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
525 wxPyCallbackHelper() {
532 ~wxPyCallbackHelper() {
533 #ifdef wxPyUSE_EXPORTED_API
534 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
536 wxPyCBH_delete(this);
540 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
541 bool findCallback(const char* name
) const;
542 int callCallback(PyObject
* argTuple
) const;
543 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
544 PyObject
* GetLastFound() const { return m_lastFound
; }
549 PyObject
* m_lastFound
;
552 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
556 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
557 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
558 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
559 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
560 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
565 //---------------------------------------------------------------------------
567 // This is used in C++ classes that need to be able to make callback to
568 // "overloaded" python methods
571 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
572 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
574 private: wxPyCallbackHelper m_myInst
577 //---------------------------------------------------------------------------
578 // The wxPythonApp class
581 wxPYAPP_ASSERT_SUPPRESS
= 1,
582 wxPYAPP_ASSERT_EXCEPTION
= 2,
583 wxPYAPP_ASSERT_DIALOG
= 4,
584 wxPYAPP_ASSERT_LOG
= 8
587 class wxPyApp
: public wxApp
589 DECLARE_ABSTRACT_CLASS(wxPyApp
);
597 int GetAssertMode() { return m_assertMode
; }
598 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
600 virtual bool OnInitGui();
601 virtual int OnExit();
603 virtual void OnAssert(const wxChar
*file
,
608 // virtual int FilterEvent(wxEvent& event); // This one too????
611 static bool GetMacSupportPCMenuShortcuts();
612 static long GetMacAboutMenuItemId();
613 static long GetMacPreferencesMenuItemId();
614 static long GetMacExitMenuItemId();
615 static wxString
GetMacHelpMenuTitleName();
617 static void SetMacSupportPCMenuShortcuts(bool val
);
618 static void SetMacAboutMenuItemId(long val
);
619 static void SetMacPreferencesMenuItemId(long val
);
620 static void SetMacExitMenuItemId(long val
);
621 static void SetMacHelpMenuTitleName(const wxString
& val
);
624 void _BootstrapApp();
626 // implementation only
627 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
631 bool m_startupComplete
;
634 extern wxPyApp
*wxPythonApp
;
637 //----------------------------------------------------------------------
638 // These macros are used to implement the virtual methods that should
639 // redirect to a Python method if one exists. The names designate the
640 // return type, if any, as well as any parameter types.
641 //---------------------------------------------------------------------------
643 #define DEC_PYCALLBACK__(CBNAME) \
648 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
649 void CLASS::CBNAME() { \
651 wxPyBeginBlockThreads(); \
652 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
653 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
654 wxPyEndBlockThreads(); \
658 void CLASS::base_##CBNAME() { \
662 //---------------------------------------------------------------------------
664 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
665 bool CBNAME(int a, int b); \
666 bool base_##CBNAME(int a, int b)
669 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
670 bool CLASS::CBNAME(int a, int b) { \
671 bool rval=False, found; \
672 wxPyBeginBlockThreads(); \
673 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
674 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
675 wxPyEndBlockThreads(); \
677 rval = PCLASS::CBNAME(a,b); \
680 bool CLASS::base_##CBNAME(int a, int b) { \
681 return PCLASS::CBNAME(a,b); \
684 //---------------------------------------------------------------------------
686 #define DEC_PYCALLBACK_VOID_(CBNAME) \
691 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
692 void CLASS::CBNAME() { \
694 wxPyBeginBlockThreads(); \
695 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
696 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
697 wxPyEndBlockThreads(); \
701 void CLASS::base_##CBNAME() { \
705 //---------------------------------------------------------------------------
707 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
708 void CBNAME(int a, int b); \
709 void base_##CBNAME(int a, int b)
712 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
713 void CLASS::CBNAME(int a, int b) { \
715 wxPyBeginBlockThreads(); \
716 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
717 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
718 wxPyEndBlockThreads(); \
720 PCLASS::CBNAME(a,b); \
722 void CLASS::base_##CBNAME(int a, int b) { \
723 PCLASS::CBNAME(a,b); \
726 //---------------------------------------------------------------------------
728 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
729 void CBNAME(int a); \
730 void base_##CBNAME(int a)
733 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
734 void CLASS::CBNAME(int a) { \
736 wxPyBeginBlockThreads(); \
737 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
738 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
739 wxPyEndBlockThreads(); \
743 void CLASS::base_##CBNAME(int a) { \
747 //---------------------------------------------------------------------------
749 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
750 void CBNAME(int a, int b, int c, int d); \
751 void base_##CBNAME(int a, int b, int c, int d)
754 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
755 void CLASS::CBNAME(int a, int b, int c, int d) { \
757 wxPyBeginBlockThreads(); \
758 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
759 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
760 wxPyEndBlockThreads(); \
762 PCLASS::CBNAME(a,b,c,d); \
764 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
765 PCLASS::CBNAME(a,b,c,d); \
768 //---------------------------------------------------------------------------
769 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
770 void CBNAME(int a, int b, int c, int d, int e); \
771 void base_##CBNAME(int a, int b, int c, int d, int e)
774 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
775 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
777 wxPyBeginBlockThreads(); \
778 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
779 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
780 wxPyEndBlockThreads(); \
782 PCLASS::CBNAME(a,b,c,d,e); \
784 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
785 PCLASS::CBNAME(a,b,c,d,e); \
788 //---------------------------------------------------------------------------
790 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
791 void CBNAME(int* a, int* b) const; \
792 void base_##CBNAME(int* a, int* b) const
795 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
796 void CLASS::CBNAME(int* a, int* b) const { \
797 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
799 wxPyBeginBlockThreads(); \
800 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
802 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
804 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
805 PyObject* o1 = PySequence_GetItem(ro, 0); \
806 PyObject* o2 = PySequence_GetItem(ro, 1); \
807 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
808 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
811 PyErr_SetString(PyExc_TypeError, errmsg); \
816 PyErr_SetString(PyExc_TypeError, errmsg); \
821 wxPyEndBlockThreads(); \
823 PCLASS::CBNAME(a,b); \
825 void CLASS::base_##CBNAME(int* a, int* b) const { \
826 PCLASS::CBNAME(a,b); \
830 //---------------------------------------------------------------------------
832 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
833 wxSize CBNAME() const; \
834 wxSize base_##CBNAME() const
837 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
838 wxSize CLASS::CBNAME() const { \
839 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
840 bool found; wxSize rval(0,0); \
841 wxPyBeginBlockThreads(); \
842 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
844 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
846 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
847 PyObject* o1 = PySequence_GetItem(ro, 0); \
848 PyObject* o2 = PySequence_GetItem(ro, 1); \
849 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
850 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
853 PyErr_SetString(PyExc_TypeError, errmsg); \
858 PyErr_SetString(PyExc_TypeError, errmsg); \
863 wxPyEndBlockThreads(); \
865 return PCLASS::CBNAME(); \
869 wxSize CLASS::base_##CBNAME() const { \
870 return PCLASS::CBNAME(); \
874 //---------------------------------------------------------------------------
876 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
877 bool CBNAME(bool a); \
878 bool base_##CBNAME(bool a)
881 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
882 bool CLASS::CBNAME(bool a) { \
883 bool rval=False, found; \
884 wxPyBeginBlockThreads(); \
885 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
886 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
887 wxPyEndBlockThreads(); \
889 rval = PCLASS::CBNAME(a); \
892 bool CLASS::base_##CBNAME(bool a) { \
893 return PCLASS::CBNAME(a); \
896 //---------------------------------------------------------------------------
898 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
899 bool CBNAME(int a); \
900 bool base_##CBNAME(int a)
903 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
904 bool CLASS::CBNAME(int a) { \
905 bool rval=False, found; \
906 wxPyBeginBlockThreads(); \
907 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
908 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
909 wxPyEndBlockThreads(); \
911 rval = PCLASS::CBNAME(a); \
914 bool CLASS::base_##CBNAME(int a) { \
915 return PCLASS::CBNAME(a); \
918 //---------------------------------------------------------------------------
920 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
924 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
925 bool CLASS::CBNAME(int a) { \
927 wxPyBeginBlockThreads(); \
928 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
929 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
931 wxPyEndBlockThreads(); \
936 //---------------------------------------------------------------------------
938 #define DEC_PYCALLBACK__DC(CBNAME) \
939 void CBNAME(wxDC& a); \
940 void base_##CBNAME(wxDC& a)
943 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
944 void CLASS::CBNAME(wxDC& a) { \
946 wxPyBeginBlockThreads(); \
947 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
948 PyObject* obj = wxPyMake_wxObject(&a); \
949 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
952 wxPyEndBlockThreads(); \
956 void CLASS::base_##CBNAME(wxDC& a) { \
962 //---------------------------------------------------------------------------
964 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
965 void CBNAME(wxDC& a, bool b); \
966 void base_##CBNAME(wxDC& a, bool b)
969 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
970 void CLASS::CBNAME(wxDC& a, bool b) { \
972 wxPyBeginBlockThreads(); \
973 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
974 PyObject* obj = wxPyMake_wxObject(&a); \
975 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
978 wxPyEndBlockThreads(); \
980 PCLASS::CBNAME(a, b); \
982 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
983 PCLASS::CBNAME(a, b); \
986 //---------------------------------------------------------------------------
988 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
989 void CBNAME(wxDC& a, bool b); \
990 void base_##CBNAME(wxDC& a, bool b)
993 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
994 void CLASS::CBNAME(wxDC& a, bool b) { \
996 wxPyBeginBlockThreads(); \
997 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
998 PyObject* obj = wxPyMake_wxObject(&a); \
999 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1002 wxPyEndBlockThreads(); \
1004 PCLASS::CBNAME(a, b); \
1006 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1007 PCLASS::CBNAME(a, b); \
1010 //---------------------------------------------------------------------------
1012 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1013 void CBNAME(double a, double b); \
1014 void base_##CBNAME(double a, double b)
1017 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1018 void CLASS::CBNAME(double a, double b) { \
1020 wxPyBeginBlockThreads(); \
1021 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1022 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1023 wxPyEndBlockThreads(); \
1025 PCLASS::CBNAME(a, b); \
1027 void CLASS::base_##CBNAME(double a, double b) { \
1028 PCLASS::CBNAME(a, b); \
1031 //---------------------------------------------------------------------------
1033 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1034 void CBNAME(double a, double b, int c, int d); \
1035 void base_##CBNAME(double a, double b, int c, int d)
1038 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1039 void CLASS::CBNAME(double a, double b, int c, int d) { \
1041 wxPyBeginBlockThreads(); \
1042 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1043 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1045 wxPyEndBlockThreads(); \
1047 PCLASS::CBNAME(a, b, c, d); \
1049 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1050 PCLASS::CBNAME(a, b, c, d); \
1053 //---------------------------------------------------------------------------
1055 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1056 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1057 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1060 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1061 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1063 wxPyBeginBlockThreads(); \
1064 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1065 PyObject* obj = wxPyMake_wxObject(&a); \
1066 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1069 wxPyEndBlockThreads(); \
1071 PCLASS::CBNAME(a, b, c, d, e, f); \
1073 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1074 PCLASS::CBNAME(a, b, c, d, e, f); \
1077 //---------------------------------------------------------------------------
1079 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1080 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1081 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1084 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1085 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1087 wxPyBeginBlockThreads(); \
1089 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1090 PyObject* obj = wxPyMake_wxObject(&a); \
1091 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1094 wxPyEndBlockThreads(); \
1096 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1099 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1100 return PCLASS::CBNAME(a, b, c, d, e, f); \
1103 //---------------------------------------------------------------------------
1105 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1106 void CBNAME(bool a, double b, double c, int d, int e); \
1107 void base_##CBNAME(bool a, double b, double c, int d, int e)
1110 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1111 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1113 wxPyBeginBlockThreads(); \
1114 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1115 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1117 wxPyEndBlockThreads(); \
1119 PCLASS::CBNAME(a, b, c, d, e); \
1121 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1122 PCLASS::CBNAME(a, b, c, d, e); \
1125 //---------------------------------------------------------------------------
1127 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1128 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1129 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1132 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1133 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1135 wxPyBeginBlockThreads(); \
1136 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1137 PyObject* obj = wxPyMake_wxObject(&a); \
1138 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1141 wxPyEndBlockThreads(); \
1143 PCLASS::CBNAME(a, b, c, d, e); \
1145 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1146 PCLASS::CBNAME(a, b, c, d, e); \
1149 //---------------------------------------------------------------------------
1151 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1152 void CBNAME(wxDC& a, bool b); \
1153 void base_##CBNAME(wxDC& a, bool b)
1156 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1157 void CLASS::CBNAME(wxDC& a, bool b) { \
1159 wxPyBeginBlockThreads(); \
1160 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1161 PyObject* obj = wxPyMake_wxObject(&a); \
1162 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1165 wxPyEndBlockThreads(); \
1167 PCLASS::CBNAME(a, b); \
1169 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1170 PCLASS::CBNAME(a, b); \
1173 //---------------------------------------------------------------------------
1175 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1176 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1177 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1180 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1181 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1184 wxPyBeginBlockThreads(); \
1185 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1186 PyObject* obj = wxPyMake_wxObject(a); \
1187 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1190 wxPyEndBlockThreads(); \
1192 PCLASS::CBNAME(a, b, c, d, e, f); \
1194 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1196 PCLASS::CBNAME(a, b, c, d, e, f); \
1199 //---------------------------------------------------------------------------
1201 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1202 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1203 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1206 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1207 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1209 wxPyBeginBlockThreads(); \
1210 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1211 PyObject* obj = wxPyMake_wxObject(a); \
1212 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1215 wxPyEndBlockThreads(); \
1217 PCLASS::CBNAME(a, b, c, d, e); \
1219 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1221 PCLASS::CBNAME(a, b, c, d, e); \
1224 //---------------------------------------------------------------------------
1226 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1227 void CBNAME(double a, double b, int c); \
1228 void base_##CBNAME(double a, double b, int c)
1231 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1232 void CLASS::CBNAME(double a, double b, int c) { \
1234 wxPyBeginBlockThreads(); \
1235 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1236 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1237 wxPyEndBlockThreads(); \
1239 PCLASS::CBNAME(a, b, c); \
1241 void CLASS::base_##CBNAME(double a, double b, int c) { \
1242 PCLASS::CBNAME(a, b, c); \
1245 //---------------------------------------------------------------------------
1247 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1248 void CBNAME(bool a, double b, double c, int d); \
1249 void base_##CBNAME(bool a, double b, double c, int d)
1252 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1253 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1255 wxPyBeginBlockThreads(); \
1256 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1257 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1258 wxPyEndBlockThreads(); \
1260 PCLASS::CBNAME(a, b, c, d); \
1262 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1263 PCLASS::CBNAME(a, b, c, d); \
1266 //---------------------------------------------------------------------------
1267 //---------------------------------------------------------------------------
1269 #define DEC_PYCALLBACK__STRING(CBNAME) \
1270 void CBNAME(const wxString& a); \
1271 void base_##CBNAME(const wxString& a)
1273 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1274 void CLASS::CBNAME(const wxString& a) { \
1276 wxPyBeginBlockThreads(); \
1277 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1278 PyObject* s = wx2PyString(a); \
1279 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1282 wxPyEndBlockThreads(); \
1284 PCLASS::CBNAME(a); \
1286 void CLASS::base_##CBNAME(const wxString& a) { \
1287 PCLASS::CBNAME(a); \
1290 //---------------------------------------------------------------------------
1292 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1293 bool CBNAME(const wxString& a); \
1294 bool base_##CBNAME(const wxString& a)
1296 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1297 bool CLASS::CBNAME(const wxString& a) { \
1300 wxPyBeginBlockThreads(); \
1301 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1302 PyObject* s = wx2PyString(a); \
1303 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1306 wxPyEndBlockThreads(); \
1308 rval = PCLASS::CBNAME(a); \
1311 bool CLASS::base_##CBNAME(const wxString& a) { \
1312 return PCLASS::CBNAME(a); \
1315 //---------------------------------------------------------------------------
1317 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1318 bool CBNAME(const wxString& a)
1320 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1321 bool CLASS::CBNAME(const wxString& a) { \
1323 wxPyBeginBlockThreads(); \
1324 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1325 PyObject* s = wx2PyString(a); \
1326 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1329 wxPyEndBlockThreads(); \
1333 //---------------------------------------------------------------------------
1335 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1336 wxString CBNAME(const wxString& a)
1338 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1339 wxString CLASS::CBNAME(const wxString& a) { \
1341 wxPyBeginBlockThreads(); \
1342 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1344 PyObject* s = wx2PyString(a); \
1345 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1348 rval = Py2wxString(ro); \
1352 wxPyEndBlockThreads(); \
1356 //---------------------------------------------------------------------------
1358 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1359 wxString CBNAME(const wxString& a); \
1360 wxString base_##CBNAME(const wxString& a)
1362 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1363 wxString CLASS::CBNAME(const wxString& a) { \
1366 wxPyBeginBlockThreads(); \
1367 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1369 PyObject* s = wx2PyString(a); \
1370 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1373 rval = Py2wxString(ro); \
1378 rval = PCLASS::CBNAME(a); \
1379 wxPyEndBlockThreads(); \
1383 //---------------------------------------------------------------------------
1385 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1386 wxString CBNAME(const wxString& a,int b)
1388 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1389 wxString CLASS::CBNAME(const wxString& a,int b) { \
1391 wxPyBeginBlockThreads(); \
1392 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1394 PyObject* s = wx2PyString(a); \
1395 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1398 rval = Py2wxString(ro); \
1402 wxPyEndBlockThreads(); \
1406 //---------------------------------------------------------------------------
1408 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1409 bool CBNAME(const wxString& a, const wxString& b); \
1410 bool base_##CBNAME(const wxString& a, const wxString& b)
1412 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1413 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1416 wxPyBeginBlockThreads(); \
1417 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1418 PyObject* s1 = wx2PyString(a); \
1419 PyObject* s2 = wx2PyString(b); \
1420 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1424 wxPyEndBlockThreads(); \
1426 rval = PCLASS::CBNAME(a, b); \
1429 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1430 return PCLASS::CBNAME(a, b); \
1433 //---------------------------------------------------------------------------
1435 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1436 wxString CBNAME(); \
1437 wxString base_##CBNAME()
1439 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1440 wxString CLASS::CBNAME() { \
1443 wxPyBeginBlockThreads(); \
1444 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1446 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1448 rval = Py2wxString(ro); \
1452 wxPyEndBlockThreads(); \
1454 rval = PCLASS::CBNAME(); \
1457 wxString CLASS::base_##CBNAME() { \
1458 return PCLASS::CBNAME(); \
1461 //---------------------------------------------------------------------------
1463 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1464 wxString CBNAME() const; \
1465 wxString base_##CBNAME() const;
1467 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1468 wxString CLASS::CBNAME() const { \
1471 wxPyBeginBlockThreads(); \
1472 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1474 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1476 rval = Py2wxString(ro); \
1480 wxPyEndBlockThreads(); \
1482 rval = PCLASS::CBNAME(); \
1485 wxString CLASS::base_##CBNAME() const { \
1486 return PCLASS::CBNAME(); \
1489 //---------------------------------------------------------------------------
1491 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1494 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1495 wxString CLASS::CBNAME() { \
1497 wxPyBeginBlockThreads(); \
1498 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1500 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1502 rval = Py2wxString(ro); \
1506 wxPyEndBlockThreads(); \
1510 //---------------------------------------------------------------------------
1512 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1513 wxString CBNAME() const;
1515 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1516 wxString CLASS::CBNAME() const { \
1518 wxPyBeginBlockThreads(); \
1519 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1521 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1523 rval = Py2wxString(ro); \
1527 wxPyEndBlockThreads(); \
1531 //---------------------------------------------------------------------------
1533 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1534 bool CBNAME(const wxHtmlTag& a)
1537 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1538 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1540 wxPyBeginBlockThreads(); \
1541 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1542 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0); \
1543 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1546 wxPyEndBlockThreads(); \
1550 //---------------------------------------------------------------------------
1552 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1553 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1554 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1556 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1557 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1559 wxPyBeginBlockThreads(); \
1560 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1561 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1562 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1565 wxPyEndBlockThreads(); \
1567 PCLASS::CBNAME(cell, x, y); \
1569 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1570 PCLASS::CBNAME(cell, x, y); \
1574 //---------------------------------------------------------------------------
1576 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1577 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1578 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1580 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1581 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1583 wxPyBeginBlockThreads(); \
1584 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1585 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1586 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1587 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1591 wxPyEndBlockThreads(); \
1593 PCLASS::CBNAME(cell, x, y, e); \
1595 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1596 PCLASS::CBNAME(cell, x, y, e); \
1601 //---------------------------------------------------------------------------
1603 #define DEC_PYCALLBACK___pure(CBNAME) \
1607 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1608 void CLASS::CBNAME() { \
1609 wxPyBeginBlockThreads(); \
1610 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1611 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1612 wxPyEndBlockThreads(); \
1615 //---------------------------------------------------------------------------
1617 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1621 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1622 wxSize CLASS::CBNAME() { \
1623 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1625 wxPyBeginBlockThreads(); \
1626 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1629 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1631 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1633 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1634 PyObject* o1 = PySequence_GetItem(ro, 0); \
1635 PyObject* o2 = PySequence_GetItem(ro, 1); \
1636 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1637 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1639 PyErr_SetString(PyExc_TypeError, errmsg); \
1644 PyErr_SetString(PyExc_TypeError, errmsg); \
1649 wxPyEndBlockThreads(); \
1653 //---------------------------------------------------------------------------
1655 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1656 bool CBNAME(wxWindow* a); \
1657 bool base_##CBNAME(wxWindow* a)
1660 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1661 bool CLASS::CBNAME(wxWindow* a) { \
1664 wxPyBeginBlockThreads(); \
1665 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1666 PyObject* obj = wxPyMake_wxObject(a); \
1667 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1670 wxPyEndBlockThreads(); \
1672 rval = PCLASS::CBNAME(a); \
1675 bool CLASS::base_##CBNAME(wxWindow* a) { \
1676 return PCLASS::CBNAME(a); \
1679 //---------------------------------------------------------------------------
1681 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1682 bool CBNAME(wxWindow* a, wxDC& b); \
1683 bool base_##CBNAME(wxWindow* a, wxDC& b)
1686 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1687 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1690 wxPyBeginBlockThreads(); \
1691 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1692 PyObject* win = wxPyMake_wxObject(a); \
1693 PyObject* dc = wxPyMake_wxObject(&b); \
1694 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1698 wxPyEndBlockThreads(); \
1700 rval = PCLASS::CBNAME(a, b); \
1703 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1704 return PCLASS::CBNAME(a, b); \
1707 //---------------------------------------------------------------------------
1709 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1710 void CBNAME(wxWindowBase* a); \
1711 void base_##CBNAME(wxWindowBase* a)
1714 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1715 void CLASS::CBNAME(wxWindowBase* a) { \
1717 wxPyBeginBlockThreads(); \
1718 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1719 PyObject* obj = wxPyMake_wxObject(a); \
1720 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1723 wxPyEndBlockThreads(); \
1725 PCLASS::CBNAME(a); \
1727 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1728 PCLASS::CBNAME(a); \
1731 //---------------------------------------------------------------------------
1733 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1735 bool base_##CBNAME()
1738 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1739 bool CLASS::CBNAME() { \
1742 wxPyBeginBlockThreads(); \
1743 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1744 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1745 wxPyEndBlockThreads(); \
1747 rval = PCLASS::CBNAME(); \
1750 bool CLASS::base_##CBNAME() { \
1751 return PCLASS::CBNAME(); \
1754 //---------------------------------------------------------------------------
1756 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1757 bool CBNAME() const; \
1758 bool base_##CBNAME() const
1761 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1762 bool CLASS::CBNAME() const { \
1765 wxPyBeginBlockThreads(); \
1766 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1767 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1768 wxPyEndBlockThreads(); \
1770 rval = PCLASS::CBNAME(); \
1773 bool CLASS::base_##CBNAME() const { \
1774 return PCLASS::CBNAME(); \
1777 //---------------------------------------------------------------------------
1779 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1780 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1781 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1784 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1785 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1788 wxPyBeginBlockThreads(); \
1789 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1790 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1791 wxPyEndBlockThreads(); \
1793 rval = PCLASS::CBNAME(a, b, c); \
1794 return (wxDragResult)rval; \
1796 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1797 return PCLASS::CBNAME(a, b, c); \
1800 //---------------------------------------------------------------------------
1802 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1803 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1805 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1806 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1807 wxPyBeginBlockThreads(); \
1809 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1811 PyObject* obj = wxPyMake_wxObject(&a); \
1812 PyObject* s = wx2PyString(b); \
1813 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
1816 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\
1822 wxPyEndBlockThreads(); \
1826 //---------------------------------------------------------------------------
1828 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1829 bool CBNAME(wxDragResult a); \
1830 bool base_##CBNAME(wxDragResult a)
1833 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1834 bool CLASS::CBNAME(wxDragResult a) { \
1837 wxPyBeginBlockThreads(); \
1838 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1839 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
1840 wxPyEndBlockThreads(); \
1842 rval = PCLASS::CBNAME(a); \
1845 bool CLASS::base_##CBNAME(wxDragResult a) { \
1846 return PCLASS::CBNAME(a); \
1849 //---------------------------------------------------------------------------
1851 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1852 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1855 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1856 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1857 wxPyBeginBlockThreads(); \
1859 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1860 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1861 wxPyEndBlockThreads(); \
1862 return (wxDragResult)rval; \
1865 //---------------------------------------------------------------------------
1867 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1868 bool CBNAME(int a, int b, const wxString& c)
1870 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1871 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1873 wxPyBeginBlockThreads(); \
1874 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1875 PyObject* s = wx2PyString(c); \
1876 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1879 wxPyEndBlockThreads(); \
1883 //---------------------------------------------------------------------------
1885 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1887 size_t base_##CBNAME()
1890 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1891 size_t CLASS::CBNAME() { \
1894 wxPyBeginBlockThreads(); \
1895 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1896 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1897 wxPyEndBlockThreads(); \
1899 rval = PCLASS::CBNAME(); \
1902 size_t CLASS::base_##CBNAME() { \
1903 return PCLASS::CBNAME(); \
1906 //---------------------------------------------------------------------------
1908 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1909 size_t CBNAME() const; \
1910 size_t base_##CBNAME() const
1913 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1914 size_t CLASS::CBNAME() const { \
1917 wxPyBeginBlockThreads(); \
1918 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1919 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1920 wxPyEndBlockThreads(); \
1922 rval = PCLASS::CBNAME(); \
1925 size_t CLASS::base_##CBNAME() const { \
1926 return PCLASS::CBNAME(); \
1929 //---------------------------------------------------------------------------
1931 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1932 wxDataFormat CBNAME(size_t a); \
1933 wxDataFormat base_##CBNAME(size_t a)
1936 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1937 wxDataFormat CLASS::CBNAME(size_t a) { \
1938 wxDataFormat rval=0; \
1940 wxPyBeginBlockThreads(); \
1941 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1943 wxDataFormat* ptr; \
1944 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1946 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1951 wxPyEndBlockThreads(); \
1953 rval = PCLASS::CBNAME(a); \
1956 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1957 return PCLASS::CBNAME(a); \
1960 //---------------------------------------------------------------------------
1962 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1963 void CBNAME(const Type& a); \
1964 void base_##CBNAME(const Type& a)
1967 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1968 void CLASS::CBNAME(const Type& a) { \
1970 wxPyBeginBlockThreads(); \
1971 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1972 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1973 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1976 wxPyEndBlockThreads(); \
1978 PCLASS::CBNAME(a); \
1980 void CLASS::base_##CBNAME(const Type& a) { \
1981 PCLASS::CBNAME(a); \
1985 //---------------------------------------------------------------------------
1987 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1988 void CBNAME(Type& a); \
1989 void base_##CBNAME(Type& a)
1992 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1993 void CLASS::CBNAME(Type& a) { \
1995 wxPyBeginBlockThreads(); \
1996 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1997 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1998 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2001 wxPyEndBlockThreads(); \
2003 PCLASS::CBNAME(a); \
2005 void CLASS::base_##CBNAME(Type& a) { \
2006 PCLASS::CBNAME(a); \
2009 //---------------------------------------------------------------------------
2011 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2012 bool CBNAME(Type& a); \
2013 bool base_##CBNAME(Type& a)
2016 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2017 bool CLASS::CBNAME(Type& a) { \
2020 wxPyBeginBlockThreads(); \
2021 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2022 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2023 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2026 wxPyEndBlockThreads(); \
2028 rv = PCLASS::CBNAME(a); \
2031 bool CLASS::base_##CBNAME(Type& a) { \
2032 return PCLASS::CBNAME(a); \
2035 //---------------------------------------------------------------------------
2037 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2038 bool CBNAME(Type& a)
2041 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2042 bool CLASS::CBNAME(Type& a) { \
2044 wxPyBeginBlockThreads(); \
2045 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2046 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2047 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2050 wxPyEndBlockThreads(); \
2054 //---------------------------------------------------------------------------
2056 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2057 wxString CBNAME(long a, long b) const; \
2058 wxString base_##CBNAME(long a, long b) const
2060 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2061 wxString CLASS::CBNAME(long a, long b) const { \
2064 wxPyBeginBlockThreads(); \
2065 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2067 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2069 rval = Py2wxString(ro); \
2073 wxPyEndBlockThreads(); \
2075 rval = PCLASS::CBNAME(a,b); \
2078 wxString CLASS::base_##CBNAME(long a, long b) const { \
2079 return PCLASS::CBNAME(a,b); \
2082 //---------------------------------------------------------------------------
2084 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2085 int CBNAME(long a) const; \
2086 int base_##CBNAME(long a) const
2089 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2090 int CLASS::CBNAME(long a) const { \
2093 wxPyBeginBlockThreads(); \
2094 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2096 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2098 rval = PyInt_AsLong(ro); \
2102 wxPyEndBlockThreads(); \
2104 rval = PCLASS::CBNAME(a); \
2107 int CLASS::base_##CBNAME(long a) const { \
2108 return PCLASS::CBNAME(a); \
2112 //---------------------------------------------------------------------------
2114 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2115 wxListItemAttr* CBNAME(long a) const; \
2116 wxListItemAttr* base_##CBNAME(long a) const
2119 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2120 wxListItemAttr *CLASS::CBNAME(long a) const { \
2121 wxListItemAttr *rval = NULL; \
2123 wxPyBeginBlockThreads(); \
2124 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2126 wxListItemAttr* ptr; \
2127 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2129 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2134 wxPyEndBlockThreads(); \
2136 rval = PCLASS::CBNAME(a); \
2139 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2140 return PCLASS::CBNAME(a); \
2143 //---------------------------------------------------------------------------
2145 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2146 bool CBNAME(wxMouseEvent& e); \
2147 bool base_##CBNAME(wxMouseEvent& e)
2149 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2150 bool CLASS::CBNAME(wxMouseEvent& e) { \
2153 wxPyBeginBlockThreads(); \
2154 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2156 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2157 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2159 rval = PyInt_AsLong(ro); \
2164 wxPyEndBlockThreads(); \
2166 return PCLASS::CBNAME(e); \
2169 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2170 return PCLASS::CBNAME(e); \
2174 //---------------------------------------------------------------------------
2176 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2177 wxWizardPage* CBNAME() const
2179 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2180 wxWizardPage* CLASS::CBNAME() const { \
2181 wxWizardPage* rv = NULL; \
2182 wxPyBeginBlockThreads(); \
2183 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2185 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2187 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2191 wxPyEndBlockThreads(); \
2195 //---------------------------------------------------------------------------
2197 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2198 wxBitmap CBNAME() const
2200 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2201 wxBitmap CLASS::CBNAME() const { \
2203 wxPyBeginBlockThreads(); \
2204 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2207 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2209 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2214 wxPyEndBlockThreads(); \
2218 //---------------------------------------------------------------------------
2220 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2223 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2224 wxObject* CLASS::CBNAME() { \
2225 wxObject* rv = NULL; \
2226 wxPyBeginBlockThreads(); \
2227 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2229 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2231 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2235 wxPyEndBlockThreads(); \
2239 //---------------------------------------------------------------------------
2241 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2242 wxObject* CBNAME(const wxString& a)
2244 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2245 wxObject* CLASS::CBNAME(const wxString& a) { \
2246 wxObject* rv = NULL; \
2247 wxPyBeginBlockThreads(); \
2248 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2249 PyObject* so = wx2PyString(a); \
2251 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2253 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2258 wxPyEndBlockThreads(); \
2262 //---------------------------------------------------------------------------
2264 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2265 bool CBNAME(wxXmlNode* a)
2268 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2269 bool CLASS::CBNAME(wxXmlNode* a) { \
2271 wxPyBeginBlockThreads(); \
2272 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2273 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2274 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2277 wxPyEndBlockThreads(); \
2281 //---------------------------------------------------------------------------
2283 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2284 wxCoord CBNAME(size_t a) const
2287 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2288 wxCoord CLASS::CBNAME(size_t a) const { \
2291 wxPyBeginBlockThreads(); \
2292 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2293 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2295 wxPyEndBlockThreads(); \
2299 //---------------------------------------------------------------------------
2301 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2302 void CBNAME(size_t a, size_t b) const; \
2303 void base_##CBNAME(size_t a, size_t b) const
2306 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2307 void CLASS::CBNAME(size_t a, size_t b) const { \
2309 wxPyBeginBlockThreads(); \
2310 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2311 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2312 wxPyEndBlockThreads(); \
2314 PCLASS::CBNAME(a,b); \
2316 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2317 PCLASS::CBNAME(a,b); \
2320 //---------------------------------------------------------------------------
2322 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2323 wxCoord CBNAME() const; \
2324 wxCoord base_##CBNAME() const
2327 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2328 wxCoord CLASS::CBNAME() const { \
2331 wxPyBeginBlockThreads(); \
2332 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2333 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2334 wxPyEndBlockThreads(); \
2336 rval = PCLASS::CBNAME(); \
2339 wxCoord CLASS::base_##CBNAME() const { \
2340 return PCLASS::CBNAME(); \
2343 //---------------------------------------------------------------------------
2345 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2346 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2349 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2350 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2352 wxPyBeginBlockThreads(); \
2353 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2354 PyObject* obj = wxPyMake_wxObject(&a); \
2355 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2356 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2359 wxPyEndBlockThreads(); \
2362 //---------------------------------------------------------------------------
2364 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2365 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2366 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2369 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2370 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2372 wxPyBeginBlockThreads(); \
2373 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2374 PyObject* obj = wxPyMake_wxObject(&a); \
2375 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2376 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2379 wxPyEndBlockThreads(); \
2381 PCLASS::CBNAME(a,b,c); \
2383 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2384 PCLASS::CBNAME(a,b,c); \
2387 //---------------------------------------------------------------------------
2390 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2391 wxString CBNAME(size_t a) const; \
2392 wxString base_##CBNAME(size_t a) const
2394 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2395 wxString CLASS::CBNAME(size_t a) const { \
2398 wxPyBeginBlockThreads(); \
2399 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2401 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2403 rval = Py2wxString(ro); \
2407 wxPyEndBlockThreads(); \
2409 rval = PCLASS::CBNAME(a); \
2412 wxString CLASS::base_##CBNAME(size_t a) const { \
2413 return PCLASS::CBNAME(a); \
2416 //---------------------------------------------------------------------------
2418 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2419 wxString CBNAME(size_t a) const
2421 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2422 wxString CLASS::CBNAME(size_t a) const { \
2425 wxPyBeginBlockThreads(); \
2426 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2428 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2430 rval = Py2wxString(ro); \
2434 wxPyEndBlockThreads(); \
2438 //---------------------------------------------------------------------------