1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/clipbrd.h>
24 #include <wx/colordlg.h>
25 #include <wx/config.h>
26 #include <wx/cshelp.h>
27 #include <wx/dcmirror.h>
29 #include <wx/dirctrl.h>
30 #include <wx/dirdlg.h>
32 #include <wx/docview.h>
33 #include <wx/encconv.h>
34 #include <wx/fdrepdlg.h>
35 #include <wx/fileconf.h>
36 #include <wx/filesys.h>
37 #include <wx/fontdlg.h>
38 #include <wx/fs_inet.h>
39 #include <wx/fs_mem.h>
40 #include <wx/fs_zip.h>
41 #include <wx/gbsizer.h>
42 #include <wx/geometry.h>
43 #include <wx/htmllbox.h>
45 #include <wx/imaglist.h>
47 #include <wx/laywin.h>
48 #include <wx/listbook.h>
49 #include <wx/minifram.h>
50 #include <wx/notebook.h>
52 #include <wx/printdlg.h>
53 #include <wx/process.h>
54 #include <wx/progdlg.h>
55 #include <wx/sashwin.h>
56 #include <wx/spinbutt.h>
57 #include <wx/spinctrl.h>
58 #include <wx/splash.h>
59 #include <wx/splitter.h>
60 #include <wx/statline.h>
61 #include <wx/stream.h>
62 #include <wx/sysopt.h>
63 #include <wx/taskbar.h>
64 #include <wx/tglbtn.h>
65 #include <wx/tipwin.h>
66 #include <wx/tooltip.h>
68 #include <wx/vscroll.h>
72 # pragma warning(disable:4800)
73 # pragma warning(disable:4190)
76 #ifdef __WXMAC__ // avoid a bug in Carbon headers
80 //---------------------------------------------------------------------------
82 typedef unsigned char byte
;
83 typedef wxPoint2DDouble wxPoint2D
;
85 const bool True
= true;
86 const bool False
= false;
89 #ifndef wxPyUSE_EXPORTED_API
91 void __wxPyPreStart(PyObject
*);
93 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
94 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
97 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
100 bool wxPyCheckSwigType(const wxChar
* className
);
101 PyObject
* wxPyConstructObject(void* ptr
,
102 const wxChar
* className
,
104 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
105 const wxChar
* className
);
106 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
109 PyObject
* wx2PyString(const wxString
& src
);
110 wxString
Py2wxString(PyObject
* source
);
112 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
);
113 PyObject
* wxPyMake_wxSizer(wxSizer
* source
);
114 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
116 PyObject
* wxPy_ConvertList(wxListBase
* list
);
117 long wxPyGetWinHandle(wxWindow
* win
);
119 void wxPy_ReinitStockObjects(int pass
);
121 bool wxPyInstance_Check(PyObject
* obj
);
122 bool wxPySwigInstance_Check(PyObject
* obj
);
125 #endif // wxPyUSE_EXPORTED_API
126 //---------------------------------------------------------------------------
128 // if we want to handle threads and Python threads are available...
129 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
130 #define WXP_WITH_THREAD
131 #else // no Python threads...
132 #undef WXP_WITH_THREAD
135 #ifndef wxPyUSE_EXPORTED_API
137 // For Python --> C++
138 PyThreadState
* wxPyBeginAllowThreads();
139 void wxPyEndAllowThreads(PyThreadState
* state
);
141 // For C++ --> Python
142 bool wxPyBeginBlockThreads();
143 void wxPyEndBlockThreads(bool blocked
);
145 #endif // wxPyUSE_EXPORTED_API
148 // A macro that will help to execute simple statments wrapped in
149 // StartBlock/EndBlockThreads calls
150 #define wxPyBLOCK_THREADS(stmt) \
151 { bool blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
153 // Raise the NotImplementedError exception (blocking threads)
154 #define wxPyRaiseNotImplemented() \
155 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
157 // Raise any exception witha string value (blocking threads)
158 #define wxPyErr_SetString(err, str) \
159 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
162 //---------------------------------------------------------------------------
163 // These are helpers used by the typemaps
165 #ifndef wxPyUSE_EXPORTED_API
167 wxString
* wxString_in_helper(PyObject
* source
);
169 byte
* byte_LIST_helper(PyObject
* source
);
170 int* int_LIST_helper(PyObject
* source
);
171 long* long_LIST_helper(PyObject
* source
);
172 char** string_LIST_helper(PyObject
* source
);
173 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
174 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
175 wxString
* wxString_LIST_helper(PyObject
* source
);
176 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
177 wxPen
** wxPen_LIST_helper(PyObject
* source
);
179 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
180 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
181 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
182 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
183 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
184 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
187 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
188 bool wxColour_typecheck(PyObject
* source
);
192 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
194 // If source is an object instance then it may already be the right type
195 if (wxPySwigInstance_Check(source
)) {
197 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
202 // otherwise a 2-tuple of integers is expected
203 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
204 PyObject
* o1
= PySequence_GetItem(source
, 0);
205 PyObject
* o2
= PySequence_GetItem(source
, 1);
206 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
211 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
219 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
220 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
226 // Other helpful stuff
227 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
228 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
230 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
231 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
233 #endif // wxPyUSE_EXPORTED_API
235 //---------------------------------------------------------------------------
237 #if PYTHON_API_VERSION < 1009
238 #define PySequence_Fast_GET_ITEM(o, i) \
239 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
242 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
243 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
244 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
246 //---------------------------------------------------------------------------
248 #ifndef wxPyUSE_EXPORTED_API
250 class wxPyCallback
: public wxObject
{
251 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
253 wxPyCallback(PyObject
* func
);
254 wxPyCallback(const wxPyCallback
& other
);
257 void EventThunker(wxEvent
& event
);
262 #endif // wxPyUSE_EXPORTED_API
263 //---------------------------------------------------------------------------
264 //---------------------------------------------------------------------------
265 // These Event classes can be derived from in Python and passed through the
266 // event system without loosing anything. They do this by keeping a reference
267 // to themselves and some special case handling in wxPyCallback::EventThunker.
271 class wxPyEvtSelfRef
{
276 void SetSelf(PyObject
* self
, bool clone
=False
);
277 PyObject
* GetSelf() const;
278 bool GetCloned() const { return m_cloned
; }
286 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
287 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
289 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
290 wxPyEvent(const wxPyEvent
& evt
);
293 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
297 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
298 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
300 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
301 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
304 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
309 //----------------------------------------------------------------------
310 // Forward decalre a few things used in the exported API
311 class wxPyClientData
;
313 class wxPyOORClientData
;
314 class wxPyCBInputStream
;
316 void wxPyClientData_dtor(wxPyClientData
* self
);
317 void wxPyUserData_dtor(wxPyUserData
* self
);
318 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
319 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
322 //---------------------------------------------------------------------------
323 // Export a C API in a struct. Other modules will be able to load this from
324 // the wx.core module and will then have safe access to these functions, even if
325 // in another shared library.
327 class wxPyCallbackHelper
;
328 struct swig_type_info
;
329 struct swig_const_info
;
331 typedef double (*py_objasdbl_conv
)(PyObject
*obj
);
333 // Make SunCC happy and make typedef's for these that are extern "C"
334 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
335 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
336 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
337 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
338 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
339 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
340 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
341 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
342 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
343 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
344 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
345 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
346 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
347 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
348 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
349 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
350 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
355 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
356 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
357 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
358 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
359 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
360 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
361 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
362 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
363 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
364 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
365 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
366 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
367 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
368 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
369 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
370 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
371 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
373 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
374 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
375 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
376 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
378 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
379 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
380 bool (*p_wxPyBeginBlockThreads
)();
381 void (*p_wxPyEndBlockThreads
)(bool blocked
);
383 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
385 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
386 wxString (*p_Py2wxString
)(PyObject
* source
);
387 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
389 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
390 int* (*p_int_LIST_helper
)(PyObject
* source
);
391 long* (*p_long_LIST_helper
)(PyObject
* source
);
392 char** (*p_string_LIST_helper
)(PyObject
* source
);
393 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
394 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
395 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
396 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
398 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
399 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
400 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
401 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
402 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
403 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
406 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
407 bool (*p_wxColour_typecheck
)(PyObject
* source
);
409 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
410 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
411 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
412 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
413 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
415 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
);
416 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
);
417 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
418 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
419 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
420 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
421 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
423 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
424 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
425 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
427 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
429 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
430 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
434 #ifdef wxPyUSE_EXPORTED_API
435 // Notice that this is static, not extern. This is by design, each module
436 // needs one, but doesn't have to use it.
437 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
438 #endif // wxPyUSE_EXPORTED_API
440 //---------------------------------------------------------------------------
442 // A wxObject that holds a reference to a Python object
443 class wxPyUserData
: public wxObject
{
445 wxPyUserData(PyObject
* obj
) {
451 #ifdef wxPyUSE_EXPORTED_API
452 wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this);
454 wxPyUserData_dtor(this);
461 // A wxClientData that holds a refernece to a Python object
462 class wxPyClientData
: public wxClientData
{
464 wxPyClientData(PyObject
* obj
) {
470 #ifdef wxPyUSE_EXPORTED_API
471 wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this);
473 wxPyClientData_dtor(this);
480 // Just like wxPyClientData, except when this object is destroyed it does some
481 // OOR magic on the Python Object.
482 class wxPyOORClientData
: public wxPyClientData
{
484 wxPyOORClientData(PyObject
* obj
)
485 : wxPyClientData(obj
) {}
487 ~wxPyOORClientData() {
488 #ifdef wxPyUSE_EXPORTED_API
489 wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this);
491 wxPyOORClientData_dtor(this);
497 //---------------------------------------------------------------------------
498 // This class holds an instance of a Python Shadow Class object and assists
499 // with looking up and invoking Python callback methods from C++ virtual
500 // method redirections. For all classes which have virtuals which should be
501 // overridable in wxPython, a new subclass is created that contains a
502 // wxPyCallbackHelper.
505 class wxPyCallbackHelper
{
507 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
509 wxPyCallbackHelper() {
516 ~wxPyCallbackHelper() {
517 #ifdef wxPyUSE_EXPORTED_API
518 wxPyCoreAPIPtr
->p_wxPyCBH_delete(this);
520 wxPyCBH_delete(this);
524 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
);
525 bool findCallback(const char* name
) const;
526 int callCallback(PyObject
* argTuple
) const;
527 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
528 PyObject
* GetLastFound() const { return m_lastFound
; }
533 PyObject
* m_lastFound
;
536 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
540 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
541 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
542 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
543 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
544 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
549 //---------------------------------------------------------------------------
551 // This is used in C++ classes that need to be able to make callback to
552 // "overloaded" python methods
555 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
556 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
558 private: wxPyCallbackHelper m_myInst
561 //---------------------------------------------------------------------------
562 // The wxPythonApp class
565 wxPYAPP_ASSERT_SUPPRESS
= 1,
566 wxPYAPP_ASSERT_EXCEPTION
= 2,
567 wxPYAPP_ASSERT_DIALOG
= 4,
568 wxPYAPP_ASSERT_LOG
= 8
571 class wxPyApp
: public wxApp
573 DECLARE_ABSTRACT_CLASS(wxPyApp
);
581 int GetAssertMode() { return m_assertMode
; }
582 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
584 virtual bool OnInitGui();
585 virtual int OnExit();
587 virtual void OnAssert(const wxChar
*file
,
592 // virtual int FilterEvent(wxEvent& event); // This one too????
594 // For catching Apple Events
595 virtual void MacOpenFile(const wxString
&fileName
);
596 virtual void MacPrintFile(const wxString
&fileName
);
597 virtual void MacNewFile();
598 virtual void MacReopenApp();
600 static bool GetMacSupportPCMenuShortcuts();
601 static long GetMacAboutMenuItemId();
602 static long GetMacPreferencesMenuItemId();
603 static long GetMacExitMenuItemId();
604 static wxString
GetMacHelpMenuTitleName();
606 static void SetMacSupportPCMenuShortcuts(bool val
);
607 static void SetMacAboutMenuItemId(long val
);
608 static void SetMacPreferencesMenuItemId(long val
);
609 static void SetMacExitMenuItemId(long val
);
610 static void SetMacHelpMenuTitleName(const wxString
& val
);
613 void _BootstrapApp();
615 // implementation only
616 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
620 bool m_startupComplete
;
623 extern wxPyApp
*wxPythonApp
;
626 //----------------------------------------------------------------------
627 // These macros are used to implement the virtual methods that should
628 // redirect to a Python method if one exists. The names designate the
629 // return type, if any, as well as any parameter types.
630 //---------------------------------------------------------------------------
632 #define DEC_PYCALLBACK__(CBNAME) \
637 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
638 void CLASS::CBNAME() { \
640 bool blocked = wxPyBeginBlockThreads(); \
641 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
642 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
643 wxPyEndBlockThreads(blocked); \
647 void CLASS::base_##CBNAME() { \
651 //---------------------------------------------------------------------------
653 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
654 bool CBNAME(int a, int b); \
655 bool base_##CBNAME(int a, int b)
658 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
659 bool CLASS::CBNAME(int a, int b) { \
660 bool rval=False, found; \
661 bool blocked = wxPyBeginBlockThreads(); \
662 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
663 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
664 wxPyEndBlockThreads(blocked); \
666 rval = PCLASS::CBNAME(a,b); \
669 bool CLASS::base_##CBNAME(int a, int b) { \
670 return PCLASS::CBNAME(a,b); \
673 //---------------------------------------------------------------------------
675 #define DEC_PYCALLBACK_VOID_(CBNAME) \
680 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
681 void CLASS::CBNAME() { \
683 bool blocked = wxPyBeginBlockThreads(); \
684 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
685 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
686 wxPyEndBlockThreads(blocked); \
690 void CLASS::base_##CBNAME() { \
694 //---------------------------------------------------------------------------
696 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
697 void CBNAME(int a, int b); \
698 void base_##CBNAME(int a, int b)
701 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
702 void CLASS::CBNAME(int a, int b) { \
704 bool blocked = wxPyBeginBlockThreads(); \
705 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
706 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
707 wxPyEndBlockThreads(blocked); \
709 PCLASS::CBNAME(a,b); \
711 void CLASS::base_##CBNAME(int a, int b) { \
712 PCLASS::CBNAME(a,b); \
715 //---------------------------------------------------------------------------
717 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
718 void CBNAME(int a); \
719 void base_##CBNAME(int a)
722 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
723 void CLASS::CBNAME(int a) { \
725 bool blocked = wxPyBeginBlockThreads(); \
726 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
727 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
728 wxPyEndBlockThreads(blocked); \
732 void CLASS::base_##CBNAME(int a) { \
736 //---------------------------------------------------------------------------
738 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
739 void CBNAME(int a, int b, int c, int d); \
740 void base_##CBNAME(int a, int b, int c, int d)
743 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
744 void CLASS::CBNAME(int a, int b, int c, int d) { \
746 bool blocked = wxPyBeginBlockThreads(); \
747 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
748 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
749 wxPyEndBlockThreads(blocked); \
751 PCLASS::CBNAME(a,b,c,d); \
753 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
754 PCLASS::CBNAME(a,b,c,d); \
757 //---------------------------------------------------------------------------
758 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
759 void CBNAME(int a, int b, int c, int d, int e); \
760 void base_##CBNAME(int a, int b, int c, int d, int e)
763 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
764 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
766 bool blocked = wxPyBeginBlockThreads(); \
767 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
768 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
769 wxPyEndBlockThreads(blocked); \
771 PCLASS::CBNAME(a,b,c,d,e); \
773 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
774 PCLASS::CBNAME(a,b,c,d,e); \
777 //---------------------------------------------------------------------------
779 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
780 void CBNAME(int* a, int* b) const; \
781 void base_##CBNAME(int* a, int* b) const
784 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
785 void CLASS::CBNAME(int* a, int* b) const { \
786 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
788 bool blocked = wxPyBeginBlockThreads(); \
789 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
791 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
793 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
794 PyObject* o1 = PySequence_GetItem(ro, 0); \
795 PyObject* o2 = PySequence_GetItem(ro, 1); \
796 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
797 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
800 PyErr_SetString(PyExc_TypeError, errmsg); \
805 PyErr_SetString(PyExc_TypeError, errmsg); \
810 wxPyEndBlockThreads(blocked); \
812 PCLASS::CBNAME(a,b); \
814 void CLASS::base_##CBNAME(int* a, int* b) const { \
815 PCLASS::CBNAME(a,b); \
819 //---------------------------------------------------------------------------
821 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
822 wxSize CBNAME() const; \
823 wxSize base_##CBNAME() const
826 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
827 wxSize CLASS::CBNAME() const { \
828 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
829 bool found; wxSize rval(0,0); \
830 bool blocked = wxPyBeginBlockThreads(); \
831 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
833 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
835 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
836 PyObject* o1 = PySequence_GetItem(ro, 0); \
837 PyObject* o2 = PySequence_GetItem(ro, 1); \
838 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
839 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
842 PyErr_SetString(PyExc_TypeError, errmsg); \
847 PyErr_SetString(PyExc_TypeError, errmsg); \
852 wxPyEndBlockThreads(blocked); \
854 return PCLASS::CBNAME(); \
858 wxSize CLASS::base_##CBNAME() const { \
859 return PCLASS::CBNAME(); \
863 //---------------------------------------------------------------------------
865 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
866 bool CBNAME(bool a); \
867 bool base_##CBNAME(bool a)
870 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
871 bool CLASS::CBNAME(bool a) { \
872 bool rval=False, found; \
873 bool blocked = wxPyBeginBlockThreads(); \
874 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
875 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
876 wxPyEndBlockThreads(blocked); \
878 rval = PCLASS::CBNAME(a); \
881 bool CLASS::base_##CBNAME(bool a) { \
882 return PCLASS::CBNAME(a); \
885 //---------------------------------------------------------------------------
887 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
888 bool CBNAME(int a); \
889 bool base_##CBNAME(int a)
892 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
893 bool CLASS::CBNAME(int a) { \
894 bool rval=False, found; \
895 bool blocked = wxPyBeginBlockThreads(); \
896 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
897 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
898 wxPyEndBlockThreads(blocked); \
900 rval = PCLASS::CBNAME(a); \
903 bool CLASS::base_##CBNAME(int a) { \
904 return PCLASS::CBNAME(a); \
907 //---------------------------------------------------------------------------
909 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
913 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
914 bool CLASS::CBNAME(int a) { \
916 bool blocked = wxPyBeginBlockThreads(); \
917 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
918 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
920 wxPyEndBlockThreads(blocked); \
925 //---------------------------------------------------------------------------
927 #define DEC_PYCALLBACK__DC(CBNAME) \
928 void CBNAME(wxDC& a); \
929 void base_##CBNAME(wxDC& a)
932 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
933 void CLASS::CBNAME(wxDC& a) { \
935 bool blocked = wxPyBeginBlockThreads(); \
936 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
937 PyObject* obj = wxPyMake_wxObject(&a); \
938 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
941 wxPyEndBlockThreads(blocked); \
945 void CLASS::base_##CBNAME(wxDC& a) { \
951 //---------------------------------------------------------------------------
953 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
954 void CBNAME(wxDC& a, bool b); \
955 void base_##CBNAME(wxDC& a, bool b)
958 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
959 void CLASS::CBNAME(wxDC& a, bool b) { \
961 bool blocked = wxPyBeginBlockThreads(); \
962 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
963 PyObject* obj = wxPyMake_wxObject(&a); \
964 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
967 wxPyEndBlockThreads(blocked); \
969 PCLASS::CBNAME(a, b); \
971 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
972 PCLASS::CBNAME(a, b); \
975 //---------------------------------------------------------------------------
977 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
978 void CBNAME(wxDC& a, bool b); \
979 void base_##CBNAME(wxDC& a, bool b)
982 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
983 void CLASS::CBNAME(wxDC& a, bool b) { \
985 bool blocked = wxPyBeginBlockThreads(); \
986 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
987 PyObject* obj = wxPyMake_wxObject(&a); \
988 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
991 wxPyEndBlockThreads(blocked); \
993 PCLASS::CBNAME(a, b); \
995 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
996 PCLASS::CBNAME(a, b); \
999 //---------------------------------------------------------------------------
1001 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1002 void CBNAME(double a, double b); \
1003 void base_##CBNAME(double a, double b)
1006 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1007 void CLASS::CBNAME(double a, double b) { \
1009 bool blocked = wxPyBeginBlockThreads(); \
1010 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1011 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1012 wxPyEndBlockThreads(blocked); \
1014 PCLASS::CBNAME(a, b); \
1016 void CLASS::base_##CBNAME(double a, double b) { \
1017 PCLASS::CBNAME(a, b); \
1020 //---------------------------------------------------------------------------
1022 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1023 void CBNAME(double a, double b, int c, int d); \
1024 void base_##CBNAME(double a, double b, int c, int d)
1027 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1028 void CLASS::CBNAME(double a, double b, int c, int d) { \
1030 bool blocked = wxPyBeginBlockThreads(); \
1031 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1032 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1034 wxPyEndBlockThreads(blocked); \
1036 PCLASS::CBNAME(a, b, c, d); \
1038 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1039 PCLASS::CBNAME(a, b, c, d); \
1042 //---------------------------------------------------------------------------
1044 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1045 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1046 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1049 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1050 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1052 bool blocked = wxPyBeginBlockThreads(); \
1053 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1054 PyObject* obj = wxPyMake_wxObject(&a); \
1055 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1058 wxPyEndBlockThreads(blocked); \
1060 PCLASS::CBNAME(a, b, c, d, e, f); \
1062 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1063 PCLASS::CBNAME(a, b, c, d, e, f); \
1066 //---------------------------------------------------------------------------
1068 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1069 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1070 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1073 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1074 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1076 bool blocked = wxPyBeginBlockThreads(); \
1078 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1079 PyObject* obj = wxPyMake_wxObject(&a); \
1080 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1083 wxPyEndBlockThreads(blocked); \
1085 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1088 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1089 return PCLASS::CBNAME(a, b, c, d, e, f); \
1092 //---------------------------------------------------------------------------
1094 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1095 void CBNAME(bool a, double b, double c, int d, int e); \
1096 void base_##CBNAME(bool a, double b, double c, int d, int e)
1099 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1100 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1102 bool blocked = wxPyBeginBlockThreads(); \
1103 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1104 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1106 wxPyEndBlockThreads(blocked); \
1108 PCLASS::CBNAME(a, b, c, d, e); \
1110 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1111 PCLASS::CBNAME(a, b, c, d, e); \
1114 //---------------------------------------------------------------------------
1116 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1117 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1118 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1121 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1122 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1124 bool blocked = wxPyBeginBlockThreads(); \
1125 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1126 PyObject* obj = wxPyMake_wxObject(&a); \
1127 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1130 wxPyEndBlockThreads(blocked); \
1132 PCLASS::CBNAME(a, b, c, d, e); \
1134 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1135 PCLASS::CBNAME(a, b, c, d, e); \
1138 //---------------------------------------------------------------------------
1140 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1141 void CBNAME(wxDC& a, bool b); \
1142 void base_##CBNAME(wxDC& a, bool b)
1145 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1146 void CLASS::CBNAME(wxDC& a, bool b) { \
1148 bool blocked = wxPyBeginBlockThreads(); \
1149 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1150 PyObject* obj = wxPyMake_wxObject(&a); \
1151 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1154 wxPyEndBlockThreads(blocked); \
1156 PCLASS::CBNAME(a, b); \
1158 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1159 PCLASS::CBNAME(a, b); \
1162 //---------------------------------------------------------------------------
1164 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1165 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1166 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1169 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1170 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1173 bool blocked = wxPyBeginBlockThreads(); \
1174 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1175 PyObject* obj = wxPyMake_wxObject(a); \
1176 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1179 wxPyEndBlockThreads(blocked); \
1181 PCLASS::CBNAME(a, b, c, d, e, f); \
1183 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1185 PCLASS::CBNAME(a, b, c, d, e, f); \
1188 //---------------------------------------------------------------------------
1190 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1191 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1192 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1195 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1196 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1198 bool blocked = wxPyBeginBlockThreads(); \
1199 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1200 PyObject* obj = wxPyMake_wxObject(a); \
1201 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1204 wxPyEndBlockThreads(blocked); \
1206 PCLASS::CBNAME(a, b, c, d, e); \
1208 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1210 PCLASS::CBNAME(a, b, c, d, e); \
1213 //---------------------------------------------------------------------------
1215 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1216 void CBNAME(double a, double b, int c); \
1217 void base_##CBNAME(double a, double b, int c)
1220 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1221 void CLASS::CBNAME(double a, double b, int c) { \
1223 bool blocked = wxPyBeginBlockThreads(); \
1224 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1225 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1226 wxPyEndBlockThreads(blocked); \
1228 PCLASS::CBNAME(a, b, c); \
1230 void CLASS::base_##CBNAME(double a, double b, int c) { \
1231 PCLASS::CBNAME(a, b, c); \
1234 //---------------------------------------------------------------------------
1236 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1237 void CBNAME(bool a, double b, double c, int d); \
1238 void base_##CBNAME(bool a, double b, double c, int d)
1241 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1242 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1244 bool blocked = wxPyBeginBlockThreads(); \
1245 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1246 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1247 wxPyEndBlockThreads(blocked); \
1249 PCLASS::CBNAME(a, b, c, d); \
1251 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1252 PCLASS::CBNAME(a, b, c, d); \
1255 //---------------------------------------------------------------------------
1256 //---------------------------------------------------------------------------
1258 #define DEC_PYCALLBACK__STRING(CBNAME) \
1259 void CBNAME(const wxString& a); \
1260 void base_##CBNAME(const wxString& a)
1262 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1263 void CLASS::CBNAME(const wxString& a) { \
1265 bool blocked = wxPyBeginBlockThreads(); \
1266 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1267 PyObject* s = wx2PyString(a); \
1268 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1271 wxPyEndBlockThreads(blocked); \
1273 PCLASS::CBNAME(a); \
1275 void CLASS::base_##CBNAME(const wxString& a) { \
1276 PCLASS::CBNAME(a); \
1279 //---------------------------------------------------------------------------
1281 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1282 bool CBNAME(const wxString& a); \
1283 bool base_##CBNAME(const wxString& a)
1285 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1286 bool CLASS::CBNAME(const wxString& a) { \
1289 bool blocked = wxPyBeginBlockThreads(); \
1290 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1291 PyObject* s = wx2PyString(a); \
1292 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1295 wxPyEndBlockThreads(blocked); \
1297 rval = PCLASS::CBNAME(a); \
1300 bool CLASS::base_##CBNAME(const wxString& a) { \
1301 return PCLASS::CBNAME(a); \
1304 //---------------------------------------------------------------------------
1306 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1307 bool CBNAME(const wxString& a)
1309 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1310 bool CLASS::CBNAME(const wxString& a) { \
1312 bool blocked = wxPyBeginBlockThreads(); \
1313 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1314 PyObject* s = wx2PyString(a); \
1315 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1318 wxPyEndBlockThreads(blocked); \
1322 //---------------------------------------------------------------------------
1324 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1325 wxString CBNAME(const wxString& a)
1327 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1328 wxString CLASS::CBNAME(const wxString& a) { \
1330 bool blocked = wxPyBeginBlockThreads(); \
1331 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1333 PyObject* s = wx2PyString(a); \
1334 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1337 rval = Py2wxString(ro); \
1341 wxPyEndBlockThreads(blocked); \
1345 //---------------------------------------------------------------------------
1347 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1348 wxString CBNAME(const wxString& a); \
1349 wxString base_##CBNAME(const wxString& a)
1351 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1352 wxString CLASS::CBNAME(const wxString& a) { \
1355 bool blocked = wxPyBeginBlockThreads(); \
1356 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1358 PyObject* s = wx2PyString(a); \
1359 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1362 rval = Py2wxString(ro); \
1367 rval = PCLASS::CBNAME(a); \
1368 wxPyEndBlockThreads(blocked); \
1372 //---------------------------------------------------------------------------
1374 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1375 wxString CBNAME(const wxString& a,int b)
1377 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1378 wxString CLASS::CBNAME(const wxString& a,int b) { \
1380 bool blocked = wxPyBeginBlockThreads(); \
1381 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1383 PyObject* s = wx2PyString(a); \
1384 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1387 rval = Py2wxString(ro); \
1391 wxPyEndBlockThreads(blocked); \
1395 //---------------------------------------------------------------------------
1397 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1398 bool CBNAME(const wxString& a, const wxString& b); \
1399 bool base_##CBNAME(const wxString& a, const wxString& b)
1401 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1402 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1405 bool blocked = wxPyBeginBlockThreads(); \
1406 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1407 PyObject* s1 = wx2PyString(a); \
1408 PyObject* s2 = wx2PyString(b); \
1409 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1413 wxPyEndBlockThreads(blocked); \
1415 rval = PCLASS::CBNAME(a, b); \
1418 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1419 return PCLASS::CBNAME(a, b); \
1422 //---------------------------------------------------------------------------
1424 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1425 wxString CBNAME(); \
1426 wxString base_##CBNAME()
1428 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1429 wxString CLASS::CBNAME() { \
1432 bool blocked = wxPyBeginBlockThreads(); \
1433 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1435 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1437 rval = Py2wxString(ro); \
1441 wxPyEndBlockThreads(blocked); \
1443 rval = PCLASS::CBNAME(); \
1446 wxString CLASS::base_##CBNAME() { \
1447 return PCLASS::CBNAME(); \
1450 //---------------------------------------------------------------------------
1452 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1453 wxString CBNAME() const; \
1454 wxString base_##CBNAME() const;
1456 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1457 wxString CLASS::CBNAME() const { \
1460 bool blocked = wxPyBeginBlockThreads(); \
1461 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1463 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1465 rval = Py2wxString(ro); \
1469 wxPyEndBlockThreads(blocked); \
1471 rval = PCLASS::CBNAME(); \
1474 wxString CLASS::base_##CBNAME() const { \
1475 return PCLASS::CBNAME(); \
1478 //---------------------------------------------------------------------------
1480 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1483 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1484 wxString CLASS::CBNAME() { \
1486 bool blocked = wxPyBeginBlockThreads(); \
1487 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1489 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1491 rval = Py2wxString(ro); \
1495 wxPyEndBlockThreads(blocked); \
1499 //---------------------------------------------------------------------------
1501 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1502 wxString CBNAME() const;
1504 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1505 wxString CLASS::CBNAME() const { \
1507 bool blocked = wxPyBeginBlockThreads(); \
1508 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1510 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1512 rval = Py2wxString(ro); \
1516 wxPyEndBlockThreads(blocked); \
1520 //---------------------------------------------------------------------------
1522 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1523 bool CBNAME(const wxHtmlTag& a)
1526 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1527 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1529 bool blocked = wxPyBeginBlockThreads(); \
1530 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1531 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1532 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1535 wxPyEndBlockThreads(blocked); \
1539 //---------------------------------------------------------------------------
1541 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1542 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1543 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1545 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1546 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1548 bool blocked = wxPyBeginBlockThreads(); \
1549 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1550 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1551 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1554 wxPyEndBlockThreads(blocked); \
1556 PCLASS::CBNAME(cell, x, y); \
1558 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1559 PCLASS::CBNAME(cell, x, y); \
1562 //---------------------------------------------------------------------------
1564 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1565 void CBNAME(const wxColour& c); \
1566 void base_##CBNAME(const wxColour& c)
1568 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1569 void CLASS::CBNAME(const wxColour& c) { \
1571 bool blocked = wxPyBeginBlockThreads(); \
1572 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1573 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1574 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1577 wxPyEndBlockThreads(blocked); \
1579 PCLASS::CBNAME(c); \
1581 void CLASS::base_##CBNAME(const wxColour& c) { \
1582 PCLASS::CBNAME(c); \
1585 //---------------------------------------------------------------------------
1587 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1588 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1589 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1591 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1592 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1594 bool blocked = wxPyBeginBlockThreads(); \
1595 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1596 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1597 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1598 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1602 wxPyEndBlockThreads(blocked); \
1604 PCLASS::CBNAME(cell, x, y, e); \
1606 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1607 PCLASS::CBNAME(cell, x, y, e); \
1612 //---------------------------------------------------------------------------
1614 #define DEC_PYCALLBACK___pure(CBNAME) \
1618 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1619 void CLASS::CBNAME() { \
1620 bool blocked = wxPyBeginBlockThreads(); \
1621 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1622 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1623 wxPyEndBlockThreads(blocked); \
1626 //---------------------------------------------------------------------------
1628 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1632 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1633 wxSize CLASS::CBNAME() { \
1634 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1636 bool blocked = wxPyBeginBlockThreads(); \
1637 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1640 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1642 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1644 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1645 PyObject* o1 = PySequence_GetItem(ro, 0); \
1646 PyObject* o2 = PySequence_GetItem(ro, 1); \
1647 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1648 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1650 PyErr_SetString(PyExc_TypeError, errmsg); \
1655 PyErr_SetString(PyExc_TypeError, errmsg); \
1660 wxPyEndBlockThreads(blocked); \
1664 //---------------------------------------------------------------------------
1666 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1667 bool CBNAME(wxWindow* a); \
1668 bool base_##CBNAME(wxWindow* a)
1671 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1672 bool CLASS::CBNAME(wxWindow* a) { \
1675 bool blocked = wxPyBeginBlockThreads(); \
1676 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1677 PyObject* obj = wxPyMake_wxObject(a); \
1678 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1681 wxPyEndBlockThreads(blocked); \
1683 rval = PCLASS::CBNAME(a); \
1686 bool CLASS::base_##CBNAME(wxWindow* a) { \
1687 return PCLASS::CBNAME(a); \
1690 //---------------------------------------------------------------------------
1692 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1693 bool CBNAME(wxWindow* a, wxDC& b); \
1694 bool base_##CBNAME(wxWindow* a, wxDC& b)
1697 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1698 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1701 bool blocked = wxPyBeginBlockThreads(); \
1702 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1703 PyObject* win = wxPyMake_wxObject(a); \
1704 PyObject* dc = wxPyMake_wxObject(&b); \
1705 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1709 wxPyEndBlockThreads(blocked); \
1711 rval = PCLASS::CBNAME(a, b); \
1714 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1715 return PCLASS::CBNAME(a, b); \
1718 //---------------------------------------------------------------------------
1720 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1721 void CBNAME(wxWindowBase* a); \
1722 void base_##CBNAME(wxWindowBase* a)
1725 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1726 void CLASS::CBNAME(wxWindowBase* a) { \
1728 bool blocked = wxPyBeginBlockThreads(); \
1729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1730 PyObject* obj = wxPyMake_wxObject(a); \
1731 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1734 wxPyEndBlockThreads(blocked); \
1736 PCLASS::CBNAME(a); \
1738 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1739 PCLASS::CBNAME(a); \
1742 //---------------------------------------------------------------------------
1744 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1746 bool base_##CBNAME()
1749 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1750 bool CLASS::CBNAME() { \
1753 bool blocked = wxPyBeginBlockThreads(); \
1754 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1755 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1756 wxPyEndBlockThreads(blocked); \
1758 rval = PCLASS::CBNAME(); \
1761 bool CLASS::base_##CBNAME() { \
1762 return PCLASS::CBNAME(); \
1765 //---------------------------------------------------------------------------
1767 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1768 bool CBNAME() const; \
1769 bool base_##CBNAME() const
1772 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1773 bool CLASS::CBNAME() const { \
1776 bool blocked = wxPyBeginBlockThreads(); \
1777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1778 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1779 wxPyEndBlockThreads(blocked); \
1781 rval = PCLASS::CBNAME(); \
1784 bool CLASS::base_##CBNAME() const { \
1785 return PCLASS::CBNAME(); \
1788 //---------------------------------------------------------------------------
1790 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1791 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1792 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1795 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1796 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1799 bool blocked = wxPyBeginBlockThreads(); \
1800 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1801 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1802 wxPyEndBlockThreads(blocked); \
1804 rval = PCLASS::CBNAME(a, b, c); \
1805 return (wxDragResult)rval; \
1807 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1808 return PCLASS::CBNAME(a, b, c); \
1811 //---------------------------------------------------------------------------
1813 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1814 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1816 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1817 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1818 bool blocked = wxPyBeginBlockThreads(); \
1820 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1822 PyObject* obj = wxPyMake_wxObject(&a); \
1823 PyObject* s = wx2PyString(b); \
1824 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1827 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE")); \
1833 wxPyEndBlockThreads(blocked); \
1837 //---------------------------------------------------------------------------
1839 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1840 bool CBNAME(wxDragResult a); \
1841 bool base_##CBNAME(wxDragResult a)
1844 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1845 bool CLASS::CBNAME(wxDragResult a) { \
1848 bool blocked = wxPyBeginBlockThreads(); \
1849 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1850 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1851 wxPyEndBlockThreads(blocked); \
1853 rval = PCLASS::CBNAME(a); \
1856 bool CLASS::base_##CBNAME(wxDragResult a) { \
1857 return PCLASS::CBNAME(a); \
1860 //---------------------------------------------------------------------------
1862 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1863 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1866 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1867 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1868 bool blocked = wxPyBeginBlockThreads(); \
1870 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1871 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1872 wxPyEndBlockThreads(blocked); \
1873 return (wxDragResult)rval; \
1876 //---------------------------------------------------------------------------
1878 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1879 bool CBNAME(int a, int b, const wxString& c)
1881 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1882 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1884 bool blocked = wxPyBeginBlockThreads(); \
1885 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1886 PyObject* s = wx2PyString(c); \
1887 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1890 wxPyEndBlockThreads(blocked); \
1894 //---------------------------------------------------------------------------
1896 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1898 size_t base_##CBNAME()
1901 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1902 size_t CLASS::CBNAME() { \
1905 bool blocked = wxPyBeginBlockThreads(); \
1906 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1907 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1908 wxPyEndBlockThreads(blocked); \
1910 rval = PCLASS::CBNAME(); \
1913 size_t CLASS::base_##CBNAME() { \
1914 return PCLASS::CBNAME(); \
1917 //---------------------------------------------------------------------------
1919 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1920 size_t CBNAME() const; \
1921 size_t base_##CBNAME() const
1924 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1925 size_t CLASS::CBNAME() const { \
1928 bool blocked = wxPyBeginBlockThreads(); \
1929 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1930 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1931 wxPyEndBlockThreads(blocked); \
1933 rval = PCLASS::CBNAME(); \
1936 size_t CLASS::base_##CBNAME() const { \
1937 return PCLASS::CBNAME(); \
1940 //---------------------------------------------------------------------------
1942 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1943 wxDataFormat CBNAME(size_t a); \
1944 wxDataFormat base_##CBNAME(size_t a)
1947 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1948 wxDataFormat CLASS::CBNAME(size_t a) { \
1949 wxDataFormat rval=0; \
1951 bool blocked = wxPyBeginBlockThreads(); \
1952 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1954 wxDataFormat* ptr; \
1955 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1957 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1962 wxPyEndBlockThreads(blocked); \
1964 rval = PCLASS::CBNAME(a); \
1967 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1968 return PCLASS::CBNAME(a); \
1971 //---------------------------------------------------------------------------
1973 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1974 void CBNAME(const Type& a); \
1975 void base_##CBNAME(const Type& a)
1978 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1979 void CLASS::CBNAME(const Type& a) { \
1981 bool blocked = wxPyBeginBlockThreads(); \
1982 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1983 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1984 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1987 wxPyEndBlockThreads(blocked); \
1989 PCLASS::CBNAME(a); \
1991 void CLASS::base_##CBNAME(const Type& a) { \
1992 PCLASS::CBNAME(a); \
1996 //---------------------------------------------------------------------------
1998 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1999 void CBNAME(Type& a); \
2000 void base_##CBNAME(Type& a)
2003 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2004 void CLASS::CBNAME(Type& a) { \
2006 bool blocked = wxPyBeginBlockThreads(); \
2007 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2008 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2009 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2012 wxPyEndBlockThreads(blocked); \
2014 PCLASS::CBNAME(a); \
2016 void CLASS::base_##CBNAME(Type& a) { \
2017 PCLASS::CBNAME(a); \
2020 //---------------------------------------------------------------------------
2022 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2023 bool CBNAME(Type& a); \
2024 bool base_##CBNAME(Type& a)
2027 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2028 bool CLASS::CBNAME(Type& a) { \
2031 bool blocked = wxPyBeginBlockThreads(); \
2032 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2033 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2034 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2037 wxPyEndBlockThreads(blocked); \
2039 rv = PCLASS::CBNAME(a); \
2042 bool CLASS::base_##CBNAME(Type& a) { \
2043 return PCLASS::CBNAME(a); \
2046 //---------------------------------------------------------------------------
2048 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2049 bool CBNAME(Type& a)
2052 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2053 bool CLASS::CBNAME(Type& a) { \
2055 bool blocked = wxPyBeginBlockThreads(); \
2056 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2057 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2058 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2061 wxPyEndBlockThreads(blocked); \
2065 //---------------------------------------------------------------------------
2067 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2068 wxString CBNAME(long a, long b) const; \
2069 wxString base_##CBNAME(long a, long b) const
2071 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2072 wxString CLASS::CBNAME(long a, long b) const { \
2075 bool blocked = wxPyBeginBlockThreads(); \
2076 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2078 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2080 rval = Py2wxString(ro); \
2084 wxPyEndBlockThreads(blocked); \
2086 rval = PCLASS::CBNAME(a,b); \
2089 wxString CLASS::base_##CBNAME(long a, long b) const { \
2090 return PCLASS::CBNAME(a,b); \
2093 //---------------------------------------------------------------------------
2095 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2096 int CBNAME(long a) const; \
2097 int base_##CBNAME(long a) const
2100 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2101 int CLASS::CBNAME(long a) const { \
2104 bool blocked = wxPyBeginBlockThreads(); \
2105 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2107 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2109 rval = PyInt_AsLong(ro); \
2113 wxPyEndBlockThreads(blocked); \
2115 rval = PCLASS::CBNAME(a); \
2118 int CLASS::base_##CBNAME(long a) const { \
2119 return PCLASS::CBNAME(a); \
2123 //---------------------------------------------------------------------------
2125 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2126 wxListItemAttr* CBNAME(long a) const; \
2127 wxListItemAttr* base_##CBNAME(long a) const
2130 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2131 wxListItemAttr *CLASS::CBNAME(long a) const { \
2132 wxListItemAttr *rval = NULL; \
2134 bool blocked = wxPyBeginBlockThreads(); \
2135 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2137 wxListItemAttr* ptr; \
2138 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2140 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2145 wxPyEndBlockThreads(blocked); \
2147 rval = PCLASS::CBNAME(a); \
2150 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2151 return PCLASS::CBNAME(a); \
2154 //---------------------------------------------------------------------------
2156 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2157 bool CBNAME(wxMouseEvent& e); \
2158 bool base_##CBNAME(wxMouseEvent& e)
2160 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2161 bool CLASS::CBNAME(wxMouseEvent& e) { \
2164 bool blocked = wxPyBeginBlockThreads(); \
2165 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2167 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2168 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2170 rval = PyInt_AsLong(ro); \
2175 wxPyEndBlockThreads(blocked); \
2177 return PCLASS::CBNAME(e); \
2180 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2181 return PCLASS::CBNAME(e); \
2185 //---------------------------------------------------------------------------
2187 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2188 wxWizardPage* CBNAME() const
2190 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2191 wxWizardPage* CLASS::CBNAME() const { \
2192 wxWizardPage* rv = NULL; \
2193 bool blocked = wxPyBeginBlockThreads(); \
2194 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2196 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2198 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2202 wxPyEndBlockThreads(blocked); \
2206 //---------------------------------------------------------------------------
2208 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2209 wxBitmap CBNAME() const
2211 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2212 wxBitmap CLASS::CBNAME() const { \
2214 bool blocked = wxPyBeginBlockThreads(); \
2215 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2218 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2220 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2225 wxPyEndBlockThreads(blocked); \
2229 //---------------------------------------------------------------------------
2231 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2234 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2235 wxObject* CLASS::CBNAME() { \
2236 wxObject* rv = NULL; \
2237 bool blocked = wxPyBeginBlockThreads(); \
2238 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2240 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2242 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2246 wxPyEndBlockThreads(blocked); \
2250 //---------------------------------------------------------------------------
2252 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2253 wxObject* CBNAME(const wxString& a)
2255 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2256 wxObject* CLASS::CBNAME(const wxString& a) { \
2257 wxObject* rv = NULL; \
2258 bool blocked = wxPyBeginBlockThreads(); \
2259 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2260 PyObject* so = wx2PyString(a); \
2262 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2264 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2269 wxPyEndBlockThreads(blocked); \
2273 //---------------------------------------------------------------------------
2275 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2276 bool CBNAME(wxXmlNode* a)
2279 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2280 bool CLASS::CBNAME(wxXmlNode* a) { \
2282 bool blocked = wxPyBeginBlockThreads(); \
2283 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2284 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2285 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2288 wxPyEndBlockThreads(blocked); \
2292 //---------------------------------------------------------------------------
2294 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2295 wxCoord CBNAME(size_t a) const
2298 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2299 wxCoord CLASS::CBNAME(size_t a) const { \
2302 bool blocked = wxPyBeginBlockThreads(); \
2303 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2304 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2306 wxPyEndBlockThreads(blocked); \
2310 //---------------------------------------------------------------------------
2312 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2313 void CBNAME(size_t a, size_t b) const; \
2314 void base_##CBNAME(size_t a, size_t b) const
2317 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2318 void CLASS::CBNAME(size_t a, size_t b) const { \
2320 bool blocked = wxPyBeginBlockThreads(); \
2321 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2322 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2323 wxPyEndBlockThreads(blocked); \
2325 PCLASS::CBNAME(a,b); \
2327 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2328 PCLASS::CBNAME(a,b); \
2331 //---------------------------------------------------------------------------
2333 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2334 wxCoord CBNAME() const; \
2335 wxCoord base_##CBNAME() const
2338 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2339 wxCoord CLASS::CBNAME() const { \
2342 bool blocked = wxPyBeginBlockThreads(); \
2343 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2344 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2345 wxPyEndBlockThreads(blocked); \
2347 rval = PCLASS::CBNAME(); \
2350 wxCoord CLASS::base_##CBNAME() const { \
2351 return PCLASS::CBNAME(); \
2354 //---------------------------------------------------------------------------
2356 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2357 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2360 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2361 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2363 bool blocked = wxPyBeginBlockThreads(); \
2364 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2365 PyObject* obj = wxPyMake_wxObject(&a); \
2366 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2367 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2370 wxPyEndBlockThreads(blocked); \
2373 //---------------------------------------------------------------------------
2375 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2376 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2377 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2380 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2381 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2383 bool blocked = wxPyBeginBlockThreads(); \
2384 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2385 PyObject* obj = wxPyMake_wxObject(&a); \
2386 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2387 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2390 wxPyEndBlockThreads(blocked); \
2392 PCLASS::CBNAME(a,b,c); \
2394 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2395 PCLASS::CBNAME(a,b,c); \
2398 //---------------------------------------------------------------------------
2401 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2402 wxString CBNAME(size_t a) const; \
2403 wxString base_##CBNAME(size_t a) const
2405 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2406 wxString CLASS::CBNAME(size_t a) const { \
2409 bool blocked = wxPyBeginBlockThreads(); \
2410 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2412 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2414 rval = Py2wxString(ro); \
2418 wxPyEndBlockThreads(blocked); \
2420 rval = PCLASS::CBNAME(a); \
2423 wxString CLASS::base_##CBNAME(size_t a) const { \
2424 return PCLASS::CBNAME(a); \
2427 //---------------------------------------------------------------------------
2429 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2430 wxString CBNAME(size_t a) const
2432 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2433 wxString CLASS::CBNAME(size_t a) const { \
2436 bool blocked = wxPyBeginBlockThreads(); \
2437 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2439 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2441 rval = Py2wxString(ro); \
2445 wxPyEndBlockThreads(blocked); \
2449 //---------------------------------------------------------------------------