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
;
89 #ifndef SWIG_TYPE_TABLE
90 #define SWIG_TYPE_TABLE wxPython_type_table
93 #ifndef wxPyUSE_EXPORTED_API
95 void __wxPyPreStart(PyObject
*);
97 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
98 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
100 void wxSetDefaultPyEncoding(const char* encoding
);
101 const char* wxGetDefaultPyEncoding();
104 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
107 bool wxPyCheckSwigType(const wxChar
* className
);
108 PyObject
* wxPyConstructObject(void* ptr
,
109 const wxChar
* className
,
111 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
112 const wxChar
* className
);
113 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
116 PyObject
* wx2PyString(const wxString
& src
);
117 wxString
Py2wxString(PyObject
* source
);
119 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
120 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
121 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
123 PyObject
* wxPy_ConvertList(wxListBase
* list
);
124 long wxPyGetWinHandle(wxWindow
* win
);
126 void wxPy_ReinitStockObjects(int pass
);
128 bool wxPyInstance_Check(PyObject
* obj
);
129 bool wxPySwigInstance_Check(PyObject
* obj
);
132 #endif // wxPyUSE_EXPORTED_API
133 //---------------------------------------------------------------------------
135 // if we want to handle threads and Python threads are available...
136 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
137 #define WXP_WITH_THREAD
138 #else // no Python threads...
139 #undef WXP_WITH_THREAD
143 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
144 // blocking threads when calling back into Python. Using them instead of my
145 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
146 // wxPyEndBlockThreads.
148 // Unfortunatly there is a bug somewhere when using these new APIs on Python
149 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
150 // at breakpoints located in event handlers. I think that the cause may be
151 // something like the original PyThreadState for the main thread is not being
152 // restored for the callbacks, but I can't see where that could be
153 // happening... So we'll only activate this new change for Python 2.4+ :-(
155 #if PY_VERSION_HEX < 0x02040000
156 #define wxPyUSE_GIL_STATE 0
157 typedef bool wxPyBlock_t
;
159 #define wxPyUSE_GIL_STATE 1
160 typedef PyGILState_STATE wxPyBlock_t
;
164 #ifndef wxPyUSE_EXPORTED_API
166 // For Python --> C++
167 PyThreadState
* wxPyBeginAllowThreads();
168 void wxPyEndAllowThreads(PyThreadState
* state
);
170 // For C++ --> Python
171 wxPyBlock_t
wxPyBeginBlockThreads();
172 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
174 #endif // wxPyUSE_EXPORTED_API
177 // A macro that will help to execute simple statments wrapped in
178 // StartBlock/EndBlockThreads calls
179 #define wxPyBLOCK_THREADS(stmt) \
180 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
182 // Raise the NotImplementedError exception (blocking threads)
183 #define wxPyRaiseNotImplemented() \
184 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
186 // Raise any exception with a string value (blocking threads)
187 #define wxPyErr_SetString(err, str) \
188 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
191 //---------------------------------------------------------------------------
192 // These are helpers used by the typemaps
194 #ifndef wxPyUSE_EXPORTED_API
196 wxString
* wxString_in_helper(PyObject
* source
);
198 byte
* byte_LIST_helper(PyObject
* source
);
199 int* int_LIST_helper(PyObject
* source
);
200 long* long_LIST_helper(PyObject
* source
);
201 char** string_LIST_helper(PyObject
* source
);
202 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
203 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
204 wxString
* wxString_LIST_helper(PyObject
* source
);
205 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
206 wxPen
** wxPen_LIST_helper(PyObject
* source
);
208 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
209 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
210 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
211 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
212 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
213 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
216 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
217 bool wxColour_typecheck(PyObject
* source
);
219 bool wxPyCheckForApp();
223 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
225 // If source is an object instance then it may already be the right type
226 if (wxPySwigInstance_Check(source
)) {
228 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
233 // otherwise a 2-tuple of integers is expected
234 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
235 PyObject
* o1
= PySequence_GetItem(source
, 0);
236 PyObject
* o2
= PySequence_GetItem(source
, 1);
237 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
242 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
250 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
251 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
257 // Other helpful stuff
258 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
259 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
261 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
262 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
264 #endif // wxPyUSE_EXPORTED_API
266 //---------------------------------------------------------------------------
268 #if PYTHON_API_VERSION < 1009
269 #define PySequence_Fast_GET_ITEM(o, i) \
270 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
273 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
274 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
275 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
277 //---------------------------------------------------------------------------
279 #ifndef wxPyUSE_EXPORTED_API
281 class wxPyCallback
: public wxObject
{
282 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
284 wxPyCallback(PyObject
* func
);
285 wxPyCallback(const wxPyCallback
& other
);
288 void EventThunker(wxEvent
& event
);
293 #endif // wxPyUSE_EXPORTED_API
294 //---------------------------------------------------------------------------
295 //---------------------------------------------------------------------------
296 // These Event classes can be derived from in Python and passed through the
297 // event system without loosing anything. They do this by keeping a reference
298 // to themselves and some special case handling in wxPyCallback::EventThunker.
302 class wxPyEvtSelfRef
{
307 void SetSelf(PyObject
* self
, bool clone
=false);
308 PyObject
* GetSelf() const;
309 bool GetCloned() const { return m_cloned
; }
317 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
318 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
320 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
321 wxPyEvent(const wxPyEvent
& evt
);
324 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
328 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
329 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
331 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
332 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
335 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
340 //----------------------------------------------------------------------
341 // Forward decalre a few things used in the exported API
342 class wxPyClientData
;
344 class wxPyOORClientData
;
345 class wxPyCBInputStream
;
347 void wxPyClientData_dtor(wxPyClientData
* self
);
348 void wxPyUserData_dtor(wxPyUserData
* self
);
349 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
350 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
351 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
353 //---------------------------------------------------------------------------
354 // Export a C API in a struct. Other modules will be able to load this from
355 // the wx.core module and will then have safe access to these functions, even if
356 // in another shared library.
358 class wxPyCallbackHelper
;
362 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
363 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
364 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
365 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
367 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
368 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
369 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
370 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
372 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
374 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
375 wxString (*p_Py2wxString
)(PyObject
* source
);
376 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
378 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
379 int* (*p_int_LIST_helper
)(PyObject
* source
);
380 long* (*p_long_LIST_helper
)(PyObject
* source
);
381 char** (*p_string_LIST_helper
)(PyObject
* source
);
382 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
383 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
384 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
385 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
387 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
388 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
389 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
390 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
391 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
392 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
395 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
396 bool (*p_wxColour_typecheck
)(PyObject
* source
);
398 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
399 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
400 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
401 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
402 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
404 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
405 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
406 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
407 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
408 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
409 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
410 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
412 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
413 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
414 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
416 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
417 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
419 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
420 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
422 bool (*p_wxPyCheckForApp
)();
426 #ifdef wxPyUSE_EXPORTED_API
427 // Notice that this is static, not extern. This is by design, each module
428 // needs one, but doesn't have to use it.
429 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
430 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
431 #endif // wxPyUSE_EXPORTED_API
433 //---------------------------------------------------------------------------
435 // A wxObject that holds a reference to a Python object
436 class wxPyUserData
: public wxObject
{
438 wxPyUserData(PyObject
* obj
) {
444 #ifdef wxPyUSE_EXPORTED_API
445 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
447 wxPyUserData_dtor(this);
454 // A wxClientData that holds a refernece to a Python object
455 class wxPyClientData
: public wxClientData
{
457 wxPyClientData(PyObject
* obj
, bool incref
=true) {
465 #ifdef wxPyUSE_EXPORTED_API
466 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
468 wxPyClientData_dtor(this);
476 // Just like wxPyClientData, except when this object is destroyed it does some
477 // OOR magic on the Python Object.
478 class wxPyOORClientData
: public wxPyClientData
{
480 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
481 : wxPyClientData(obj
, incref
) {}
482 ~wxPyOORClientData() {
484 #ifdef wxPyUSE_EXPORTED_API
485 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
487 wxPyOORClientData_dtor(this);
493 //---------------------------------------------------------------------------
494 // This class holds an instance of a Python Shadow Class object and assists
495 // with looking up and invoking Python callback methods from C++ virtual
496 // method redirections. For all classes which have virtuals which should be
497 // overridable in wxPython, a new subclass is created that contains a
498 // wxPyCallbackHelper.
501 class wxPyCallbackHelper
{
503 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
505 wxPyCallbackHelper() {
512 ~wxPyCallbackHelper() {
513 #ifdef wxPyUSE_EXPORTED_API
514 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
516 wxPyCBH_delete(this);
520 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
521 bool findCallback(const char* name
) const;
522 int callCallback(PyObject
* argTuple
) const;
523 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
524 PyObject
* GetLastFound() const { return m_lastFound
; }
529 PyObject
* m_lastFound
;
532 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
536 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
537 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
538 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
539 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
540 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
545 //---------------------------------------------------------------------------
547 // This is used in C++ classes that need to be able to make callback to
548 // "overloaded" python methods
551 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
552 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
554 private: wxPyCallbackHelper m_myInst
557 //---------------------------------------------------------------------------
558 // The wxPythonApp class
561 wxPYAPP_ASSERT_SUPPRESS
= 1,
562 wxPYAPP_ASSERT_EXCEPTION
= 2,
563 wxPYAPP_ASSERT_DIALOG
= 4,
564 wxPYAPP_ASSERT_LOG
= 8
567 class wxPyApp
: public wxApp
569 DECLARE_ABSTRACT_CLASS(wxPyApp
);
577 int GetAssertMode() { return m_assertMode
; }
578 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
580 virtual bool OnInitGui();
581 virtual int OnExit();
583 virtual void OnAssert(const wxChar
*file
,
588 // virtual int FilterEvent(wxEvent& event); // This one too????
590 // For catching Apple Events
591 virtual void MacOpenFile(const wxString
&fileName
);
592 virtual void MacPrintFile(const wxString
&fileName
);
593 virtual void MacNewFile();
594 virtual void MacReopenApp();
596 static bool GetMacSupportPCMenuShortcuts();
597 static long GetMacAboutMenuItemId();
598 static long GetMacPreferencesMenuItemId();
599 static long GetMacExitMenuItemId();
600 static wxString
GetMacHelpMenuTitleName();
602 static void SetMacSupportPCMenuShortcuts(bool val
);
603 static void SetMacAboutMenuItemId(long val
);
604 static void SetMacPreferencesMenuItemId(long val
);
605 static void SetMacExitMenuItemId(long val
);
606 static void SetMacHelpMenuTitleName(const wxString
& val
);
609 void _BootstrapApp();
611 // implementation only
612 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
616 bool m_startupComplete
;
619 extern wxPyApp
*wxPythonApp
;
622 //----------------------------------------------------------------------
623 // These macros are used to implement the virtual methods that should
624 // redirect to a Python method if one exists. The names designate the
625 // return type, if any, as well as any parameter types.
626 //---------------------------------------------------------------------------
628 #define DEC_PYCALLBACK__(CBNAME) \
633 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
634 void CLASS::CBNAME() { \
636 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
637 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
638 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
639 wxPyEndBlockThreads(blocked); \
643 void CLASS::base_##CBNAME() { \
647 //---------------------------------------------------------------------------
649 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
650 bool CBNAME(int a, int b); \
651 bool base_##CBNAME(int a, int b)
654 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
655 bool CLASS::CBNAME(int a, int b) { \
656 bool rval=false, found; \
657 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
658 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
659 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
660 wxPyEndBlockThreads(blocked); \
662 rval = PCLASS::CBNAME(a,b); \
665 bool CLASS::base_##CBNAME(int a, int b) { \
666 return PCLASS::CBNAME(a,b); \
669 //---------------------------------------------------------------------------
671 #define DEC_PYCALLBACK_VOID_(CBNAME) \
676 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
677 void CLASS::CBNAME() { \
679 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
680 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
681 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
682 wxPyEndBlockThreads(blocked); \
686 void CLASS::base_##CBNAME() { \
690 //---------------------------------------------------------------------------
692 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
693 void CBNAME(int a, int b); \
694 void base_##CBNAME(int a, int b)
697 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
698 void CLASS::CBNAME(int a, int b) { \
700 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
701 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
702 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
703 wxPyEndBlockThreads(blocked); \
705 PCLASS::CBNAME(a,b); \
707 void CLASS::base_##CBNAME(int a, int b) { \
708 PCLASS::CBNAME(a,b); \
711 //---------------------------------------------------------------------------
713 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
714 void CBNAME(int a); \
715 void base_##CBNAME(int a)
718 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
719 void CLASS::CBNAME(int a) { \
721 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
722 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
723 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
724 wxPyEndBlockThreads(blocked); \
728 void CLASS::base_##CBNAME(int a) { \
732 //---------------------------------------------------------------------------
734 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
735 void CBNAME(int a, int b, int c, int d); \
736 void base_##CBNAME(int a, int b, int c, int d)
739 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
740 void CLASS::CBNAME(int a, int b, int c, int d) { \
742 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
743 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
744 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
745 wxPyEndBlockThreads(blocked); \
747 PCLASS::CBNAME(a,b,c,d); \
749 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
750 PCLASS::CBNAME(a,b,c,d); \
753 //---------------------------------------------------------------------------
754 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
755 void CBNAME(int a, int b, int c, int d, int e); \
756 void base_##CBNAME(int a, int b, int c, int d, int e)
759 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
760 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
762 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
763 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
764 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
765 wxPyEndBlockThreads(blocked); \
767 PCLASS::CBNAME(a,b,c,d,e); \
769 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
770 PCLASS::CBNAME(a,b,c,d,e); \
773 //---------------------------------------------------------------------------
775 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
776 void CBNAME(int* a, int* b) const; \
777 void base_##CBNAME(int* a, int* b) const
780 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
781 void CLASS::CBNAME(int* a, int* b) const { \
782 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
784 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
785 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
787 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
789 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
790 PyObject* o1 = PySequence_GetItem(ro, 0); \
791 PyObject* o2 = PySequence_GetItem(ro, 1); \
792 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
793 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
796 PyErr_SetString(PyExc_TypeError, errmsg); \
801 PyErr_SetString(PyExc_TypeError, errmsg); \
806 wxPyEndBlockThreads(blocked); \
808 PCLASS::CBNAME(a,b); \
810 void CLASS::base_##CBNAME(int* a, int* b) const { \
811 PCLASS::CBNAME(a,b); \
815 //---------------------------------------------------------------------------
817 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
818 wxSize CBNAME() const; \
819 wxSize base_##CBNAME() const
822 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
823 wxSize CLASS::CBNAME() const { \
824 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
825 bool found; wxSize rval(0,0); \
826 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
827 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
829 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
831 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
832 PyObject* o1 = PySequence_GetItem(ro, 0); \
833 PyObject* o2 = PySequence_GetItem(ro, 1); \
834 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
835 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
838 PyErr_SetString(PyExc_TypeError, errmsg); \
843 PyErr_SetString(PyExc_TypeError, errmsg); \
848 wxPyEndBlockThreads(blocked); \
850 return PCLASS::CBNAME(); \
854 wxSize CLASS::base_##CBNAME() const { \
855 return PCLASS::CBNAME(); \
859 //---------------------------------------------------------------------------
861 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
862 bool CBNAME(bool a); \
863 bool base_##CBNAME(bool a)
866 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
867 bool CLASS::CBNAME(bool a) { \
868 bool rval=false, found; \
869 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
870 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
871 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
872 wxPyEndBlockThreads(blocked); \
874 rval = PCLASS::CBNAME(a); \
877 bool CLASS::base_##CBNAME(bool a) { \
878 return PCLASS::CBNAME(a); \
881 //---------------------------------------------------------------------------
883 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
884 bool CBNAME(int a); \
885 bool base_##CBNAME(int a)
888 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
889 bool CLASS::CBNAME(int a) { \
890 bool rval=false, found; \
891 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
892 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
893 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
894 wxPyEndBlockThreads(blocked); \
896 rval = PCLASS::CBNAME(a); \
899 bool CLASS::base_##CBNAME(int a) { \
900 return PCLASS::CBNAME(a); \
903 //---------------------------------------------------------------------------
905 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
909 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
910 bool CLASS::CBNAME(int a) { \
912 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
913 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
914 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
916 wxPyEndBlockThreads(blocked); \
921 //---------------------------------------------------------------------------
923 #define DEC_PYCALLBACK__DC(CBNAME) \
924 void CBNAME(wxDC& a); \
925 void base_##CBNAME(wxDC& a)
928 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
929 void CLASS::CBNAME(wxDC& a) { \
931 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
932 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
933 PyObject* obj = wxPyMake_wxObject(&a,false); \
934 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
937 wxPyEndBlockThreads(blocked); \
941 void CLASS::base_##CBNAME(wxDC& a) { \
947 //---------------------------------------------------------------------------
949 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
950 void CBNAME(wxDC& a, bool b); \
951 void base_##CBNAME(wxDC& a, bool b)
954 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
955 void CLASS::CBNAME(wxDC& a, bool b) { \
957 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
958 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
959 PyObject* obj = wxPyMake_wxObject(&a,false); \
960 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
963 wxPyEndBlockThreads(blocked); \
965 PCLASS::CBNAME(a, b); \
967 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
968 PCLASS::CBNAME(a, b); \
971 //---------------------------------------------------------------------------
973 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
974 void CBNAME(wxDC& a, bool b); \
975 void base_##CBNAME(wxDC& a, bool b)
978 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
979 void CLASS::CBNAME(wxDC& a, bool b) { \
981 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
982 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
983 PyObject* obj = wxPyMake_wxObject(&a,false); \
984 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
987 wxPyEndBlockThreads(blocked); \
989 PCLASS::CBNAME(a, b); \
991 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
992 PCLASS::CBNAME(a, b); \
995 //---------------------------------------------------------------------------
997 #define DEC_PYCALLBACK__2DBL(CBNAME) \
998 void CBNAME(double a, double b); \
999 void base_##CBNAME(double a, double b)
1002 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1003 void CLASS::CBNAME(double a, double b) { \
1005 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1006 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1007 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1008 wxPyEndBlockThreads(blocked); \
1010 PCLASS::CBNAME(a, b); \
1012 void CLASS::base_##CBNAME(double a, double b) { \
1013 PCLASS::CBNAME(a, b); \
1016 //---------------------------------------------------------------------------
1018 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1019 void CBNAME(double a, double b, int c, int d); \
1020 void base_##CBNAME(double a, double b, int c, int d)
1023 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1024 void CLASS::CBNAME(double a, double b, int c, int d) { \
1026 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1027 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1028 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1030 wxPyEndBlockThreads(blocked); \
1032 PCLASS::CBNAME(a, b, c, d); \
1034 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1035 PCLASS::CBNAME(a, b, c, d); \
1038 //---------------------------------------------------------------------------
1040 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1041 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1042 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1045 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1046 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1048 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1049 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1050 PyObject* obj = wxPyMake_wxObject(&a,false); \
1051 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1054 wxPyEndBlockThreads(blocked); \
1056 PCLASS::CBNAME(a, b, c, d, e, f); \
1058 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1059 PCLASS::CBNAME(a, b, c, d, e, f); \
1062 //---------------------------------------------------------------------------
1064 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1065 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1066 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1069 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1070 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1072 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1074 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1075 PyObject* obj = wxPyMake_wxObject(&a,false); \
1076 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1079 wxPyEndBlockThreads(blocked); \
1081 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1084 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1085 return PCLASS::CBNAME(a, b, c, d, e, f); \
1088 //---------------------------------------------------------------------------
1090 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1091 void CBNAME(bool a, double b, double c, int d, int e); \
1092 void base_##CBNAME(bool a, double b, double c, int d, int e)
1095 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1096 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1098 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1099 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1100 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1102 wxPyEndBlockThreads(blocked); \
1104 PCLASS::CBNAME(a, b, c, d, e); \
1106 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1107 PCLASS::CBNAME(a, b, c, d, e); \
1110 //---------------------------------------------------------------------------
1112 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1113 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1114 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1117 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1118 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1120 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1121 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1122 PyObject* obj = wxPyMake_wxObject(&a,false); \
1123 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1126 wxPyEndBlockThreads(blocked); \
1128 PCLASS::CBNAME(a, b, c, d, e); \
1130 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1131 PCLASS::CBNAME(a, b, c, d, e); \
1134 //---------------------------------------------------------------------------
1136 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1137 void CBNAME(wxDC& a, bool b); \
1138 void base_##CBNAME(wxDC& a, bool b)
1141 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1142 void CLASS::CBNAME(wxDC& a, bool b) { \
1144 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1145 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1146 PyObject* obj = wxPyMake_wxObject(&a,false); \
1147 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1150 wxPyEndBlockThreads(blocked); \
1152 PCLASS::CBNAME(a, b); \
1154 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1155 PCLASS::CBNAME(a, b); \
1158 //---------------------------------------------------------------------------
1160 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1161 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1162 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1165 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1166 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1169 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1170 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1171 PyObject* obj = wxPyMake_wxObject(a,false); \
1172 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1175 wxPyEndBlockThreads(blocked); \
1177 PCLASS::CBNAME(a, b, c, d, e, f); \
1179 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1181 PCLASS::CBNAME(a, b, c, d, e, f); \
1184 //---------------------------------------------------------------------------
1186 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1187 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1188 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1191 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1192 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1194 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1195 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1196 PyObject* obj = wxPyMake_wxObject(a,false); \
1197 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1200 wxPyEndBlockThreads(blocked); \
1202 PCLASS::CBNAME(a, b, c, d, e); \
1204 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1206 PCLASS::CBNAME(a, b, c, d, e); \
1209 //---------------------------------------------------------------------------
1211 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1212 void CBNAME(double a, double b, int c); \
1213 void base_##CBNAME(double a, double b, int c)
1216 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1217 void CLASS::CBNAME(double a, double b, int c) { \
1219 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1220 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1221 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1222 wxPyEndBlockThreads(blocked); \
1224 PCLASS::CBNAME(a, b, c); \
1226 void CLASS::base_##CBNAME(double a, double b, int c) { \
1227 PCLASS::CBNAME(a, b, c); \
1230 //---------------------------------------------------------------------------
1232 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1233 void CBNAME(bool a, double b, double c, int d); \
1234 void base_##CBNAME(bool a, double b, double c, int d)
1237 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1238 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1240 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1241 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1242 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1243 wxPyEndBlockThreads(blocked); \
1245 PCLASS::CBNAME(a, b, c, d); \
1247 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1248 PCLASS::CBNAME(a, b, c, d); \
1251 //---------------------------------------------------------------------------
1252 //---------------------------------------------------------------------------
1254 #define DEC_PYCALLBACK__STRING(CBNAME) \
1255 void CBNAME(const wxString& a); \
1256 void base_##CBNAME(const wxString& a)
1258 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1259 void CLASS::CBNAME(const wxString& a) { \
1261 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1262 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1263 PyObject* s = wx2PyString(a); \
1264 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1267 wxPyEndBlockThreads(blocked); \
1269 PCLASS::CBNAME(a); \
1271 void CLASS::base_##CBNAME(const wxString& a) { \
1272 PCLASS::CBNAME(a); \
1275 //---------------------------------------------------------------------------
1277 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1278 bool CBNAME(const wxString& a); \
1279 bool base_##CBNAME(const wxString& a)
1281 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1282 bool CLASS::CBNAME(const wxString& a) { \
1285 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1286 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1287 PyObject* s = wx2PyString(a); \
1288 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1291 wxPyEndBlockThreads(blocked); \
1293 rval = PCLASS::CBNAME(a); \
1296 bool CLASS::base_##CBNAME(const wxString& a) { \
1297 return PCLASS::CBNAME(a); \
1300 //---------------------------------------------------------------------------
1302 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1303 bool CBNAME(const wxString& a)
1305 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1306 bool CLASS::CBNAME(const wxString& a) { \
1308 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1309 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1310 PyObject* s = wx2PyString(a); \
1311 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1314 wxPyEndBlockThreads(blocked); \
1318 //---------------------------------------------------------------------------
1320 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1321 wxString CBNAME(const wxString& a)
1323 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1324 wxString CLASS::CBNAME(const wxString& a) { \
1326 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1327 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1329 PyObject* s = wx2PyString(a); \
1330 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1333 rval = Py2wxString(ro); \
1337 wxPyEndBlockThreads(blocked); \
1341 //---------------------------------------------------------------------------
1343 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1344 wxString CBNAME(const wxString& a); \
1345 wxString base_##CBNAME(const wxString& a)
1347 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1348 wxString CLASS::CBNAME(const wxString& a) { \
1351 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1352 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1354 PyObject* s = wx2PyString(a); \
1355 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1358 rval = Py2wxString(ro); \
1363 rval = PCLASS::CBNAME(a); \
1364 wxPyEndBlockThreads(blocked); \
1368 //---------------------------------------------------------------------------
1370 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1371 wxString CBNAME(const wxString& a,int b)
1373 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1374 wxString CLASS::CBNAME(const wxString& a,int b) { \
1376 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1377 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1379 PyObject* s = wx2PyString(a); \
1380 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1383 rval = Py2wxString(ro); \
1387 wxPyEndBlockThreads(blocked); \
1391 //---------------------------------------------------------------------------
1393 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1394 bool CBNAME(const wxString& a, const wxString& b); \
1395 bool base_##CBNAME(const wxString& a, const wxString& b)
1397 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1398 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1401 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1402 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1403 PyObject* s1 = wx2PyString(a); \
1404 PyObject* s2 = wx2PyString(b); \
1405 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1409 wxPyEndBlockThreads(blocked); \
1411 rval = PCLASS::CBNAME(a, b); \
1414 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1415 return PCLASS::CBNAME(a, b); \
1418 //---------------------------------------------------------------------------
1420 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1421 wxString CBNAME(); \
1422 wxString base_##CBNAME()
1424 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1425 wxString CLASS::CBNAME() { \
1428 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1429 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1431 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1433 rval = Py2wxString(ro); \
1437 wxPyEndBlockThreads(blocked); \
1439 rval = PCLASS::CBNAME(); \
1442 wxString CLASS::base_##CBNAME() { \
1443 return PCLASS::CBNAME(); \
1446 //---------------------------------------------------------------------------
1448 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1449 wxString CBNAME() const; \
1450 wxString base_##CBNAME() const;
1452 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1453 wxString CLASS::CBNAME() const { \
1456 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1457 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1459 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1461 rval = Py2wxString(ro); \
1465 wxPyEndBlockThreads(blocked); \
1467 rval = PCLASS::CBNAME(); \
1470 wxString CLASS::base_##CBNAME() const { \
1471 return PCLASS::CBNAME(); \
1474 //---------------------------------------------------------------------------
1476 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1479 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1480 wxString CLASS::CBNAME() { \
1482 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1483 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1485 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1487 rval = Py2wxString(ro); \
1491 wxPyEndBlockThreads(blocked); \
1495 //---------------------------------------------------------------------------
1497 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1498 wxString CBNAME() const;
1500 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1501 wxString CLASS::CBNAME() const { \
1503 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1504 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1506 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1508 rval = Py2wxString(ro); \
1512 wxPyEndBlockThreads(blocked); \
1516 //---------------------------------------------------------------------------
1518 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1519 bool CBNAME(const wxHtmlTag& a)
1522 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1523 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1525 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1526 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1527 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1528 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1531 wxPyEndBlockThreads(blocked); \
1535 //---------------------------------------------------------------------------
1537 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1538 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1539 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1541 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1542 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1544 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1545 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1546 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1547 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1550 wxPyEndBlockThreads(blocked); \
1552 PCLASS::CBNAME(cell, x, y); \
1554 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1555 PCLASS::CBNAME(cell, x, y); \
1558 //---------------------------------------------------------------------------
1560 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1561 void CBNAME(const wxColour& c); \
1562 void base_##CBNAME(const wxColour& c)
1564 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1565 void CLASS::CBNAME(const wxColour& c) { \
1567 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1568 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1569 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1570 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1573 wxPyEndBlockThreads(blocked); \
1575 PCLASS::CBNAME(c); \
1577 void CLASS::base_##CBNAME(const wxColour& c) { \
1578 PCLASS::CBNAME(c); \
1581 //---------------------------------------------------------------------------
1583 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1584 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1585 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1587 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1588 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1590 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1591 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1592 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1593 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1594 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1598 wxPyEndBlockThreads(blocked); \
1600 PCLASS::CBNAME(cell, x, y, e); \
1602 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1603 PCLASS::CBNAME(cell, x, y, e); \
1608 //---------------------------------------------------------------------------
1610 #define DEC_PYCALLBACK___pure(CBNAME) \
1614 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1615 void CLASS::CBNAME() { \
1616 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1617 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1618 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1619 wxPyEndBlockThreads(blocked); \
1622 //---------------------------------------------------------------------------
1624 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1628 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1629 wxSize CLASS::CBNAME() { \
1630 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1632 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1633 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1636 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1638 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1640 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1641 PyObject* o1 = PySequence_GetItem(ro, 0); \
1642 PyObject* o2 = PySequence_GetItem(ro, 1); \
1643 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1644 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1646 PyErr_SetString(PyExc_TypeError, errmsg); \
1651 PyErr_SetString(PyExc_TypeError, errmsg); \
1656 wxPyEndBlockThreads(blocked); \
1660 //---------------------------------------------------------------------------
1662 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1663 bool CBNAME(wxWindow* a); \
1664 bool base_##CBNAME(wxWindow* a)
1667 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1668 bool CLASS::CBNAME(wxWindow* a) { \
1671 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1672 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1673 PyObject* obj = wxPyMake_wxObject(a,false); \
1674 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1677 wxPyEndBlockThreads(blocked); \
1679 rval = PCLASS::CBNAME(a); \
1682 bool CLASS::base_##CBNAME(wxWindow* a) { \
1683 return PCLASS::CBNAME(a); \
1686 //---------------------------------------------------------------------------
1688 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1689 bool CBNAME(wxWindow* a, wxDC& b); \
1690 bool base_##CBNAME(wxWindow* a, wxDC& b)
1693 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1694 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1697 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1698 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1699 PyObject* win = wxPyMake_wxObject(a,false); \
1700 PyObject* dc = wxPyMake_wxObject(&b,false); \
1701 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1705 wxPyEndBlockThreads(blocked); \
1707 rval = PCLASS::CBNAME(a, b); \
1710 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1711 return PCLASS::CBNAME(a, b); \
1714 //---------------------------------------------------------------------------
1716 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1717 void CBNAME(wxWindowBase* a); \
1718 void base_##CBNAME(wxWindowBase* a)
1721 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1722 void CLASS::CBNAME(wxWindowBase* a) { \
1724 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1725 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1726 PyObject* obj = wxPyMake_wxObject(a,false); \
1727 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1730 wxPyEndBlockThreads(blocked); \
1732 PCLASS::CBNAME(a); \
1734 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1735 PCLASS::CBNAME(a); \
1738 //---------------------------------------------------------------------------
1740 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1742 bool base_##CBNAME()
1745 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1746 bool CLASS::CBNAME() { \
1749 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1750 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1751 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1752 wxPyEndBlockThreads(blocked); \
1754 rval = PCLASS::CBNAME(); \
1757 bool CLASS::base_##CBNAME() { \
1758 return PCLASS::CBNAME(); \
1761 //---------------------------------------------------------------------------
1763 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1764 bool CBNAME() const; \
1765 bool base_##CBNAME() const
1768 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1769 bool CLASS::CBNAME() const { \
1772 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1773 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1774 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1775 wxPyEndBlockThreads(blocked); \
1777 rval = PCLASS::CBNAME(); \
1780 bool CLASS::base_##CBNAME() const { \
1781 return PCLASS::CBNAME(); \
1784 //---------------------------------------------------------------------------
1786 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1787 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1788 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1791 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1792 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1795 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1796 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1797 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1798 wxPyEndBlockThreads(blocked); \
1800 rval = PCLASS::CBNAME(a, b, c); \
1801 return (wxDragResult)rval; \
1803 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1804 return PCLASS::CBNAME(a, b, c); \
1807 //---------------------------------------------------------------------------
1809 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1810 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1812 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1813 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1814 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1816 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1818 PyObject* obj = wxPyMake_wxObject(&a,false); \
1819 PyObject* s = wx2PyString(b); \
1820 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1823 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1829 wxPyEndBlockThreads(blocked); \
1833 //---------------------------------------------------------------------------
1835 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1836 bool CBNAME(wxDragResult a); \
1837 bool base_##CBNAME(wxDragResult a)
1840 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1841 bool CLASS::CBNAME(wxDragResult a) { \
1844 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1845 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1846 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1847 wxPyEndBlockThreads(blocked); \
1849 rval = PCLASS::CBNAME(a); \
1852 bool CLASS::base_##CBNAME(wxDragResult a) { \
1853 return PCLASS::CBNAME(a); \
1856 //---------------------------------------------------------------------------
1858 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1859 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1862 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1863 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1864 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1866 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1867 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1868 wxPyEndBlockThreads(blocked); \
1869 return (wxDragResult)rval; \
1872 //---------------------------------------------------------------------------
1874 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1875 bool CBNAME(int a, int b, const wxString& c)
1877 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1878 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1880 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1881 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1882 PyObject* s = wx2PyString(c); \
1883 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1886 wxPyEndBlockThreads(blocked); \
1890 //---------------------------------------------------------------------------
1892 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1894 size_t base_##CBNAME()
1897 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1898 size_t CLASS::CBNAME() { \
1901 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1902 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1903 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1904 wxPyEndBlockThreads(blocked); \
1906 rval = PCLASS::CBNAME(); \
1909 size_t CLASS::base_##CBNAME() { \
1910 return PCLASS::CBNAME(); \
1913 //---------------------------------------------------------------------------
1915 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1916 size_t CBNAME() const; \
1917 size_t base_##CBNAME() const
1920 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1921 size_t CLASS::CBNAME() const { \
1924 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1925 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1926 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1927 wxPyEndBlockThreads(blocked); \
1929 rval = PCLASS::CBNAME(); \
1932 size_t CLASS::base_##CBNAME() const { \
1933 return PCLASS::CBNAME(); \
1936 //---------------------------------------------------------------------------
1938 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1939 wxDataFormat CBNAME(size_t a); \
1940 wxDataFormat base_##CBNAME(size_t a)
1943 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1944 wxDataFormat CLASS::CBNAME(size_t a) { \
1945 wxDataFormat rval=0; \
1947 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1948 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1950 wxDataFormat* ptr; \
1951 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1953 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1958 wxPyEndBlockThreads(blocked); \
1960 rval = PCLASS::CBNAME(a); \
1963 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1964 return PCLASS::CBNAME(a); \
1967 //---------------------------------------------------------------------------
1969 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1970 void CBNAME(const Type& a); \
1971 void base_##CBNAME(const Type& a)
1974 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1975 void CLASS::CBNAME(const Type& a) { \
1977 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1978 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1979 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1980 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1983 wxPyEndBlockThreads(blocked); \
1985 PCLASS::CBNAME(a); \
1987 void CLASS::base_##CBNAME(const Type& a) { \
1988 PCLASS::CBNAME(a); \
1992 //---------------------------------------------------------------------------
1994 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1995 void CBNAME(Type& a); \
1996 void base_##CBNAME(Type& a)
1999 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2000 void CLASS::CBNAME(Type& a) { \
2002 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2003 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2004 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2005 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2008 wxPyEndBlockThreads(blocked); \
2010 PCLASS::CBNAME(a); \
2012 void CLASS::base_##CBNAME(Type& a) { \
2013 PCLASS::CBNAME(a); \
2016 //---------------------------------------------------------------------------
2018 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2019 bool CBNAME(Type& a); \
2020 bool base_##CBNAME(Type& a)
2023 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2024 bool CLASS::CBNAME(Type& a) { \
2027 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2028 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2029 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2030 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2033 wxPyEndBlockThreads(blocked); \
2035 rv = PCLASS::CBNAME(a); \
2038 bool CLASS::base_##CBNAME(Type& a) { \
2039 return PCLASS::CBNAME(a); \
2042 //---------------------------------------------------------------------------
2044 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2045 bool CBNAME(Type& a)
2048 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2049 bool CLASS::CBNAME(Type& a) { \
2051 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2052 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2053 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2054 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2057 wxPyEndBlockThreads(blocked); \
2061 //---------------------------------------------------------------------------
2063 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2064 wxString CBNAME(long a, long b) const; \
2065 wxString base_##CBNAME(long a, long b) const
2067 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2068 wxString CLASS::CBNAME(long a, long b) const { \
2071 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2072 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2074 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2076 rval = Py2wxString(ro); \
2080 wxPyEndBlockThreads(blocked); \
2082 rval = PCLASS::CBNAME(a,b); \
2085 wxString CLASS::base_##CBNAME(long a, long b) const { \
2086 return PCLASS::CBNAME(a,b); \
2089 //---------------------------------------------------------------------------
2091 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2092 int CBNAME(long a) const; \
2093 int base_##CBNAME(long a) const
2096 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2097 int CLASS::CBNAME(long a) const { \
2100 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2101 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2103 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2105 rval = PyInt_AsLong(ro); \
2109 wxPyEndBlockThreads(blocked); \
2111 rval = PCLASS::CBNAME(a); \
2114 int CLASS::base_##CBNAME(long a) const { \
2115 return PCLASS::CBNAME(a); \
2121 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2122 int CBNAME(long a) const;
2125 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2126 int CLASS::CBNAME(long a) const { \
2127 int rval=-1; /* this rval is important for OnGetItemImage */ \
2129 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2130 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2132 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2134 rval = PyInt_AsLong(ro); \
2138 wxPyEndBlockThreads(blocked); \
2143 //---------------------------------------------------------------------------
2145 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2146 wxListItemAttr* CBNAME(long a) const; \
2147 wxListItemAttr* base_##CBNAME(long a) const
2150 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2151 wxListItemAttr *CLASS::CBNAME(long a) const { \
2152 wxListItemAttr *rval = NULL; \
2154 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2155 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2157 wxListItemAttr* ptr; \
2158 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2160 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2165 wxPyEndBlockThreads(blocked); \
2167 rval = PCLASS::CBNAME(a); \
2170 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2171 return PCLASS::CBNAME(a); \
2174 //---------------------------------------------------------------------------
2176 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2177 bool CBNAME(wxMouseEvent& e); \
2178 bool base_##CBNAME(wxMouseEvent& e)
2180 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2181 bool CLASS::CBNAME(wxMouseEvent& e) { \
2184 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2185 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2187 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2188 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2190 rval = PyInt_AsLong(ro); \
2195 wxPyEndBlockThreads(blocked); \
2197 return PCLASS::CBNAME(e); \
2200 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2201 return PCLASS::CBNAME(e); \
2205 //---------------------------------------------------------------------------
2207 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2208 wxWizardPage* CBNAME() const
2210 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2211 wxWizardPage* CLASS::CBNAME() const { \
2212 wxWizardPage* rv = NULL; \
2213 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2214 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2216 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2218 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2222 wxPyEndBlockThreads(blocked); \
2226 //---------------------------------------------------------------------------
2228 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2229 wxBitmap CBNAME() const
2231 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2232 wxBitmap CLASS::CBNAME() const { \
2234 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2235 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2238 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2240 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2245 wxPyEndBlockThreads(blocked); \
2249 //---------------------------------------------------------------------------
2251 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2254 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2255 wxObject* CLASS::CBNAME() { \
2256 wxObject* rv = NULL; \
2257 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2258 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2260 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2262 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2266 wxPyEndBlockThreads(blocked); \
2270 //---------------------------------------------------------------------------
2272 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2273 wxObject* CBNAME(const wxString& a)
2275 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2276 wxObject* CLASS::CBNAME(const wxString& a) { \
2277 wxObject* rv = NULL; \
2278 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2279 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2280 PyObject* so = wx2PyString(a); \
2282 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2284 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2289 wxPyEndBlockThreads(blocked); \
2293 //---------------------------------------------------------------------------
2295 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2296 bool CBNAME(wxXmlNode* a)
2299 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2300 bool CLASS::CBNAME(wxXmlNode* a) { \
2302 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2303 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2304 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2305 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2308 wxPyEndBlockThreads(blocked); \
2312 //---------------------------------------------------------------------------
2314 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2315 wxCoord CBNAME(size_t a) const
2318 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2319 wxCoord CLASS::CBNAME(size_t a) const { \
2322 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2323 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2324 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2326 wxPyEndBlockThreads(blocked); \
2330 //---------------------------------------------------------------------------
2332 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2333 void CBNAME(size_t a, size_t b) const; \
2334 void base_##CBNAME(size_t a, size_t b) const
2337 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2338 void CLASS::CBNAME(size_t a, size_t b) const { \
2340 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2341 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2342 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2343 wxPyEndBlockThreads(blocked); \
2345 PCLASS::CBNAME(a,b); \
2347 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2348 PCLASS::CBNAME(a,b); \
2351 //---------------------------------------------------------------------------
2353 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2354 wxCoord CBNAME() const; \
2355 wxCoord base_##CBNAME() const
2358 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2359 wxCoord CLASS::CBNAME() const { \
2362 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2363 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2364 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2365 wxPyEndBlockThreads(blocked); \
2367 rval = PCLASS::CBNAME(); \
2370 wxCoord CLASS::base_##CBNAME() const { \
2371 return PCLASS::CBNAME(); \
2374 //---------------------------------------------------------------------------
2376 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2377 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2380 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2381 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2383 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2384 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2385 PyObject* obj = wxPyMake_wxObject(&a,false); \
2386 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2387 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2390 wxPyEndBlockThreads(blocked); \
2393 //---------------------------------------------------------------------------
2395 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2396 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2397 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2400 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2401 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2403 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2404 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2405 PyObject* obj = wxPyMake_wxObject(&a,false); \
2406 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2407 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2410 wxPyEndBlockThreads(blocked); \
2412 PCLASS::CBNAME(a,b,c); \
2414 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2415 PCLASS::CBNAME(a,b,c); \
2418 //---------------------------------------------------------------------------
2421 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2422 wxString CBNAME(size_t a) const; \
2423 wxString base_##CBNAME(size_t a) const
2425 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2426 wxString CLASS::CBNAME(size_t a) const { \
2429 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2430 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2432 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2434 rval = Py2wxString(ro); \
2438 wxPyEndBlockThreads(blocked); \
2440 rval = PCLASS::CBNAME(a); \
2443 wxString CLASS::base_##CBNAME(size_t a) const { \
2444 return PCLASS::CBNAME(a); \
2447 //---------------------------------------------------------------------------
2449 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2450 wxString CBNAME(size_t a) const
2452 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2453 wxString CLASS::CBNAME(size_t a) const { \
2456 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2457 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2459 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2461 rval = Py2wxString(ro); \
2465 wxPyEndBlockThreads(blocked); \
2469 //---------------------------------------------------------------------------
2471 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2472 wxVisualAttributes CBNAME() const; \
2473 wxVisualAttributes base_##CBNAME()
2476 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2477 wxVisualAttributes CLASS::CBNAME() const { \
2478 wxVisualAttributes rval; \
2480 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2481 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2483 wxVisualAttributes* ptr; \
2484 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2486 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2491 wxPyEndBlockThreads(blocked); \
2493 rval = PCLASS::CBNAME(); \
2496 wxVisualAttributes CLASS::base_##CBNAME() { \
2497 return PCLASS::CBNAME(); \
2500 //---------------------------------------------------------------------------