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/choicebk.h>
24 #include <wx/clipbrd.h>
25 #include <wx/colordlg.h>
26 #include <wx/config.h>
27 #include <wx/cshelp.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>
70 #include <wx/dateevt.h>
71 #include <wx/datectrl.h>
76 # pragma warning(disable:4800)
77 # pragma warning(disable:4190)
80 #ifdef __WXMAC__ // avoid a bug in Carbon headers
84 //---------------------------------------------------------------------------
86 typedef unsigned char byte
;
87 typedef wxPoint2DDouble wxPoint2D
;
90 #ifndef wxPyUSE_EXPORTED_API
92 void __wxPyPreStart(PyObject
*);
94 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
95 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
97 void wxSetDefaultPyEncoding(const char* encoding
);
98 const char* wxGetDefaultPyEncoding();
101 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
104 bool wxPyCheckSwigType(const wxChar
* className
);
105 PyObject
* wxPyConstructObject(void* ptr
,
106 const wxChar
* className
,
108 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
109 const wxChar
* className
);
110 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
113 PyObject
* wx2PyString(const wxString
& src
);
114 wxString
Py2wxString(PyObject
* source
);
116 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
117 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
118 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
120 PyObject
* wxPy_ConvertList(wxListBase
* list
);
121 long wxPyGetWinHandle(wxWindow
* win
);
123 void wxPy_ReinitStockObjects(int pass
);
125 bool wxPyInstance_Check(PyObject
* obj
);
126 bool wxPySwigInstance_Check(PyObject
* obj
);
129 #endif // wxPyUSE_EXPORTED_API
130 //---------------------------------------------------------------------------
132 // if we want to handle threads and Python threads are available...
133 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
134 #define WXP_WITH_THREAD
135 #else // no Python threads...
136 #undef WXP_WITH_THREAD
140 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
141 // blocking threads when calling back into Python. Using them instead of my
142 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
143 // wxPyEndBlockThreads.
145 // Unfortunatly there is a bug somewhere when using these new APIs on Python
146 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
147 // at breakpoints located in event handlers. I think that the cause may be
148 // something like the original PyThreadState for the main thread is not being
149 // restored for the callbacks, but I can't see where that could be
150 // happening... So we'll only activate this new change for Python 2.4+ :-(
152 #if PY_VERSION_HEX < 0x02040000
153 #define wxPyUSE_GIL_STATE 0
154 typedef bool wxPyBlock_t
;
156 #define wxPyUSE_GIL_STATE 1
157 typedef PyGILState_STATE wxPyBlock_t
;
161 #ifndef wxPyUSE_EXPORTED_API
163 // For Python --> C++
164 PyThreadState
* wxPyBeginAllowThreads();
165 void wxPyEndAllowThreads(PyThreadState
* state
);
167 // For C++ --> Python
168 wxPyBlock_t
wxPyBeginBlockThreads();
169 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
171 #endif // wxPyUSE_EXPORTED_API
174 // A macro that will help to execute simple statments wrapped in
175 // StartBlock/EndBlockThreads calls
176 #define wxPyBLOCK_THREADS(stmt) \
177 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
179 // Raise the NotImplementedError exception (blocking threads)
180 #define wxPyRaiseNotImplemented() \
181 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
183 // Raise any exception with a string value (blocking threads)
184 #define wxPyErr_SetString(err, str) \
185 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
188 //---------------------------------------------------------------------------
189 // These are helpers used by the typemaps
191 #ifndef wxPyUSE_EXPORTED_API
193 wxString
* wxString_in_helper(PyObject
* source
);
195 byte
* byte_LIST_helper(PyObject
* source
);
196 int* int_LIST_helper(PyObject
* source
);
197 long* long_LIST_helper(PyObject
* source
);
198 char** string_LIST_helper(PyObject
* source
);
199 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
200 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
201 wxString
* wxString_LIST_helper(PyObject
* source
);
202 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
203 wxPen
** wxPen_LIST_helper(PyObject
* source
);
205 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
206 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
207 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
208 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
209 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
210 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
213 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
214 bool wxColour_typecheck(PyObject
* source
);
216 bool wxPyCheckForApp();
220 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
222 // If source is an object instance then it may already be the right type
223 if (wxPySwigInstance_Check(source
)) {
225 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
230 // otherwise a 2-tuple of integers is expected
231 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
232 PyObject
* o1
= PySequence_GetItem(source
, 0);
233 PyObject
* o2
= PySequence_GetItem(source
, 1);
234 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
239 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
247 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
248 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
254 // Other helpful stuff
255 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
256 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
258 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
259 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
261 #endif // wxPyUSE_EXPORTED_API
263 //---------------------------------------------------------------------------
265 #if PYTHON_API_VERSION < 1009
266 #define PySequence_Fast_GET_ITEM(o, i) \
267 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
270 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
271 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
272 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
274 //---------------------------------------------------------------------------
276 #ifndef wxPyUSE_EXPORTED_API
278 class wxPyCallback
: public wxObject
{
279 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
281 wxPyCallback(PyObject
* func
);
282 wxPyCallback(const wxPyCallback
& other
);
285 void EventThunker(wxEvent
& event
);
290 #endif // wxPyUSE_EXPORTED_API
291 //---------------------------------------------------------------------------
292 //---------------------------------------------------------------------------
293 // These Event classes can be derived from in Python and passed through the
294 // event system without loosing anything. They do this by keeping a reference
295 // to themselves and some special case handling in wxPyCallback::EventThunker.
299 class wxPyEvtSelfRef
{
304 void SetSelf(PyObject
* self
, bool clone
=false);
305 PyObject
* GetSelf() const;
306 bool GetCloned() const { return m_cloned
; }
314 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
315 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
317 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
318 wxPyEvent(const wxPyEvent
& evt
);
321 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
325 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
326 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
328 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
329 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
332 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
337 //----------------------------------------------------------------------
338 // Forward decalre a few things used in the exported API
339 class wxPyClientData
;
341 class wxPyOORClientData
;
342 class wxPyCBInputStream
;
344 void wxPyClientData_dtor(wxPyClientData
* self
);
345 void wxPyUserData_dtor(wxPyUserData
* self
);
346 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
347 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
348 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
350 //---------------------------------------------------------------------------
351 // Export a C API in a struct. Other modules will be able to load this from
352 // the wx.core module and will then have safe access to these functions, even if
353 // in another shared library.
355 class wxPyCallbackHelper
;
359 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
360 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
361 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
362 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
364 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
365 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
366 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
367 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
369 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
371 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
372 wxString (*p_Py2wxString
)(PyObject
* source
);
373 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
375 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
376 int* (*p_int_LIST_helper
)(PyObject
* source
);
377 long* (*p_long_LIST_helper
)(PyObject
* source
);
378 char** (*p_string_LIST_helper
)(PyObject
* source
);
379 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
380 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
381 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
382 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
384 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
385 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
386 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
387 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
388 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
389 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
392 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
393 bool (*p_wxColour_typecheck
)(PyObject
* source
);
395 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
396 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
397 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
398 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
399 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
401 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
402 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
403 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
404 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
405 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
406 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
407 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
409 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
410 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
411 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
413 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
414 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
416 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
417 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
419 bool (*p_wxPyCheckForApp
)();
423 #ifdef wxPyUSE_EXPORTED_API
424 // Notice that this is static, not extern. This is by design, each module
425 // needs one, but doesn't have to use it.
426 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
427 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
428 #endif // wxPyUSE_EXPORTED_API
430 //---------------------------------------------------------------------------
432 // A wxObject that holds a reference to a Python object
433 class wxPyUserData
: public wxObject
{
435 wxPyUserData(PyObject
* obj
) {
441 #ifdef wxPyUSE_EXPORTED_API
442 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
444 wxPyUserData_dtor(this);
451 // A wxClientData that holds a refernece to a Python object
452 class wxPyClientData
: public wxClientData
{
454 wxPyClientData(PyObject
* obj
, bool incref
=true) {
462 #ifdef wxPyUSE_EXPORTED_API
463 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
465 wxPyClientData_dtor(this);
473 // Just like wxPyClientData, except when this object is destroyed it does some
474 // OOR magic on the Python Object.
475 class wxPyOORClientData
: public wxPyClientData
{
477 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
478 : wxPyClientData(obj
, incref
) {}
479 ~wxPyOORClientData() {
481 #ifdef wxPyUSE_EXPORTED_API
482 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
484 wxPyOORClientData_dtor(this);
490 //---------------------------------------------------------------------------
491 // This class holds an instance of a Python Shadow Class object and assists
492 // with looking up and invoking Python callback methods from C++ virtual
493 // method redirections. For all classes which have virtuals which should be
494 // overridable in wxPython, a new subclass is created that contains a
495 // wxPyCallbackHelper.
498 class wxPyCallbackHelper
{
500 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
502 wxPyCallbackHelper() {
509 ~wxPyCallbackHelper() {
510 #ifdef wxPyUSE_EXPORTED_API
511 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
513 wxPyCBH_delete(this);
517 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
518 bool findCallback(const char* name
) const;
519 int callCallback(PyObject
* argTuple
) const;
520 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
521 PyObject
* GetLastFound() const { return m_lastFound
; }
526 PyObject
* m_lastFound
;
529 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
533 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
534 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
535 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
536 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
537 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
542 //---------------------------------------------------------------------------
544 // This is used in C++ classes that need to be able to make callback to
545 // "overloaded" python methods
548 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
549 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
551 private: wxPyCallbackHelper m_myInst
554 //---------------------------------------------------------------------------
555 // The wxPythonApp class
558 wxPYAPP_ASSERT_SUPPRESS
= 1,
559 wxPYAPP_ASSERT_EXCEPTION
= 2,
560 wxPYAPP_ASSERT_DIALOG
= 4,
561 wxPYAPP_ASSERT_LOG
= 8
564 class wxPyApp
: public wxApp
566 DECLARE_ABSTRACT_CLASS(wxPyApp
);
574 int GetAssertMode() { return m_assertMode
; }
575 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
577 virtual bool OnInitGui();
578 virtual int OnExit();
580 virtual void OnAssert(const wxChar
*file
,
585 // virtual int FilterEvent(wxEvent& event); // This one too????
587 // For catching Apple Events
588 virtual void MacOpenFile(const wxString
&fileName
);
589 virtual void MacPrintFile(const wxString
&fileName
);
590 virtual void MacNewFile();
591 virtual void MacReopenApp();
593 static bool GetMacSupportPCMenuShortcuts();
594 static long GetMacAboutMenuItemId();
595 static long GetMacPreferencesMenuItemId();
596 static long GetMacExitMenuItemId();
597 static wxString
GetMacHelpMenuTitleName();
599 static void SetMacSupportPCMenuShortcuts(bool val
);
600 static void SetMacAboutMenuItemId(long val
);
601 static void SetMacPreferencesMenuItemId(long val
);
602 static void SetMacExitMenuItemId(long val
);
603 static void SetMacHelpMenuTitleName(const wxString
& val
);
606 void _BootstrapApp();
608 // implementation only
609 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
613 bool m_startupComplete
;
616 extern wxPyApp
*wxPythonApp
;
619 //----------------------------------------------------------------------
620 // These macros are used to implement the virtual methods that should
621 // redirect to a Python method if one exists. The names designate the
622 // return type, if any, as well as any parameter types.
623 //---------------------------------------------------------------------------
625 #define DEC_PYCALLBACK__(CBNAME) \
630 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
631 void CLASS::CBNAME() { \
633 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
634 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
635 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
636 wxPyEndBlockThreads(blocked); \
640 void CLASS::base_##CBNAME() { \
644 //---------------------------------------------------------------------------
646 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
647 bool CBNAME(int a, int b); \
648 bool base_##CBNAME(int a, int b)
651 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
652 bool CLASS::CBNAME(int a, int b) { \
653 bool rval=false, found; \
654 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
655 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
656 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
657 wxPyEndBlockThreads(blocked); \
659 rval = PCLASS::CBNAME(a,b); \
662 bool CLASS::base_##CBNAME(int a, int b) { \
663 return PCLASS::CBNAME(a,b); \
666 //---------------------------------------------------------------------------
668 #define DEC_PYCALLBACK_VOID_(CBNAME) \
673 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
674 void CLASS::CBNAME() { \
676 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
677 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
678 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
679 wxPyEndBlockThreads(blocked); \
683 void CLASS::base_##CBNAME() { \
687 //---------------------------------------------------------------------------
689 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
690 void CBNAME(int a, int b); \
691 void base_##CBNAME(int a, int b)
694 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
695 void CLASS::CBNAME(int a, int b) { \
697 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
698 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
699 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
700 wxPyEndBlockThreads(blocked); \
702 PCLASS::CBNAME(a,b); \
704 void CLASS::base_##CBNAME(int a, int b) { \
705 PCLASS::CBNAME(a,b); \
708 //---------------------------------------------------------------------------
710 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
711 void CBNAME(int a); \
712 void base_##CBNAME(int a)
715 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
716 void CLASS::CBNAME(int a) { \
718 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
719 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
720 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
721 wxPyEndBlockThreads(blocked); \
725 void CLASS::base_##CBNAME(int a) { \
729 //---------------------------------------------------------------------------
731 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
732 void CBNAME(int a, int b, int c, int d); \
733 void base_##CBNAME(int a, int b, int c, int d)
736 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
737 void CLASS::CBNAME(int a, int b, int c, int d) { \
739 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
740 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
741 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
742 wxPyEndBlockThreads(blocked); \
744 PCLASS::CBNAME(a,b,c,d); \
746 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
747 PCLASS::CBNAME(a,b,c,d); \
750 //---------------------------------------------------------------------------
751 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
752 void CBNAME(int a, int b, int c, int d, int e); \
753 void base_##CBNAME(int a, int b, int c, int d, int e)
756 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
757 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
759 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
760 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
761 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
762 wxPyEndBlockThreads(blocked); \
764 PCLASS::CBNAME(a,b,c,d,e); \
766 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
767 PCLASS::CBNAME(a,b,c,d,e); \
770 //---------------------------------------------------------------------------
772 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
773 void CBNAME(int* a, int* b) const; \
774 void base_##CBNAME(int* a, int* b) const
777 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
778 void CLASS::CBNAME(int* a, int* b) const { \
779 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
781 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
782 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
784 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
786 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
787 PyObject* o1 = PySequence_GetItem(ro, 0); \
788 PyObject* o2 = PySequence_GetItem(ro, 1); \
789 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
790 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
793 PyErr_SetString(PyExc_TypeError, errmsg); \
798 PyErr_SetString(PyExc_TypeError, errmsg); \
803 wxPyEndBlockThreads(blocked); \
805 PCLASS::CBNAME(a,b); \
807 void CLASS::base_##CBNAME(int* a, int* b) const { \
808 PCLASS::CBNAME(a,b); \
812 //---------------------------------------------------------------------------
814 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
815 wxSize CBNAME() const; \
816 wxSize base_##CBNAME() const
819 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
820 wxSize CLASS::CBNAME() const { \
821 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
822 bool found; wxSize rval(0,0); \
823 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
824 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
826 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
828 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
829 PyObject* o1 = PySequence_GetItem(ro, 0); \
830 PyObject* o2 = PySequence_GetItem(ro, 1); \
831 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
832 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
835 PyErr_SetString(PyExc_TypeError, errmsg); \
840 PyErr_SetString(PyExc_TypeError, errmsg); \
845 wxPyEndBlockThreads(blocked); \
847 return PCLASS::CBNAME(); \
851 wxSize CLASS::base_##CBNAME() const { \
852 return PCLASS::CBNAME(); \
856 //---------------------------------------------------------------------------
858 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
859 bool CBNAME(bool a); \
860 bool base_##CBNAME(bool a)
863 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
864 bool CLASS::CBNAME(bool a) { \
865 bool rval=false, found; \
866 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
868 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
869 wxPyEndBlockThreads(blocked); \
871 rval = PCLASS::CBNAME(a); \
874 bool CLASS::base_##CBNAME(bool a) { \
875 return PCLASS::CBNAME(a); \
878 //---------------------------------------------------------------------------
880 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
881 bool CBNAME(int a); \
882 bool base_##CBNAME(int a)
885 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
886 bool CLASS::CBNAME(int a) { \
887 bool rval=false, found; \
888 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
889 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
890 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
891 wxPyEndBlockThreads(blocked); \
893 rval = PCLASS::CBNAME(a); \
896 bool CLASS::base_##CBNAME(int a) { \
897 return PCLASS::CBNAME(a); \
900 //---------------------------------------------------------------------------
902 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
906 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
907 bool CLASS::CBNAME(int a) { \
909 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
910 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
911 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
913 wxPyEndBlockThreads(blocked); \
918 //---------------------------------------------------------------------------
920 #define DEC_PYCALLBACK__DC(CBNAME) \
921 void CBNAME(wxDC& a); \
922 void base_##CBNAME(wxDC& a)
925 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
926 void CLASS::CBNAME(wxDC& a) { \
928 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
929 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
930 PyObject* obj = wxPyMake_wxObject(&a,false); \
931 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
934 wxPyEndBlockThreads(blocked); \
938 void CLASS::base_##CBNAME(wxDC& a) { \
944 //---------------------------------------------------------------------------
946 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
947 void CBNAME(wxDC& a, bool b); \
948 void base_##CBNAME(wxDC& a, bool b)
951 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
952 void CLASS::CBNAME(wxDC& a, bool b) { \
954 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
955 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
956 PyObject* obj = wxPyMake_wxObject(&a,false); \
957 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
960 wxPyEndBlockThreads(blocked); \
962 PCLASS::CBNAME(a, b); \
964 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
965 PCLASS::CBNAME(a, b); \
968 //---------------------------------------------------------------------------
970 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
971 void CBNAME(wxDC& a, bool b); \
972 void base_##CBNAME(wxDC& a, bool b)
975 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
976 void CLASS::CBNAME(wxDC& a, bool b) { \
978 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
979 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
980 PyObject* obj = wxPyMake_wxObject(&a,false); \
981 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
984 wxPyEndBlockThreads(blocked); \
986 PCLASS::CBNAME(a, b); \
988 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
989 PCLASS::CBNAME(a, b); \
992 //---------------------------------------------------------------------------
994 #define DEC_PYCALLBACK__2DBL(CBNAME) \
995 void CBNAME(double a, double b); \
996 void base_##CBNAME(double a, double b)
999 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1000 void CLASS::CBNAME(double a, double b) { \
1002 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1003 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1004 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1005 wxPyEndBlockThreads(blocked); \
1007 PCLASS::CBNAME(a, b); \
1009 void CLASS::base_##CBNAME(double a, double b) { \
1010 PCLASS::CBNAME(a, b); \
1013 //---------------------------------------------------------------------------
1015 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1016 void CBNAME(double a, double b, int c, int d); \
1017 void base_##CBNAME(double a, double b, int c, int d)
1020 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1021 void CLASS::CBNAME(double a, double b, int c, int d) { \
1023 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1024 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1025 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1027 wxPyEndBlockThreads(blocked); \
1029 PCLASS::CBNAME(a, b, c, d); \
1031 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1032 PCLASS::CBNAME(a, b, c, d); \
1035 //---------------------------------------------------------------------------
1037 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1038 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1039 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1042 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1043 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1045 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1046 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1047 PyObject* obj = wxPyMake_wxObject(&a,false); \
1048 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1051 wxPyEndBlockThreads(blocked); \
1053 PCLASS::CBNAME(a, b, c, d, e, f); \
1055 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1056 PCLASS::CBNAME(a, b, c, d, e, f); \
1059 //---------------------------------------------------------------------------
1061 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1062 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1063 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1066 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1067 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1069 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1071 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1072 PyObject* obj = wxPyMake_wxObject(&a,false); \
1073 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1076 wxPyEndBlockThreads(blocked); \
1078 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1081 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1082 return PCLASS::CBNAME(a, b, c, d, e, f); \
1085 //---------------------------------------------------------------------------
1087 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1088 void CBNAME(bool a, double b, double c, int d, int e); \
1089 void base_##CBNAME(bool a, double b, double c, int d, int e)
1092 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1093 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1095 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1096 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1097 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1099 wxPyEndBlockThreads(blocked); \
1101 PCLASS::CBNAME(a, b, c, d, e); \
1103 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1104 PCLASS::CBNAME(a, b, c, d, e); \
1107 //---------------------------------------------------------------------------
1109 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1110 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1111 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1114 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1115 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1117 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1118 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1119 PyObject* obj = wxPyMake_wxObject(&a,false); \
1120 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1123 wxPyEndBlockThreads(blocked); \
1125 PCLASS::CBNAME(a, b, c, d, e); \
1127 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1128 PCLASS::CBNAME(a, b, c, d, e); \
1131 //---------------------------------------------------------------------------
1133 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1134 void CBNAME(wxDC& a, bool b); \
1135 void base_##CBNAME(wxDC& a, bool b)
1138 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1139 void CLASS::CBNAME(wxDC& a, bool b) { \
1141 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1142 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1143 PyObject* obj = wxPyMake_wxObject(&a,false); \
1144 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1147 wxPyEndBlockThreads(blocked); \
1149 PCLASS::CBNAME(a, b); \
1151 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1152 PCLASS::CBNAME(a, b); \
1155 //---------------------------------------------------------------------------
1157 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1158 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1159 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1162 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1163 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1166 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1167 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1168 PyObject* obj = wxPyMake_wxObject(a,false); \
1169 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1172 wxPyEndBlockThreads(blocked); \
1174 PCLASS::CBNAME(a, b, c, d, e, f); \
1176 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1178 PCLASS::CBNAME(a, b, c, d, e, f); \
1181 //---------------------------------------------------------------------------
1183 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1184 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1185 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1188 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1189 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1191 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1192 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1193 PyObject* obj = wxPyMake_wxObject(a,false); \
1194 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1197 wxPyEndBlockThreads(blocked); \
1199 PCLASS::CBNAME(a, b, c, d, e); \
1201 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1203 PCLASS::CBNAME(a, b, c, d, e); \
1206 //---------------------------------------------------------------------------
1208 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1209 void CBNAME(double a, double b, int c); \
1210 void base_##CBNAME(double a, double b, int c)
1213 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1214 void CLASS::CBNAME(double a, double b, int c) { \
1216 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1217 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1218 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1219 wxPyEndBlockThreads(blocked); \
1221 PCLASS::CBNAME(a, b, c); \
1223 void CLASS::base_##CBNAME(double a, double b, int c) { \
1224 PCLASS::CBNAME(a, b, c); \
1227 //---------------------------------------------------------------------------
1229 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1230 void CBNAME(bool a, double b, double c, int d); \
1231 void base_##CBNAME(bool a, double b, double c, int d)
1234 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1235 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1237 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1238 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1239 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1240 wxPyEndBlockThreads(blocked); \
1242 PCLASS::CBNAME(a, b, c, d); \
1244 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1245 PCLASS::CBNAME(a, b, c, d); \
1248 //---------------------------------------------------------------------------
1249 //---------------------------------------------------------------------------
1251 #define DEC_PYCALLBACK__STRING(CBNAME) \
1252 void CBNAME(const wxString& a); \
1253 void base_##CBNAME(const wxString& a)
1255 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1256 void CLASS::CBNAME(const wxString& a) { \
1258 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1259 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1260 PyObject* s = wx2PyString(a); \
1261 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1264 wxPyEndBlockThreads(blocked); \
1266 PCLASS::CBNAME(a); \
1268 void CLASS::base_##CBNAME(const wxString& a) { \
1269 PCLASS::CBNAME(a); \
1272 //---------------------------------------------------------------------------
1274 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1275 bool CBNAME(const wxString& a); \
1276 bool base_##CBNAME(const wxString& a)
1278 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1279 bool CLASS::CBNAME(const wxString& a) { \
1282 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1283 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1284 PyObject* s = wx2PyString(a); \
1285 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1288 wxPyEndBlockThreads(blocked); \
1290 rval = PCLASS::CBNAME(a); \
1293 bool CLASS::base_##CBNAME(const wxString& a) { \
1294 return PCLASS::CBNAME(a); \
1297 //---------------------------------------------------------------------------
1299 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1300 bool CBNAME(const wxString& a)
1302 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1303 bool CLASS::CBNAME(const wxString& a) { \
1305 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1306 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1307 PyObject* s = wx2PyString(a); \
1308 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1311 wxPyEndBlockThreads(blocked); \
1315 //---------------------------------------------------------------------------
1317 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1318 wxString CBNAME(const wxString& a)
1320 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1321 wxString CLASS::CBNAME(const wxString& a) { \
1323 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1324 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1326 PyObject* s = wx2PyString(a); \
1327 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1330 rval = Py2wxString(ro); \
1334 wxPyEndBlockThreads(blocked); \
1338 //---------------------------------------------------------------------------
1340 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1341 wxString CBNAME(const wxString& a); \
1342 wxString base_##CBNAME(const wxString& a)
1344 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1345 wxString CLASS::CBNAME(const wxString& a) { \
1348 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1349 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1351 PyObject* s = wx2PyString(a); \
1352 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1355 rval = Py2wxString(ro); \
1360 rval = PCLASS::CBNAME(a); \
1361 wxPyEndBlockThreads(blocked); \
1365 //---------------------------------------------------------------------------
1367 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1368 wxString CBNAME(const wxString& a,int b)
1370 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1371 wxString CLASS::CBNAME(const wxString& a,int b) { \
1373 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1374 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1376 PyObject* s = wx2PyString(a); \
1377 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1380 rval = Py2wxString(ro); \
1384 wxPyEndBlockThreads(blocked); \
1388 //---------------------------------------------------------------------------
1390 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1391 bool CBNAME(const wxString& a, const wxString& b); \
1392 bool base_##CBNAME(const wxString& a, const wxString& b)
1394 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1395 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1398 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1399 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1400 PyObject* s1 = wx2PyString(a); \
1401 PyObject* s2 = wx2PyString(b); \
1402 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1406 wxPyEndBlockThreads(blocked); \
1408 rval = PCLASS::CBNAME(a, b); \
1411 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1412 return PCLASS::CBNAME(a, b); \
1415 //---------------------------------------------------------------------------
1417 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1418 wxString CBNAME(); \
1419 wxString base_##CBNAME()
1421 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1422 wxString CLASS::CBNAME() { \
1425 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1426 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1428 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1430 rval = Py2wxString(ro); \
1434 wxPyEndBlockThreads(blocked); \
1436 rval = PCLASS::CBNAME(); \
1439 wxString CLASS::base_##CBNAME() { \
1440 return PCLASS::CBNAME(); \
1443 //---------------------------------------------------------------------------
1445 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1446 wxString CBNAME() const; \
1447 wxString base_##CBNAME() const;
1449 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1450 wxString CLASS::CBNAME() const { \
1453 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1454 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1456 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1458 rval = Py2wxString(ro); \
1462 wxPyEndBlockThreads(blocked); \
1464 rval = PCLASS::CBNAME(); \
1467 wxString CLASS::base_##CBNAME() const { \
1468 return PCLASS::CBNAME(); \
1471 //---------------------------------------------------------------------------
1473 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1476 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1477 wxString CLASS::CBNAME() { \
1479 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1480 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1482 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1484 rval = Py2wxString(ro); \
1488 wxPyEndBlockThreads(blocked); \
1492 //---------------------------------------------------------------------------
1494 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1495 wxString CBNAME() const;
1497 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1498 wxString CLASS::CBNAME() const { \
1500 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1501 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1503 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1505 rval = Py2wxString(ro); \
1509 wxPyEndBlockThreads(blocked); \
1513 //---------------------------------------------------------------------------
1515 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1516 bool CBNAME(const wxHtmlTag& a)
1519 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1520 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1522 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1523 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1524 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1525 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1528 wxPyEndBlockThreads(blocked); \
1532 //---------------------------------------------------------------------------
1534 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1535 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1536 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1538 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1539 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1541 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1542 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1543 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1544 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1547 wxPyEndBlockThreads(blocked); \
1549 PCLASS::CBNAME(cell, x, y); \
1551 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1552 PCLASS::CBNAME(cell, x, y); \
1555 //---------------------------------------------------------------------------
1557 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1558 void CBNAME(const wxColour& c); \
1559 void base_##CBNAME(const wxColour& c)
1561 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1562 void CLASS::CBNAME(const wxColour& c) { \
1564 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1565 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1566 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1567 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1570 wxPyEndBlockThreads(blocked); \
1572 PCLASS::CBNAME(c); \
1574 void CLASS::base_##CBNAME(const wxColour& c) { \
1575 PCLASS::CBNAME(c); \
1578 //---------------------------------------------------------------------------
1580 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1581 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1582 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1584 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1585 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1587 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1588 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1589 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1590 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1591 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1595 wxPyEndBlockThreads(blocked); \
1597 PCLASS::CBNAME(cell, x, y, e); \
1599 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1600 PCLASS::CBNAME(cell, x, y, e); \
1605 //---------------------------------------------------------------------------
1607 #define DEC_PYCALLBACK___pure(CBNAME) \
1611 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1612 void CLASS::CBNAME() { \
1613 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1614 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1615 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1616 wxPyEndBlockThreads(blocked); \
1619 //---------------------------------------------------------------------------
1621 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1625 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1626 wxSize CLASS::CBNAME() { \
1627 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1629 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1630 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1633 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1635 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1637 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1638 PyObject* o1 = PySequence_GetItem(ro, 0); \
1639 PyObject* o2 = PySequence_GetItem(ro, 1); \
1640 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1641 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1643 PyErr_SetString(PyExc_TypeError, errmsg); \
1648 PyErr_SetString(PyExc_TypeError, errmsg); \
1653 wxPyEndBlockThreads(blocked); \
1657 //---------------------------------------------------------------------------
1659 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1660 bool CBNAME(wxWindow* a); \
1661 bool base_##CBNAME(wxWindow* a)
1664 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1665 bool CLASS::CBNAME(wxWindow* a) { \
1668 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1669 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1670 PyObject* obj = wxPyMake_wxObject(a,false); \
1671 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1674 wxPyEndBlockThreads(blocked); \
1676 rval = PCLASS::CBNAME(a); \
1679 bool CLASS::base_##CBNAME(wxWindow* a) { \
1680 return PCLASS::CBNAME(a); \
1683 //---------------------------------------------------------------------------
1685 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1686 bool CBNAME(wxWindow* a, wxDC& b); \
1687 bool base_##CBNAME(wxWindow* a, wxDC& b)
1690 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1691 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1694 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1695 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1696 PyObject* win = wxPyMake_wxObject(a,false); \
1697 PyObject* dc = wxPyMake_wxObject(&b,false); \
1698 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1702 wxPyEndBlockThreads(blocked); \
1704 rval = PCLASS::CBNAME(a, b); \
1707 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1708 return PCLASS::CBNAME(a, b); \
1711 //---------------------------------------------------------------------------
1713 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1714 void CBNAME(wxWindowBase* a); \
1715 void base_##CBNAME(wxWindowBase* a)
1718 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1719 void CLASS::CBNAME(wxWindowBase* a) { \
1721 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1722 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1723 PyObject* obj = wxPyMake_wxObject(a,false); \
1724 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1727 wxPyEndBlockThreads(blocked); \
1729 PCLASS::CBNAME(a); \
1731 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1732 PCLASS::CBNAME(a); \
1735 //---------------------------------------------------------------------------
1737 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1739 bool base_##CBNAME()
1742 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1743 bool CLASS::CBNAME() { \
1746 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1747 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1748 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1749 wxPyEndBlockThreads(blocked); \
1751 rval = PCLASS::CBNAME(); \
1754 bool CLASS::base_##CBNAME() { \
1755 return PCLASS::CBNAME(); \
1758 //---------------------------------------------------------------------------
1760 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1761 bool CBNAME() const; \
1762 bool base_##CBNAME() const
1765 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1766 bool CLASS::CBNAME() const { \
1769 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1770 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1771 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1772 wxPyEndBlockThreads(blocked); \
1774 rval = PCLASS::CBNAME(); \
1777 bool CLASS::base_##CBNAME() const { \
1778 return PCLASS::CBNAME(); \
1781 //---------------------------------------------------------------------------
1783 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1784 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1785 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1788 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1789 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1792 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1793 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1794 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1795 wxPyEndBlockThreads(blocked); \
1797 rval = PCLASS::CBNAME(a, b, c); \
1798 return (wxDragResult)rval; \
1800 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1801 return PCLASS::CBNAME(a, b, c); \
1804 //---------------------------------------------------------------------------
1806 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1807 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1809 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1810 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1811 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1813 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1815 PyObject* obj = wxPyMake_wxObject(&a,false); \
1816 PyObject* s = wx2PyString(b); \
1817 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1820 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1826 wxPyEndBlockThreads(blocked); \
1830 //---------------------------------------------------------------------------
1832 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1833 bool CBNAME(wxDragResult a); \
1834 bool base_##CBNAME(wxDragResult a)
1837 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1838 bool CLASS::CBNAME(wxDragResult a) { \
1841 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1842 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1843 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1844 wxPyEndBlockThreads(blocked); \
1846 rval = PCLASS::CBNAME(a); \
1849 bool CLASS::base_##CBNAME(wxDragResult a) { \
1850 return PCLASS::CBNAME(a); \
1853 //---------------------------------------------------------------------------
1855 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1856 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1859 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1860 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1861 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1863 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1864 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1865 wxPyEndBlockThreads(blocked); \
1866 return (wxDragResult)rval; \
1869 //---------------------------------------------------------------------------
1871 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1872 bool CBNAME(int a, int b, const wxString& c)
1874 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1875 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1877 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1878 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1879 PyObject* s = wx2PyString(c); \
1880 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1883 wxPyEndBlockThreads(blocked); \
1887 //---------------------------------------------------------------------------
1889 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1891 size_t base_##CBNAME()
1894 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1895 size_t CLASS::CBNAME() { \
1898 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1899 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1900 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1901 wxPyEndBlockThreads(blocked); \
1903 rval = PCLASS::CBNAME(); \
1906 size_t CLASS::base_##CBNAME() { \
1907 return PCLASS::CBNAME(); \
1910 //---------------------------------------------------------------------------
1912 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1913 size_t CBNAME() const; \
1914 size_t base_##CBNAME() const
1917 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1918 size_t CLASS::CBNAME() const { \
1921 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1922 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1923 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1924 wxPyEndBlockThreads(blocked); \
1926 rval = PCLASS::CBNAME(); \
1929 size_t CLASS::base_##CBNAME() const { \
1930 return PCLASS::CBNAME(); \
1933 //---------------------------------------------------------------------------
1935 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1936 wxDataFormat CBNAME(size_t a); \
1937 wxDataFormat base_##CBNAME(size_t a)
1940 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1941 wxDataFormat CLASS::CBNAME(size_t a) { \
1942 wxDataFormat rval=0; \
1944 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1945 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1947 wxDataFormat* ptr; \
1948 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1950 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1955 wxPyEndBlockThreads(blocked); \
1957 rval = PCLASS::CBNAME(a); \
1960 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1961 return PCLASS::CBNAME(a); \
1964 //---------------------------------------------------------------------------
1966 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1967 void CBNAME(const Type& a); \
1968 void base_##CBNAME(const Type& a)
1971 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1972 void CLASS::CBNAME(const Type& a) { \
1974 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1975 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1976 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1977 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1980 wxPyEndBlockThreads(blocked); \
1982 PCLASS::CBNAME(a); \
1984 void CLASS::base_##CBNAME(const Type& a) { \
1985 PCLASS::CBNAME(a); \
1989 //---------------------------------------------------------------------------
1991 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1992 void CBNAME(Type& a); \
1993 void base_##CBNAME(Type& a)
1996 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1997 void CLASS::CBNAME(Type& a) { \
1999 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2000 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2001 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2002 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2005 wxPyEndBlockThreads(blocked); \
2007 PCLASS::CBNAME(a); \
2009 void CLASS::base_##CBNAME(Type& a) { \
2010 PCLASS::CBNAME(a); \
2013 //---------------------------------------------------------------------------
2015 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2016 bool CBNAME(Type& a); \
2017 bool base_##CBNAME(Type& a)
2020 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2021 bool CLASS::CBNAME(Type& a) { \
2024 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2025 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2026 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2027 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2030 wxPyEndBlockThreads(blocked); \
2032 rv = PCLASS::CBNAME(a); \
2035 bool CLASS::base_##CBNAME(Type& a) { \
2036 return PCLASS::CBNAME(a); \
2039 //---------------------------------------------------------------------------
2041 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2042 bool CBNAME(Type& a)
2045 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2046 bool CLASS::CBNAME(Type& a) { \
2048 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2049 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2050 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2051 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2054 wxPyEndBlockThreads(blocked); \
2058 //---------------------------------------------------------------------------
2060 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2061 wxString CBNAME(long a, long b) const; \
2062 wxString base_##CBNAME(long a, long b) const
2064 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2065 wxString CLASS::CBNAME(long a, long b) const { \
2068 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2069 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2071 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2073 rval = Py2wxString(ro); \
2077 wxPyEndBlockThreads(blocked); \
2079 rval = PCLASS::CBNAME(a,b); \
2082 wxString CLASS::base_##CBNAME(long a, long b) const { \
2083 return PCLASS::CBNAME(a,b); \
2086 //---------------------------------------------------------------------------
2088 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2089 int CBNAME(long a) const; \
2090 int base_##CBNAME(long a) const
2093 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2094 int CLASS::CBNAME(long a) const { \
2097 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2098 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2100 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2102 rval = PyInt_AsLong(ro); \
2106 wxPyEndBlockThreads(blocked); \
2108 rval = PCLASS::CBNAME(a); \
2111 int CLASS::base_##CBNAME(long a) const { \
2112 return PCLASS::CBNAME(a); \
2118 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2119 int CBNAME(long a) const;
2122 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2123 int CLASS::CBNAME(long a) const { \
2124 int rval=-1; /* this rval is important for OnGetItemImage */ \
2126 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2127 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2129 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2131 rval = PyInt_AsLong(ro); \
2135 wxPyEndBlockThreads(blocked); \
2140 //---------------------------------------------------------------------------
2142 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2143 wxListItemAttr* CBNAME(long a) const; \
2144 wxListItemAttr* base_##CBNAME(long a) const
2147 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2148 wxListItemAttr *CLASS::CBNAME(long a) const { \
2149 wxListItemAttr *rval = NULL; \
2151 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2152 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2154 wxListItemAttr* ptr; \
2155 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2157 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2162 wxPyEndBlockThreads(blocked); \
2164 rval = PCLASS::CBNAME(a); \
2167 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2168 return PCLASS::CBNAME(a); \
2171 //---------------------------------------------------------------------------
2173 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2174 bool CBNAME(wxMouseEvent& e); \
2175 bool base_##CBNAME(wxMouseEvent& e)
2177 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2178 bool CLASS::CBNAME(wxMouseEvent& e) { \
2181 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2182 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2184 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2185 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2187 rval = PyInt_AsLong(ro); \
2192 wxPyEndBlockThreads(blocked); \
2194 return PCLASS::CBNAME(e); \
2197 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2198 return PCLASS::CBNAME(e); \
2202 //---------------------------------------------------------------------------
2204 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2205 wxWizardPage* CBNAME() const
2207 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2208 wxWizardPage* CLASS::CBNAME() const { \
2209 wxWizardPage* rv = NULL; \
2210 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2211 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2213 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2215 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2219 wxPyEndBlockThreads(blocked); \
2223 //---------------------------------------------------------------------------
2225 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2226 wxBitmap CBNAME() const
2228 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2229 wxBitmap CLASS::CBNAME() const { \
2231 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2232 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2235 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2237 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2242 wxPyEndBlockThreads(blocked); \
2246 //---------------------------------------------------------------------------
2248 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2251 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2252 wxObject* CLASS::CBNAME() { \
2253 wxObject* rv = NULL; \
2254 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2255 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2257 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2259 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2263 wxPyEndBlockThreads(blocked); \
2267 //---------------------------------------------------------------------------
2269 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2270 wxObject* CBNAME(const wxString& a)
2272 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2273 wxObject* CLASS::CBNAME(const wxString& a) { \
2274 wxObject* rv = NULL; \
2275 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2276 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2277 PyObject* so = wx2PyString(a); \
2279 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2281 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2286 wxPyEndBlockThreads(blocked); \
2290 //---------------------------------------------------------------------------
2292 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2293 bool CBNAME(wxXmlNode* a)
2296 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2297 bool CLASS::CBNAME(wxXmlNode* a) { \
2299 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2300 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2301 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2302 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2305 wxPyEndBlockThreads(blocked); \
2309 //---------------------------------------------------------------------------
2311 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2312 wxCoord CBNAME(size_t a) const
2315 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2316 wxCoord CLASS::CBNAME(size_t a) const { \
2319 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2320 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2321 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2323 wxPyEndBlockThreads(blocked); \
2327 //---------------------------------------------------------------------------
2329 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2330 void CBNAME(size_t a, size_t b) const; \
2331 void base_##CBNAME(size_t a, size_t b) const
2334 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2335 void CLASS::CBNAME(size_t a, size_t b) const { \
2337 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2338 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2339 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2340 wxPyEndBlockThreads(blocked); \
2342 PCLASS::CBNAME(a,b); \
2344 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2345 PCLASS::CBNAME(a,b); \
2348 //---------------------------------------------------------------------------
2350 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2351 wxCoord CBNAME() const; \
2352 wxCoord base_##CBNAME() const
2355 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2356 wxCoord CLASS::CBNAME() const { \
2359 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2360 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2361 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2362 wxPyEndBlockThreads(blocked); \
2364 rval = PCLASS::CBNAME(); \
2367 wxCoord CLASS::base_##CBNAME() const { \
2368 return PCLASS::CBNAME(); \
2371 //---------------------------------------------------------------------------
2373 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2374 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2377 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2378 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2380 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2381 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2382 PyObject* obj = wxPyMake_wxObject(&a,false); \
2383 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2384 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2387 wxPyEndBlockThreads(blocked); \
2390 //---------------------------------------------------------------------------
2392 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2393 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2394 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2397 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2398 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2400 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2401 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2402 PyObject* obj = wxPyMake_wxObject(&a,false); \
2403 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2404 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2407 wxPyEndBlockThreads(blocked); \
2409 PCLASS::CBNAME(a,b,c); \
2411 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2412 PCLASS::CBNAME(a,b,c); \
2415 //---------------------------------------------------------------------------
2418 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2419 wxString CBNAME(size_t a) const; \
2420 wxString base_##CBNAME(size_t a) const
2422 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2423 wxString CLASS::CBNAME(size_t a) const { \
2426 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2427 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2429 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2431 rval = Py2wxString(ro); \
2435 wxPyEndBlockThreads(blocked); \
2437 rval = PCLASS::CBNAME(a); \
2440 wxString CLASS::base_##CBNAME(size_t a) const { \
2441 return PCLASS::CBNAME(a); \
2444 //---------------------------------------------------------------------------
2446 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2447 wxString CBNAME(size_t a) const
2449 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2450 wxString CLASS::CBNAME(size_t a) const { \
2453 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2454 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2456 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2458 rval = Py2wxString(ro); \
2462 wxPyEndBlockThreads(blocked); \
2466 //---------------------------------------------------------------------------
2468 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2469 wxVisualAttributes CBNAME() const; \
2470 wxVisualAttributes base_##CBNAME()
2473 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2474 wxVisualAttributes CLASS::CBNAME() const { \
2475 wxVisualAttributes rval; \
2477 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2478 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2480 wxVisualAttributes* ptr; \
2481 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2483 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2488 wxPyEndBlockThreads(blocked); \
2490 rval = PCLASS::CBNAME(); \
2493 wxVisualAttributes CLASS::base_##CBNAME() { \
2494 return PCLASS::CBNAME(); \
2497 //---------------------------------------------------------------------------