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
94 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
96 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
100 #ifndef wxPyUSE_EXPORTED_API
102 void __wxPyPreStart(PyObject
*);
103 void __wxPyCleanup();
104 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
105 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
107 void wxSetDefaultPyEncoding(const char* encoding
);
108 const char* wxGetDefaultPyEncoding();
111 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
114 bool wxPyCheckSwigType(const wxChar
* className
);
115 PyObject
* wxPyConstructObject(void* ptr
,
116 const wxChar
* className
,
118 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
119 const wxChar
* className
);
120 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
123 PyObject
* wx2PyString(const wxString
& src
);
124 wxString
Py2wxString(PyObject
* source
);
126 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
127 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
128 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
130 PyObject
* wxPy_ConvertList(wxListBase
* list
);
131 long wxPyGetWinHandle(wxWindow
* win
);
133 void wxPy_ReinitStockObjects(int pass
);
135 bool wxPyInstance_Check(PyObject
* obj
);
136 bool wxPySwigInstance_Check(PyObject
* obj
);
139 #endif // wxPyUSE_EXPORTED_API
140 //---------------------------------------------------------------------------
142 // if we want to handle threads and Python threads are available...
143 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
144 #define WXP_WITH_THREAD
145 #else // no Python threads...
146 #undef WXP_WITH_THREAD
150 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
151 // blocking threads when calling back into Python. Using them instead of my
152 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
153 // wxPyEndBlockThreads.
155 // Unfortunatly there is a bug somewhere when using these new APIs on Python
156 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
157 // at breakpoints located in event handlers. I think that the cause may be
158 // something like the original PyThreadState for the main thread is not being
159 // restored for the callbacks, but I can't see where that could be
160 // happening... So we'll only activate this new change for Python 2.4+ :-(
162 #if PY_VERSION_HEX < 0x02040000
163 #define wxPyUSE_GIL_STATE 0
164 typedef bool wxPyBlock_t
;
166 #define wxPyUSE_GIL_STATE 1
167 typedef PyGILState_STATE wxPyBlock_t
;
171 #ifndef wxPyUSE_EXPORTED_API
173 // For Python --> C++
174 PyThreadState
* wxPyBeginAllowThreads();
175 void wxPyEndAllowThreads(PyThreadState
* state
);
177 // For C++ --> Python
178 wxPyBlock_t
wxPyBeginBlockThreads();
179 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
181 #endif // wxPyUSE_EXPORTED_API
184 // A macro that will help to execute simple statments wrapped in
185 // StartBlock/EndBlockThreads calls
186 #define wxPyBLOCK_THREADS(stmt) \
187 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
189 // Raise the NotImplementedError exception (blocking threads)
190 #define wxPyRaiseNotImplemented() \
191 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
193 // Raise any exception with a string value (blocking threads)
194 #define wxPyErr_SetString(err, str) \
195 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
198 //---------------------------------------------------------------------------
199 // These are helpers used by the typemaps
201 #ifndef wxPyUSE_EXPORTED_API
203 wxString
* wxString_in_helper(PyObject
* source
);
205 byte
* byte_LIST_helper(PyObject
* source
);
206 int* int_LIST_helper(PyObject
* source
);
207 long* long_LIST_helper(PyObject
* source
);
208 char** string_LIST_helper(PyObject
* source
);
209 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
210 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
211 wxString
* wxString_LIST_helper(PyObject
* source
);
212 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
213 wxPen
** wxPen_LIST_helper(PyObject
* source
);
215 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
216 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
217 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
218 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
219 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
220 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
223 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
224 bool wxColour_typecheck(PyObject
* source
);
226 bool wxPyCheckForApp();
230 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
232 // If source is an object instance then it may already be the right type
233 if (wxPySwigInstance_Check(source
)) {
235 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
240 // otherwise a 2-tuple of integers is expected
241 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
242 PyObject
* o1
= PySequence_GetItem(source
, 0);
243 PyObject
* o2
= PySequence_GetItem(source
, 1);
244 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
249 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
257 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
258 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
264 // Other helpful stuff
265 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
266 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
268 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
269 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
271 #endif // wxPyUSE_EXPORTED_API
273 //---------------------------------------------------------------------------
275 #if PYTHON_API_VERSION < 1009
276 #define PySequence_Fast_GET_ITEM(o, i) \
277 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
280 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
281 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
282 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
284 //---------------------------------------------------------------------------
286 #ifndef wxPyUSE_EXPORTED_API
288 class wxPyCallback
: public wxObject
{
289 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
291 wxPyCallback(PyObject
* func
);
292 wxPyCallback(const wxPyCallback
& other
);
295 void EventThunker(wxEvent
& event
);
300 #endif // wxPyUSE_EXPORTED_API
301 //---------------------------------------------------------------------------
302 //---------------------------------------------------------------------------
303 // These Event classes can be derived from in Python and passed through the
304 // event system without loosing anything. They do this by keeping a reference
305 // to themselves and some special case handling in wxPyCallback::EventThunker.
309 class wxPyEvtSelfRef
{
314 void SetSelf(PyObject
* self
, bool clone
=false);
315 PyObject
* GetSelf() const;
316 bool GetCloned() const { return m_cloned
; }
324 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
325 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
327 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
328 wxPyEvent(const wxPyEvent
& evt
);
331 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
335 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
336 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
338 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
339 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
342 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
347 //----------------------------------------------------------------------
348 // Forward decalre a few things used in the exported API
349 class wxPyClientData
;
351 class wxPyOORClientData
;
352 class wxPyCBInputStream
;
354 void wxPyClientData_dtor(wxPyClientData
* self
);
355 void wxPyUserData_dtor(wxPyUserData
* self
);
356 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
357 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
358 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
360 //---------------------------------------------------------------------------
361 // Export a C API in a struct. Other modules will be able to load this from
362 // the wx.core module and will then have safe access to these functions, even if
363 // in another shared library.
365 class wxPyCallbackHelper
;
369 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
370 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
371 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
372 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
374 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
375 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
376 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
377 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
379 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
381 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
382 wxString (*p_Py2wxString
)(PyObject
* source
);
383 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
385 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
386 int* (*p_int_LIST_helper
)(PyObject
* source
);
387 long* (*p_long_LIST_helper
)(PyObject
* source
);
388 char** (*p_string_LIST_helper
)(PyObject
* source
);
389 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
390 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
391 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
392 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
394 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
395 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
396 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
397 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
398 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
399 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
402 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
403 bool (*p_wxColour_typecheck
)(PyObject
* source
);
405 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
406 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
407 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
408 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
409 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
411 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
412 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
413 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
414 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
415 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
416 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
417 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
419 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
420 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
421 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
423 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
424 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
426 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
427 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
429 bool (*p_wxPyCheckForApp
)();
433 #ifdef wxPyUSE_EXPORTED_API
434 // Notice that this is static, not extern. This is by design, each module
435 // needs one, but doesn't have to use it.
436 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
437 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
438 #endif // wxPyUSE_EXPORTED_API
440 //---------------------------------------------------------------------------
442 // A wxObject that holds a reference to a Python object
443 class wxPyUserData
: public wxObject
{
445 wxPyUserData(PyObject
* obj
) {
451 #ifdef wxPyUSE_EXPORTED_API
452 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
454 wxPyUserData_dtor(this);
461 // A wxClientData that holds a refernece to a Python object
462 class wxPyClientData
: public wxClientData
{
464 wxPyClientData(PyObject
* obj
, bool incref
=true) {
472 #ifdef wxPyUSE_EXPORTED_API
473 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
475 wxPyClientData_dtor(this);
483 // Just like wxPyClientData, except when this object is destroyed it does some
484 // OOR magic on the Python Object.
485 class wxPyOORClientData
: public wxPyClientData
{
487 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
488 : wxPyClientData(obj
, incref
) {}
489 ~wxPyOORClientData() {
491 #ifdef wxPyUSE_EXPORTED_API
492 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
494 wxPyOORClientData_dtor(this);
500 //---------------------------------------------------------------------------
501 // This class holds an instance of a Python Shadow Class object and assists
502 // with looking up and invoking Python callback methods from C++ virtual
503 // method redirections. For all classes which have virtuals which should be
504 // overridable in wxPython, a new subclass is created that contains a
505 // wxPyCallbackHelper.
508 class wxPyCallbackHelper
{
510 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
512 wxPyCallbackHelper() {
519 ~wxPyCallbackHelper() {
520 #ifdef wxPyUSE_EXPORTED_API
521 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
523 wxPyCBH_delete(this);
527 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
528 bool findCallback(const char* name
) const;
529 int callCallback(PyObject
* argTuple
) const;
530 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
531 PyObject
* GetLastFound() const { return m_lastFound
; }
536 PyObject
* m_lastFound
;
539 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
543 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
544 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
545 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
546 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
547 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
552 //---------------------------------------------------------------------------
554 // This is used in C++ classes that need to be able to make callback to
555 // "overloaded" python methods
558 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
559 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
561 private: wxPyCallbackHelper m_myInst
564 //---------------------------------------------------------------------------
565 // The wxPythonApp class
568 wxPYAPP_ASSERT_SUPPRESS
= 1,
569 wxPYAPP_ASSERT_EXCEPTION
= 2,
570 wxPYAPP_ASSERT_DIALOG
= 4,
571 wxPYAPP_ASSERT_LOG
= 8
574 class wxPyApp
: public wxApp
576 DECLARE_ABSTRACT_CLASS(wxPyApp
);
584 int GetAssertMode() { return m_assertMode
; }
585 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
587 virtual bool OnInitGui();
588 virtual int OnExit();
590 virtual void OnAssert(const wxChar
*file
,
595 // virtual int FilterEvent(wxEvent& event); // This one too????
597 // For catching Apple Events
598 virtual void MacOpenFile(const wxString
&fileName
);
599 virtual void MacPrintFile(const wxString
&fileName
);
600 virtual void MacNewFile();
601 virtual void MacReopenApp();
603 static bool GetMacSupportPCMenuShortcuts();
604 static long GetMacAboutMenuItemId();
605 static long GetMacPreferencesMenuItemId();
606 static long GetMacExitMenuItemId();
607 static wxString
GetMacHelpMenuTitleName();
609 static void SetMacSupportPCMenuShortcuts(bool val
);
610 static void SetMacAboutMenuItemId(long val
);
611 static void SetMacPreferencesMenuItemId(long val
);
612 static void SetMacExitMenuItemId(long val
);
613 static void SetMacHelpMenuTitleName(const wxString
& val
);
616 void _BootstrapApp();
618 // implementation only
619 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
623 bool m_startupComplete
;
626 extern wxPyApp
*wxPythonApp
;
629 //----------------------------------------------------------------------
630 // These macros are used to implement the virtual methods that should
631 // redirect to a Python method if one exists. The names designate the
632 // return type, if any, as well as any parameter types.
633 //---------------------------------------------------------------------------
635 #define DEC_PYCALLBACK__(CBNAME) \
640 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
641 void CLASS::CBNAME() { \
643 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
644 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
645 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
646 wxPyEndBlockThreads(blocked); \
650 void CLASS::base_##CBNAME() { \
654 //---------------------------------------------------------------------------
656 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
657 bool CBNAME(int a, int b); \
658 bool base_##CBNAME(int a, int b)
661 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
662 bool CLASS::CBNAME(int a, int b) { \
663 bool rval=false, found; \
664 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
665 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
666 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
667 wxPyEndBlockThreads(blocked); \
669 rval = PCLASS::CBNAME(a,b); \
672 bool CLASS::base_##CBNAME(int a, int b) { \
673 return PCLASS::CBNAME(a,b); \
676 //---------------------------------------------------------------------------
678 #define DEC_PYCALLBACK_VOID_(CBNAME) \
683 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
684 void CLASS::CBNAME() { \
686 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
688 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
689 wxPyEndBlockThreads(blocked); \
693 void CLASS::base_##CBNAME() { \
697 //---------------------------------------------------------------------------
699 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
700 void CBNAME(int a, int b); \
701 void base_##CBNAME(int a, int b)
704 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
705 void CLASS::CBNAME(int a, int b) { \
707 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
708 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
709 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
710 wxPyEndBlockThreads(blocked); \
712 PCLASS::CBNAME(a,b); \
714 void CLASS::base_##CBNAME(int a, int b) { \
715 PCLASS::CBNAME(a,b); \
718 //---------------------------------------------------------------------------
720 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
721 void CBNAME(int a); \
722 void base_##CBNAME(int a)
725 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
726 void CLASS::CBNAME(int a) { \
728 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
730 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
731 wxPyEndBlockThreads(blocked); \
735 void CLASS::base_##CBNAME(int a) { \
739 //---------------------------------------------------------------------------
741 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
742 void CBNAME(int a, int b, int c, int d); \
743 void base_##CBNAME(int a, int b, int c, int d)
746 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
747 void CLASS::CBNAME(int a, int b, int c, int d) { \
749 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
750 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
751 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
752 wxPyEndBlockThreads(blocked); \
754 PCLASS::CBNAME(a,b,c,d); \
756 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
757 PCLASS::CBNAME(a,b,c,d); \
760 //---------------------------------------------------------------------------
761 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
762 void CBNAME(int a, int b, int c, int d, int e); \
763 void base_##CBNAME(int a, int b, int c, int d, int e)
766 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
767 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
769 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
770 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
771 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
772 wxPyEndBlockThreads(blocked); \
774 PCLASS::CBNAME(a,b,c,d,e); \
776 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
777 PCLASS::CBNAME(a,b,c,d,e); \
780 //---------------------------------------------------------------------------
782 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
783 void CBNAME(int* a, int* b) const; \
784 void base_##CBNAME(int* a, int* b) const
787 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
788 void CLASS::CBNAME(int* a, int* b) const { \
789 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
791 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
792 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
794 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
796 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
797 PyObject* o1 = PySequence_GetItem(ro, 0); \
798 PyObject* o2 = PySequence_GetItem(ro, 1); \
799 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
800 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
803 PyErr_SetString(PyExc_TypeError, errmsg); \
808 PyErr_SetString(PyExc_TypeError, errmsg); \
813 wxPyEndBlockThreads(blocked); \
815 PCLASS::CBNAME(a,b); \
817 void CLASS::base_##CBNAME(int* a, int* b) const { \
818 PCLASS::CBNAME(a,b); \
822 //---------------------------------------------------------------------------
824 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
825 wxSize CBNAME() const; \
826 wxSize base_##CBNAME() const
829 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
830 wxSize CLASS::CBNAME() const { \
831 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
832 bool found; wxSize rval(0,0); \
833 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
834 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
836 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
838 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
839 PyObject* o1 = PySequence_GetItem(ro, 0); \
840 PyObject* o2 = PySequence_GetItem(ro, 1); \
841 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
842 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
845 PyErr_SetString(PyExc_TypeError, errmsg); \
850 PyErr_SetString(PyExc_TypeError, errmsg); \
855 wxPyEndBlockThreads(blocked); \
857 return PCLASS::CBNAME(); \
861 wxSize CLASS::base_##CBNAME() const { \
862 return PCLASS::CBNAME(); \
866 //---------------------------------------------------------------------------
868 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
869 bool CBNAME(bool a); \
870 bool base_##CBNAME(bool a)
873 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
874 bool CLASS::CBNAME(bool a) { \
875 bool rval=false, found; \
876 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
877 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
878 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
879 wxPyEndBlockThreads(blocked); \
881 rval = PCLASS::CBNAME(a); \
884 bool CLASS::base_##CBNAME(bool a) { \
885 return PCLASS::CBNAME(a); \
888 //---------------------------------------------------------------------------
890 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
891 bool CBNAME(int a); \
892 bool base_##CBNAME(int a)
895 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
896 bool CLASS::CBNAME(int a) { \
897 bool rval=false, found; \
898 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
899 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
900 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
901 wxPyEndBlockThreads(blocked); \
903 rval = PCLASS::CBNAME(a); \
906 bool CLASS::base_##CBNAME(int a) { \
907 return PCLASS::CBNAME(a); \
910 //---------------------------------------------------------------------------
912 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
916 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
917 bool CLASS::CBNAME(int a) { \
919 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
920 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
921 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
923 wxPyEndBlockThreads(blocked); \
928 //---------------------------------------------------------------------------
930 #define DEC_PYCALLBACK__DC(CBNAME) \
931 void CBNAME(wxDC& a); \
932 void base_##CBNAME(wxDC& a)
935 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
936 void CLASS::CBNAME(wxDC& a) { \
938 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
939 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
940 PyObject* obj = wxPyMake_wxObject(&a,false); \
941 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
944 wxPyEndBlockThreads(blocked); \
948 void CLASS::base_##CBNAME(wxDC& a) { \
954 //---------------------------------------------------------------------------
956 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
957 void CBNAME(wxDC& a, bool b); \
958 void base_##CBNAME(wxDC& a, bool b)
961 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
962 void CLASS::CBNAME(wxDC& a, bool b) { \
964 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
965 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
966 PyObject* obj = wxPyMake_wxObject(&a,false); \
967 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
970 wxPyEndBlockThreads(blocked); \
972 PCLASS::CBNAME(a, b); \
974 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
975 PCLASS::CBNAME(a, b); \
978 //---------------------------------------------------------------------------
980 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
981 void CBNAME(wxDC& a, bool b); \
982 void base_##CBNAME(wxDC& a, bool b)
985 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
986 void CLASS::CBNAME(wxDC& a, bool b) { \
988 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
989 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
990 PyObject* obj = wxPyMake_wxObject(&a,false); \
991 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
994 wxPyEndBlockThreads(blocked); \
996 PCLASS::CBNAME(a, b); \
998 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
999 PCLASS::CBNAME(a, b); \
1002 //---------------------------------------------------------------------------
1004 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1005 void CBNAME(double a, double b); \
1006 void base_##CBNAME(double a, double b)
1009 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1010 void CLASS::CBNAME(double a, double b) { \
1012 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1013 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1014 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1015 wxPyEndBlockThreads(blocked); \
1017 PCLASS::CBNAME(a, b); \
1019 void CLASS::base_##CBNAME(double a, double b) { \
1020 PCLASS::CBNAME(a, b); \
1023 //---------------------------------------------------------------------------
1025 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1026 void CBNAME(double a, double b, int c, int d); \
1027 void base_##CBNAME(double a, double b, int c, int d)
1030 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1031 void CLASS::CBNAME(double a, double b, int c, int d) { \
1033 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1034 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1035 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1037 wxPyEndBlockThreads(blocked); \
1039 PCLASS::CBNAME(a, b, c, d); \
1041 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1042 PCLASS::CBNAME(a, b, c, d); \
1045 //---------------------------------------------------------------------------
1047 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1048 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1049 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1052 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1053 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1055 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1056 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1057 PyObject* obj = wxPyMake_wxObject(&a,false); \
1058 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1061 wxPyEndBlockThreads(blocked); \
1063 PCLASS::CBNAME(a, b, c, d, e, f); \
1065 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1066 PCLASS::CBNAME(a, b, c, d, e, f); \
1069 //---------------------------------------------------------------------------
1071 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1072 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1073 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1076 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1077 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1079 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1081 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1082 PyObject* obj = wxPyMake_wxObject(&a,false); \
1083 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1086 wxPyEndBlockThreads(blocked); \
1088 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1091 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1092 return PCLASS::CBNAME(a, b, c, d, e, f); \
1095 //---------------------------------------------------------------------------
1097 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1098 void CBNAME(bool a, double b, double c, int d, int e); \
1099 void base_##CBNAME(bool a, double b, double c, int d, int e)
1102 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1103 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1105 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1106 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1107 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1109 wxPyEndBlockThreads(blocked); \
1111 PCLASS::CBNAME(a, b, c, d, e); \
1113 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1114 PCLASS::CBNAME(a, b, c, d, e); \
1117 //---------------------------------------------------------------------------
1119 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1120 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1121 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1124 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1125 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1127 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1128 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1129 PyObject* obj = wxPyMake_wxObject(&a,false); \
1130 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1133 wxPyEndBlockThreads(blocked); \
1135 PCLASS::CBNAME(a, b, c, d, e); \
1137 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1138 PCLASS::CBNAME(a, b, c, d, e); \
1141 //---------------------------------------------------------------------------
1143 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1144 void CBNAME(wxDC& a, bool b); \
1145 void base_##CBNAME(wxDC& a, bool b)
1148 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1149 void CLASS::CBNAME(wxDC& a, bool b) { \
1151 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1152 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1153 PyObject* obj = wxPyMake_wxObject(&a,false); \
1154 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1157 wxPyEndBlockThreads(blocked); \
1159 PCLASS::CBNAME(a, b); \
1161 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1162 PCLASS::CBNAME(a, b); \
1165 //---------------------------------------------------------------------------
1167 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1168 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1169 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1172 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1173 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1176 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1177 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1178 PyObject* obj = wxPyMake_wxObject(a,false); \
1179 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1182 wxPyEndBlockThreads(blocked); \
1184 PCLASS::CBNAME(a, b, c, d, e, f); \
1186 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1188 PCLASS::CBNAME(a, b, c, d, e, f); \
1191 //---------------------------------------------------------------------------
1193 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1194 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1195 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1198 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1199 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1201 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1202 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1203 PyObject* obj = wxPyMake_wxObject(a,false); \
1204 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1207 wxPyEndBlockThreads(blocked); \
1209 PCLASS::CBNAME(a, b, c, d, e); \
1211 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1213 PCLASS::CBNAME(a, b, c, d, e); \
1216 //---------------------------------------------------------------------------
1218 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1219 void CBNAME(double a, double b, int c); \
1220 void base_##CBNAME(double a, double b, int c)
1223 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1224 void CLASS::CBNAME(double a, double b, int c) { \
1226 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1227 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1228 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1229 wxPyEndBlockThreads(blocked); \
1231 PCLASS::CBNAME(a, b, c); \
1233 void CLASS::base_##CBNAME(double a, double b, int c) { \
1234 PCLASS::CBNAME(a, b, c); \
1237 //---------------------------------------------------------------------------
1239 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1240 void CBNAME(bool a, double b, double c, int d); \
1241 void base_##CBNAME(bool a, double b, double c, int d)
1244 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1245 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1247 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1248 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1249 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1250 wxPyEndBlockThreads(blocked); \
1252 PCLASS::CBNAME(a, b, c, d); \
1254 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1255 PCLASS::CBNAME(a, b, c, d); \
1258 //---------------------------------------------------------------------------
1259 //---------------------------------------------------------------------------
1261 #define DEC_PYCALLBACK__STRING(CBNAME) \
1262 void CBNAME(const wxString& a); \
1263 void base_##CBNAME(const wxString& a)
1265 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1266 void CLASS::CBNAME(const wxString& a) { \
1268 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1269 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1270 PyObject* s = wx2PyString(a); \
1271 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1274 wxPyEndBlockThreads(blocked); \
1276 PCLASS::CBNAME(a); \
1278 void CLASS::base_##CBNAME(const wxString& a) { \
1279 PCLASS::CBNAME(a); \
1282 //---------------------------------------------------------------------------
1284 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1285 bool CBNAME(const wxString& a); \
1286 bool base_##CBNAME(const wxString& a)
1288 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1289 bool CLASS::CBNAME(const wxString& a) { \
1292 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1293 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1294 PyObject* s = wx2PyString(a); \
1295 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1298 wxPyEndBlockThreads(blocked); \
1300 rval = PCLASS::CBNAME(a); \
1303 bool CLASS::base_##CBNAME(const wxString& a) { \
1304 return PCLASS::CBNAME(a); \
1307 //---------------------------------------------------------------------------
1309 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1310 bool CBNAME(const wxString& a)
1312 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1313 bool CLASS::CBNAME(const wxString& a) { \
1315 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1316 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1317 PyObject* s = wx2PyString(a); \
1318 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1321 wxPyEndBlockThreads(blocked); \
1325 //---------------------------------------------------------------------------
1327 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1328 wxString CBNAME(const wxString& a)
1330 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1331 wxString CLASS::CBNAME(const wxString& a) { \
1333 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1334 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1336 PyObject* s = wx2PyString(a); \
1337 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1340 rval = Py2wxString(ro); \
1344 wxPyEndBlockThreads(blocked); \
1348 //---------------------------------------------------------------------------
1350 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1351 wxString CBNAME(const wxString& a); \
1352 wxString base_##CBNAME(const wxString& a)
1354 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1355 wxString CLASS::CBNAME(const wxString& a) { \
1358 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1359 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1361 PyObject* s = wx2PyString(a); \
1362 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1365 rval = Py2wxString(ro); \
1370 rval = PCLASS::CBNAME(a); \
1371 wxPyEndBlockThreads(blocked); \
1375 //---------------------------------------------------------------------------
1377 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1378 wxString CBNAME(const wxString& a,int b)
1380 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1381 wxString CLASS::CBNAME(const wxString& a,int b) { \
1383 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1384 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1386 PyObject* s = wx2PyString(a); \
1387 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1390 rval = Py2wxString(ro); \
1394 wxPyEndBlockThreads(blocked); \
1398 //---------------------------------------------------------------------------
1400 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1401 bool CBNAME(const wxString& a, const wxString& b); \
1402 bool base_##CBNAME(const wxString& a, const wxString& b)
1404 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1405 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1408 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1409 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1410 PyObject* s1 = wx2PyString(a); \
1411 PyObject* s2 = wx2PyString(b); \
1412 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1416 wxPyEndBlockThreads(blocked); \
1418 rval = PCLASS::CBNAME(a, b); \
1421 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1422 return PCLASS::CBNAME(a, b); \
1425 //---------------------------------------------------------------------------
1427 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1428 wxString CBNAME(); \
1429 wxString base_##CBNAME()
1431 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1432 wxString CLASS::CBNAME() { \
1435 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1436 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1438 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1440 rval = Py2wxString(ro); \
1444 wxPyEndBlockThreads(blocked); \
1446 rval = PCLASS::CBNAME(); \
1449 wxString CLASS::base_##CBNAME() { \
1450 return PCLASS::CBNAME(); \
1453 //---------------------------------------------------------------------------
1455 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1456 wxString CBNAME() const; \
1457 wxString base_##CBNAME() const;
1459 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1460 wxString CLASS::CBNAME() const { \
1463 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1464 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1466 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1468 rval = Py2wxString(ro); \
1472 wxPyEndBlockThreads(blocked); \
1474 rval = PCLASS::CBNAME(); \
1477 wxString CLASS::base_##CBNAME() const { \
1478 return PCLASS::CBNAME(); \
1481 //---------------------------------------------------------------------------
1483 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1486 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1487 wxString CLASS::CBNAME() { \
1489 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1490 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1492 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1494 rval = Py2wxString(ro); \
1498 wxPyEndBlockThreads(blocked); \
1502 //---------------------------------------------------------------------------
1504 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1505 wxString CBNAME() const;
1507 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1508 wxString CLASS::CBNAME() const { \
1510 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1511 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1513 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1515 rval = Py2wxString(ro); \
1519 wxPyEndBlockThreads(blocked); \
1523 //---------------------------------------------------------------------------
1525 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1526 bool CBNAME(const wxHtmlTag& a)
1529 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1530 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1532 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1533 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1534 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1535 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1538 wxPyEndBlockThreads(blocked); \
1542 //---------------------------------------------------------------------------
1544 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1545 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1546 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1548 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1549 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1551 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1552 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1553 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1554 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1557 wxPyEndBlockThreads(blocked); \
1559 PCLASS::CBNAME(cell, x, y); \
1561 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1562 PCLASS::CBNAME(cell, x, y); \
1565 //---------------------------------------------------------------------------
1567 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1568 void CBNAME(const wxColour& c); \
1569 void base_##CBNAME(const wxColour& c)
1571 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1572 void CLASS::CBNAME(const wxColour& c) { \
1574 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1575 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1576 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1577 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1580 wxPyEndBlockThreads(blocked); \
1582 PCLASS::CBNAME(c); \
1584 void CLASS::base_##CBNAME(const wxColour& c) { \
1585 PCLASS::CBNAME(c); \
1588 //---------------------------------------------------------------------------
1590 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1591 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1592 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1594 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1595 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1597 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1598 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1599 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1600 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1601 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1605 wxPyEndBlockThreads(blocked); \
1607 PCLASS::CBNAME(cell, x, y, e); \
1609 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1610 PCLASS::CBNAME(cell, x, y, e); \
1615 //---------------------------------------------------------------------------
1617 #define DEC_PYCALLBACK___pure(CBNAME) \
1621 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1622 void CLASS::CBNAME() { \
1623 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1624 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1625 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1626 wxPyEndBlockThreads(blocked); \
1629 //---------------------------------------------------------------------------
1631 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1635 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1636 wxSize CLASS::CBNAME() { \
1637 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1639 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1640 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1643 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1645 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1647 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1648 PyObject* o1 = PySequence_GetItem(ro, 0); \
1649 PyObject* o2 = PySequence_GetItem(ro, 1); \
1650 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1651 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1653 PyErr_SetString(PyExc_TypeError, errmsg); \
1658 PyErr_SetString(PyExc_TypeError, errmsg); \
1663 wxPyEndBlockThreads(blocked); \
1667 //---------------------------------------------------------------------------
1669 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1670 bool CBNAME(wxWindow* a); \
1671 bool base_##CBNAME(wxWindow* a)
1674 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1675 bool CLASS::CBNAME(wxWindow* a) { \
1678 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1679 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1680 PyObject* obj = wxPyMake_wxObject(a,false); \
1681 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1684 wxPyEndBlockThreads(blocked); \
1686 rval = PCLASS::CBNAME(a); \
1689 bool CLASS::base_##CBNAME(wxWindow* a) { \
1690 return PCLASS::CBNAME(a); \
1693 //---------------------------------------------------------------------------
1695 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1696 bool CBNAME(wxWindow* a, wxDC& b); \
1697 bool base_##CBNAME(wxWindow* a, wxDC& b)
1700 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1701 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1704 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1705 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1706 PyObject* win = wxPyMake_wxObject(a,false); \
1707 PyObject* dc = wxPyMake_wxObject(&b,false); \
1708 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1712 wxPyEndBlockThreads(blocked); \
1714 rval = PCLASS::CBNAME(a, b); \
1717 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1718 return PCLASS::CBNAME(a, b); \
1721 //---------------------------------------------------------------------------
1723 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1724 void CBNAME(wxWindowBase* a); \
1725 void base_##CBNAME(wxWindowBase* a)
1728 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1729 void CLASS::CBNAME(wxWindowBase* a) { \
1731 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1732 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1733 PyObject* obj = wxPyMake_wxObject(a,false); \
1734 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1737 wxPyEndBlockThreads(blocked); \
1739 PCLASS::CBNAME(a); \
1741 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1742 PCLASS::CBNAME(a); \
1745 //---------------------------------------------------------------------------
1747 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1749 bool base_##CBNAME()
1752 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1753 bool CLASS::CBNAME() { \
1756 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1757 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1758 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1759 wxPyEndBlockThreads(blocked); \
1761 rval = PCLASS::CBNAME(); \
1764 bool CLASS::base_##CBNAME() { \
1765 return PCLASS::CBNAME(); \
1768 //---------------------------------------------------------------------------
1770 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1771 bool CBNAME() const; \
1772 bool base_##CBNAME() const
1775 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1776 bool CLASS::CBNAME() const { \
1779 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1780 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1781 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1782 wxPyEndBlockThreads(blocked); \
1784 rval = PCLASS::CBNAME(); \
1787 bool CLASS::base_##CBNAME() const { \
1788 return PCLASS::CBNAME(); \
1791 //---------------------------------------------------------------------------
1793 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1794 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1795 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1798 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1799 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1802 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1803 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1804 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1805 wxPyEndBlockThreads(blocked); \
1807 rval = PCLASS::CBNAME(a, b, c); \
1808 return (wxDragResult)rval; \
1810 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1811 return PCLASS::CBNAME(a, b, c); \
1814 //---------------------------------------------------------------------------
1816 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1817 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1819 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1820 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1821 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1823 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1825 PyObject* obj = wxPyMake_wxObject(&a,false); \
1826 PyObject* s = wx2PyString(b); \
1827 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1830 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1836 wxPyEndBlockThreads(blocked); \
1840 //---------------------------------------------------------------------------
1842 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1843 bool CBNAME(wxDragResult a); \
1844 bool base_##CBNAME(wxDragResult a)
1847 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1848 bool CLASS::CBNAME(wxDragResult a) { \
1851 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1852 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1853 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1854 wxPyEndBlockThreads(blocked); \
1856 rval = PCLASS::CBNAME(a); \
1859 bool CLASS::base_##CBNAME(wxDragResult a) { \
1860 return PCLASS::CBNAME(a); \
1863 //---------------------------------------------------------------------------
1865 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1866 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1869 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1870 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1871 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1873 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1874 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1875 wxPyEndBlockThreads(blocked); \
1876 return (wxDragResult)rval; \
1879 //---------------------------------------------------------------------------
1881 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1882 bool CBNAME(int a, int b, const wxString& c)
1884 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1885 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1887 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1888 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1889 PyObject* s = wx2PyString(c); \
1890 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1893 wxPyEndBlockThreads(blocked); \
1897 //---------------------------------------------------------------------------
1899 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1901 size_t base_##CBNAME()
1904 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1905 size_t CLASS::CBNAME() { \
1908 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1909 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1910 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1911 wxPyEndBlockThreads(blocked); \
1913 rval = PCLASS::CBNAME(); \
1916 size_t CLASS::base_##CBNAME() { \
1917 return PCLASS::CBNAME(); \
1920 //---------------------------------------------------------------------------
1922 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1923 size_t CBNAME() const; \
1924 size_t base_##CBNAME() const
1927 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1928 size_t CLASS::CBNAME() const { \
1931 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1932 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1933 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1934 wxPyEndBlockThreads(blocked); \
1936 rval = PCLASS::CBNAME(); \
1939 size_t CLASS::base_##CBNAME() const { \
1940 return PCLASS::CBNAME(); \
1943 //---------------------------------------------------------------------------
1945 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1946 wxDataFormat CBNAME(size_t a); \
1947 wxDataFormat base_##CBNAME(size_t a)
1950 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1951 wxDataFormat CLASS::CBNAME(size_t a) { \
1952 wxDataFormat rval=0; \
1954 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1955 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1957 wxDataFormat* ptr; \
1958 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1960 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1965 wxPyEndBlockThreads(blocked); \
1967 rval = PCLASS::CBNAME(a); \
1970 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1971 return PCLASS::CBNAME(a); \
1974 //---------------------------------------------------------------------------
1976 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1977 void CBNAME(const Type& a); \
1978 void base_##CBNAME(const Type& a)
1981 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1982 void CLASS::CBNAME(const Type& a) { \
1984 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1985 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1986 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1987 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1990 wxPyEndBlockThreads(blocked); \
1992 PCLASS::CBNAME(a); \
1994 void CLASS::base_##CBNAME(const Type& a) { \
1995 PCLASS::CBNAME(a); \
1999 //---------------------------------------------------------------------------
2001 #define DEC_PYCALLBACK__any(CBNAME, Type) \
2002 void CBNAME(Type& a); \
2003 void base_##CBNAME(Type& a)
2006 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2007 void CLASS::CBNAME(Type& a) { \
2009 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2010 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2011 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2012 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2015 wxPyEndBlockThreads(blocked); \
2017 PCLASS::CBNAME(a); \
2019 void CLASS::base_##CBNAME(Type& a) { \
2020 PCLASS::CBNAME(a); \
2023 //---------------------------------------------------------------------------
2025 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2026 bool CBNAME(Type& a); \
2027 bool base_##CBNAME(Type& a)
2030 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2031 bool CLASS::CBNAME(Type& a) { \
2034 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2035 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2036 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2037 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2040 wxPyEndBlockThreads(blocked); \
2042 rv = PCLASS::CBNAME(a); \
2045 bool CLASS::base_##CBNAME(Type& a) { \
2046 return PCLASS::CBNAME(a); \
2049 //---------------------------------------------------------------------------
2051 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2052 bool CBNAME(Type& a)
2055 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2056 bool CLASS::CBNAME(Type& a) { \
2058 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2059 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2060 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2061 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2064 wxPyEndBlockThreads(blocked); \
2068 //---------------------------------------------------------------------------
2070 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2071 wxString CBNAME(long a, long b) const; \
2072 wxString base_##CBNAME(long a, long b) const
2074 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2075 wxString CLASS::CBNAME(long a, long b) const { \
2078 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2079 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2081 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2083 rval = Py2wxString(ro); \
2087 wxPyEndBlockThreads(blocked); \
2089 rval = PCLASS::CBNAME(a,b); \
2092 wxString CLASS::base_##CBNAME(long a, long b) const { \
2093 return PCLASS::CBNAME(a,b); \
2096 //---------------------------------------------------------------------------
2098 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2099 int CBNAME(long a) const; \
2100 int base_##CBNAME(long a) const
2103 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2104 int CLASS::CBNAME(long a) const { \
2107 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2108 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2110 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2112 rval = PyInt_AsLong(ro); \
2116 wxPyEndBlockThreads(blocked); \
2118 rval = PCLASS::CBNAME(a); \
2121 int CLASS::base_##CBNAME(long a) const { \
2122 return PCLASS::CBNAME(a); \
2128 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2129 int CBNAME(long a) const;
2132 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2133 int CLASS::CBNAME(long a) const { \
2134 int rval=-1; /* this rval is important for OnGetItemImage */ \
2136 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2137 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2139 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2141 rval = PyInt_AsLong(ro); \
2145 wxPyEndBlockThreads(blocked); \
2150 //---------------------------------------------------------------------------
2152 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2153 wxListItemAttr* CBNAME(long a) const; \
2154 wxListItemAttr* base_##CBNAME(long a) const
2157 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2158 wxListItemAttr *CLASS::CBNAME(long a) const { \
2159 wxListItemAttr *rval = NULL; \
2161 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2162 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2164 wxListItemAttr* ptr; \
2165 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2167 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2172 wxPyEndBlockThreads(blocked); \
2174 rval = PCLASS::CBNAME(a); \
2177 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2178 return PCLASS::CBNAME(a); \
2181 //---------------------------------------------------------------------------
2183 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2184 bool CBNAME(wxMouseEvent& e); \
2185 bool base_##CBNAME(wxMouseEvent& e)
2187 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2188 bool CLASS::CBNAME(wxMouseEvent& e) { \
2191 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2192 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2194 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2195 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2197 rval = PyInt_AsLong(ro); \
2202 wxPyEndBlockThreads(blocked); \
2204 return PCLASS::CBNAME(e); \
2207 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2208 return PCLASS::CBNAME(e); \
2212 //---------------------------------------------------------------------------
2214 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2215 wxWizardPage* CBNAME() const
2217 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2218 wxWizardPage* CLASS::CBNAME() const { \
2219 wxWizardPage* rv = NULL; \
2220 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2221 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2223 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2225 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2229 wxPyEndBlockThreads(blocked); \
2233 //---------------------------------------------------------------------------
2235 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2236 wxBitmap CBNAME() const
2238 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2239 wxBitmap CLASS::CBNAME() const { \
2241 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2242 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2245 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2247 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2252 wxPyEndBlockThreads(blocked); \
2256 //---------------------------------------------------------------------------
2258 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2261 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2262 wxObject* CLASS::CBNAME() { \
2263 wxObject* rv = NULL; \
2264 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2265 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2267 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2269 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2273 wxPyEndBlockThreads(blocked); \
2277 //---------------------------------------------------------------------------
2279 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2280 wxObject* CBNAME(const wxString& a)
2282 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2283 wxObject* CLASS::CBNAME(const wxString& a) { \
2284 wxObject* rv = NULL; \
2285 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2286 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2287 PyObject* so = wx2PyString(a); \
2289 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2291 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2296 wxPyEndBlockThreads(blocked); \
2300 //---------------------------------------------------------------------------
2302 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2303 bool CBNAME(wxXmlNode* a)
2306 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2307 bool CLASS::CBNAME(wxXmlNode* a) { \
2309 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2310 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2311 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2312 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2315 wxPyEndBlockThreads(blocked); \
2319 //---------------------------------------------------------------------------
2321 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2322 wxCoord CBNAME(size_t a) const
2325 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2326 wxCoord CLASS::CBNAME(size_t a) const { \
2329 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2330 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2331 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2333 wxPyEndBlockThreads(blocked); \
2337 //---------------------------------------------------------------------------
2339 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2340 void CBNAME(size_t a, size_t b) const; \
2341 void base_##CBNAME(size_t a, size_t b) const
2344 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2345 void CLASS::CBNAME(size_t a, size_t b) const { \
2347 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2348 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2349 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2350 wxPyEndBlockThreads(blocked); \
2352 PCLASS::CBNAME(a,b); \
2354 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2355 PCLASS::CBNAME(a,b); \
2358 //---------------------------------------------------------------------------
2360 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2361 wxCoord CBNAME() const; \
2362 wxCoord base_##CBNAME() const
2365 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2366 wxCoord CLASS::CBNAME() const { \
2369 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2370 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2371 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2372 wxPyEndBlockThreads(blocked); \
2374 rval = PCLASS::CBNAME(); \
2377 wxCoord CLASS::base_##CBNAME() const { \
2378 return PCLASS::CBNAME(); \
2381 //---------------------------------------------------------------------------
2383 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2384 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2387 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2388 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2390 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2391 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2392 PyObject* obj = wxPyMake_wxObject(&a,false); \
2393 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2394 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2397 wxPyEndBlockThreads(blocked); \
2400 //---------------------------------------------------------------------------
2402 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2403 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2404 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2407 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2408 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2410 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2411 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2412 PyObject* obj = wxPyMake_wxObject(&a,false); \
2413 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2414 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2417 wxPyEndBlockThreads(blocked); \
2419 PCLASS::CBNAME(a,b,c); \
2421 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2422 PCLASS::CBNAME(a,b,c); \
2425 //---------------------------------------------------------------------------
2428 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2429 wxString CBNAME(size_t a) const; \
2430 wxString base_##CBNAME(size_t a) const
2432 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2433 wxString CLASS::CBNAME(size_t a) const { \
2436 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2437 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2439 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2441 rval = Py2wxString(ro); \
2445 wxPyEndBlockThreads(blocked); \
2447 rval = PCLASS::CBNAME(a); \
2450 wxString CLASS::base_##CBNAME(size_t a) const { \
2451 return PCLASS::CBNAME(a); \
2454 //---------------------------------------------------------------------------
2456 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2457 wxString CBNAME(size_t a) const
2459 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2460 wxString CLASS::CBNAME(size_t a) const { \
2463 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2464 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2466 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2468 rval = Py2wxString(ro); \
2472 wxPyEndBlockThreads(blocked); \
2476 //---------------------------------------------------------------------------
2478 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2479 wxVisualAttributes CBNAME() const; \
2480 wxVisualAttributes base_##CBNAME()
2483 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2484 wxVisualAttributes CLASS::CBNAME() const { \
2485 wxVisualAttributes rval; \
2487 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2488 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2490 wxVisualAttributes* ptr; \
2491 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2493 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2498 wxPyEndBlockThreads(blocked); \
2500 rval = PCLASS::CBNAME(); \
2503 wxVisualAttributes CLASS::base_##CBNAME() { \
2504 return PCLASS::CBNAME(); \
2507 //---------------------------------------------------------------------------