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 // A wxImageHandler that can be derived from in Python.
504 class wxPyImageHandler
: public wxImageHandler
{
508 // used for interning method names as PyStrings
509 static PyObject
* m_DoCanRead_Name
;
510 static PyObject
* m_GetImageCount_Name
;
511 static PyObject
* m_LoadFile_Name
;
512 static PyObject
* m_SaveFile_Name
;
514 // converstion helpers
515 PyObject
* py_InputStream(wxInputStream
* stream
);
516 PyObject
* py_Image(wxImage
* image
);
517 PyObject
* py_OutputStream(wxOutputStream
* stream
);
522 void _SetSelf(PyObject
*self
);
524 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
525 bool verbose
=true, int index
=-1 );
526 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
528 virtual int GetImageCount(wxInputStream
& stream
);
529 virtual bool DoCanRead(wxInputStream
&stream
);
533 //---------------------------------------------------------------------------
534 // This class holds an instance of a Python Shadow Class object and assists
535 // with looking up and invoking Python callback methods from C++ virtual
536 // method redirections. For all classes which have virtuals which should be
537 // overridable in wxPython, a new subclass is created that contains a
538 // wxPyCallbackHelper.
541 class wxPyCallbackHelper
{
543 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
545 wxPyCallbackHelper() {
552 ~wxPyCallbackHelper() {
553 #ifdef wxPyUSE_EXPORTED_API
554 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
556 wxPyCBH_delete(this);
560 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
561 bool findCallback(const char* name
) const;
562 int callCallback(PyObject
* argTuple
) const;
563 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
564 PyObject
* GetLastFound() const { return m_lastFound
; }
569 PyObject
* m_lastFound
;
572 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
576 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
577 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
578 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
579 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
580 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
585 //---------------------------------------------------------------------------
587 // This is used in C++ classes that need to be able to make callback to
588 // "overloaded" python methods
591 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
592 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
594 private: wxPyCallbackHelper m_myInst
597 //---------------------------------------------------------------------------
598 // The wxPythonApp class
601 wxPYAPP_ASSERT_SUPPRESS
= 1,
602 wxPYAPP_ASSERT_EXCEPTION
= 2,
603 wxPYAPP_ASSERT_DIALOG
= 4,
604 wxPYAPP_ASSERT_LOG
= 8
607 class wxPyApp
: public wxApp
609 DECLARE_ABSTRACT_CLASS(wxPyApp
)
617 int GetAssertMode() { return m_assertMode
; }
618 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
620 virtual bool OnInitGui();
621 virtual int OnExit();
623 virtual void OnAssert(const wxChar
*file
,
628 // virtual int FilterEvent(wxEvent& event); // This one too????
630 // For catching Apple Events
631 virtual void MacOpenFile(const wxString
&fileName
);
632 virtual void MacPrintFile(const wxString
&fileName
);
633 virtual void MacNewFile();
634 virtual void MacReopenApp();
636 static bool GetMacSupportPCMenuShortcuts();
637 static long GetMacAboutMenuItemId();
638 static long GetMacPreferencesMenuItemId();
639 static long GetMacExitMenuItemId();
640 static wxString
GetMacHelpMenuTitleName();
642 static void SetMacSupportPCMenuShortcuts(bool val
);
643 static void SetMacAboutMenuItemId(long val
);
644 static void SetMacPreferencesMenuItemId(long val
);
645 static void SetMacExitMenuItemId(long val
);
646 static void SetMacHelpMenuTitleName(const wxString
& val
);
649 void _BootstrapApp();
651 // implementation only
652 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
656 bool m_startupComplete
;
659 extern wxPyApp
*wxPythonApp
;
662 //----------------------------------------------------------------------
663 // These macros are used to implement the virtual methods that should
664 // redirect to a Python method if one exists. The names designate the
665 // return type, if any, as well as any parameter types.
666 //---------------------------------------------------------------------------
668 #define DEC_PYCALLBACK__(CBNAME) \
673 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
674 void CLASS::CBNAME() { \
676 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
677 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
678 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
679 wxPyEndBlockThreads(blocked); \
683 void CLASS::base_##CBNAME() { \
687 //---------------------------------------------------------------------------
689 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
690 bool CBNAME(int a, int b); \
691 bool base_##CBNAME(int a, int b)
694 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
695 bool CLASS::CBNAME(int a, int b) { \
696 bool rval=false, found; \
697 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
698 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
699 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
700 wxPyEndBlockThreads(blocked); \
702 rval = PCLASS::CBNAME(a,b); \
705 bool CLASS::base_##CBNAME(int a, int b) { \
706 return PCLASS::CBNAME(a,b); \
709 //---------------------------------------------------------------------------
711 #define DEC_PYCALLBACK_VOID_(CBNAME) \
716 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
717 void CLASS::CBNAME() { \
719 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
720 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
721 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
722 wxPyEndBlockThreads(blocked); \
726 void CLASS::base_##CBNAME() { \
730 //---------------------------------------------------------------------------
732 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
733 void CBNAME(int a, int b); \
734 void base_##CBNAME(int a, int b)
737 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
738 void CLASS::CBNAME(int a, int b) { \
740 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
741 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
742 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
743 wxPyEndBlockThreads(blocked); \
745 PCLASS::CBNAME(a,b); \
747 void CLASS::base_##CBNAME(int a, int b) { \
748 PCLASS::CBNAME(a,b); \
751 //---------------------------------------------------------------------------
753 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
754 void CBNAME(int a); \
755 void base_##CBNAME(int a)
758 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
759 void CLASS::CBNAME(int a) { \
761 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
762 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
763 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
764 wxPyEndBlockThreads(blocked); \
768 void CLASS::base_##CBNAME(int a) { \
772 //---------------------------------------------------------------------------
774 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
775 void CBNAME(int a, int b, int c, int d); \
776 void base_##CBNAME(int a, int b, int c, int d)
779 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
780 void CLASS::CBNAME(int a, int b, int c, int d) { \
782 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
783 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
784 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
785 wxPyEndBlockThreads(blocked); \
787 PCLASS::CBNAME(a,b,c,d); \
789 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
790 PCLASS::CBNAME(a,b,c,d); \
793 //---------------------------------------------------------------------------
794 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
795 void CBNAME(int a, int b, int c, int d, int e); \
796 void base_##CBNAME(int a, int b, int c, int d, int e)
799 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
800 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
802 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
803 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
804 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
805 wxPyEndBlockThreads(blocked); \
807 PCLASS::CBNAME(a,b,c,d,e); \
809 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
810 PCLASS::CBNAME(a,b,c,d,e); \
813 //---------------------------------------------------------------------------
815 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
816 void CBNAME(int* a, int* b) const; \
817 void base_##CBNAME(int* a, int* b) const
820 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
821 void CLASS::CBNAME(int* a, int* b) const { \
822 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
824 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
825 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
827 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
829 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
830 PyObject* o1 = PySequence_GetItem(ro, 0); \
831 PyObject* o2 = PySequence_GetItem(ro, 1); \
832 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
833 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
836 PyErr_SetString(PyExc_TypeError, errmsg); \
841 PyErr_SetString(PyExc_TypeError, errmsg); \
846 wxPyEndBlockThreads(blocked); \
848 PCLASS::CBNAME(a,b); \
850 void CLASS::base_##CBNAME(int* a, int* b) const { \
851 PCLASS::CBNAME(a,b); \
855 //---------------------------------------------------------------------------
857 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
858 wxSize CBNAME() const; \
859 wxSize base_##CBNAME() const
862 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
863 wxSize CLASS::CBNAME() const { \
864 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
865 bool found; wxSize rval(0,0); \
866 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
869 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
871 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
872 PyObject* o1 = PySequence_GetItem(ro, 0); \
873 PyObject* o2 = PySequence_GetItem(ro, 1); \
874 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
875 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
878 PyErr_SetString(PyExc_TypeError, errmsg); \
883 PyErr_SetString(PyExc_TypeError, errmsg); \
888 wxPyEndBlockThreads(blocked); \
890 return PCLASS::CBNAME(); \
894 wxSize CLASS::base_##CBNAME() const { \
895 return PCLASS::CBNAME(); \
899 //---------------------------------------------------------------------------
901 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
902 bool CBNAME(bool a); \
903 bool base_##CBNAME(bool a)
906 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
907 bool CLASS::CBNAME(bool a) { \
908 bool rval=false, found; \
909 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
910 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
911 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
912 wxPyEndBlockThreads(blocked); \
914 rval = PCLASS::CBNAME(a); \
917 bool CLASS::base_##CBNAME(bool a) { \
918 return PCLASS::CBNAME(a); \
921 //---------------------------------------------------------------------------
923 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
924 bool CBNAME(int a); \
925 bool base_##CBNAME(int a)
928 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
929 bool CLASS::CBNAME(int a) { \
930 bool rval=false, found; \
931 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
932 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
933 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
934 wxPyEndBlockThreads(blocked); \
936 rval = PCLASS::CBNAME(a); \
939 bool CLASS::base_##CBNAME(int a) { \
940 return PCLASS::CBNAME(a); \
943 //---------------------------------------------------------------------------
945 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
949 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
950 bool CLASS::CBNAME(int a) { \
952 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
953 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
954 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
956 wxPyEndBlockThreads(blocked); \
961 //---------------------------------------------------------------------------
963 #define DEC_PYCALLBACK__DC(CBNAME) \
964 void CBNAME(wxDC& a); \
965 void base_##CBNAME(wxDC& a)
968 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
969 void CLASS::CBNAME(wxDC& a) { \
971 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
972 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
973 PyObject* obj = wxPyMake_wxObject(&a,false); \
974 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
977 wxPyEndBlockThreads(blocked); \
981 void CLASS::base_##CBNAME(wxDC& a) { \
987 //---------------------------------------------------------------------------
989 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
990 void CBNAME(wxDC& a, bool b); \
991 void base_##CBNAME(wxDC& a, bool b)
994 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
995 void CLASS::CBNAME(wxDC& a, bool b) { \
997 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
998 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
999 PyObject* obj = wxPyMake_wxObject(&a,false); \
1000 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1003 wxPyEndBlockThreads(blocked); \
1005 PCLASS::CBNAME(a, b); \
1007 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1008 PCLASS::CBNAME(a, b); \
1011 //---------------------------------------------------------------------------
1013 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1014 void CBNAME(wxDC& a, bool b); \
1015 void base_##CBNAME(wxDC& a, bool b)
1018 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1019 void CLASS::CBNAME(wxDC& a, bool b) { \
1021 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1022 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1023 PyObject* obj = wxPyMake_wxObject(&a,false); \
1024 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1027 wxPyEndBlockThreads(blocked); \
1029 PCLASS::CBNAME(a, b); \
1031 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1032 PCLASS::CBNAME(a, b); \
1035 //---------------------------------------------------------------------------
1037 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1038 void CBNAME(double a, double b); \
1039 void base_##CBNAME(double a, double b)
1042 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1043 void CLASS::CBNAME(double a, double b) { \
1045 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1046 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1047 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1048 wxPyEndBlockThreads(blocked); \
1050 PCLASS::CBNAME(a, b); \
1052 void CLASS::base_##CBNAME(double a, double b) { \
1053 PCLASS::CBNAME(a, b); \
1056 //---------------------------------------------------------------------------
1058 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1059 void CBNAME(double a, double b, int c, int d); \
1060 void base_##CBNAME(double a, double b, int c, int d)
1063 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1064 void CLASS::CBNAME(double a, double b, int c, int d) { \
1066 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1067 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1068 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1070 wxPyEndBlockThreads(blocked); \
1072 PCLASS::CBNAME(a, b, c, d); \
1074 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1075 PCLASS::CBNAME(a, b, c, d); \
1078 //---------------------------------------------------------------------------
1080 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1081 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1082 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1085 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1086 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1088 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1089 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1090 PyObject* obj = wxPyMake_wxObject(&a,false); \
1091 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1094 wxPyEndBlockThreads(blocked); \
1096 PCLASS::CBNAME(a, b, c, d, e, f); \
1098 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1099 PCLASS::CBNAME(a, b, c, d, e, f); \
1102 //---------------------------------------------------------------------------
1104 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1105 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1106 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1109 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1110 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1112 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1114 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1115 PyObject* obj = wxPyMake_wxObject(&a,false); \
1116 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1119 wxPyEndBlockThreads(blocked); \
1121 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1124 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1125 return PCLASS::CBNAME(a, b, c, d, e, f); \
1128 //---------------------------------------------------------------------------
1130 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1131 void CBNAME(bool a, double b, double c, int d, int e); \
1132 void base_##CBNAME(bool a, double b, double c, int d, int e)
1135 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1136 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1138 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1139 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1140 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1142 wxPyEndBlockThreads(blocked); \
1144 PCLASS::CBNAME(a, b, c, d, e); \
1146 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1147 PCLASS::CBNAME(a, b, c, d, e); \
1150 //---------------------------------------------------------------------------
1152 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1153 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1154 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1157 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1158 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1160 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1161 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1162 PyObject* obj = wxPyMake_wxObject(&a,false); \
1163 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1166 wxPyEndBlockThreads(blocked); \
1168 PCLASS::CBNAME(a, b, c, d, e); \
1170 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1171 PCLASS::CBNAME(a, b, c, d, e); \
1174 //---------------------------------------------------------------------------
1176 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1177 void CBNAME(wxDC& a, bool b); \
1178 void base_##CBNAME(wxDC& a, bool b)
1181 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1182 void CLASS::CBNAME(wxDC& a, bool b) { \
1184 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1185 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1186 PyObject* obj = wxPyMake_wxObject(&a,false); \
1187 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1190 wxPyEndBlockThreads(blocked); \
1192 PCLASS::CBNAME(a, b); \
1194 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1195 PCLASS::CBNAME(a, b); \
1198 //---------------------------------------------------------------------------
1200 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1201 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1202 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1205 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1206 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1209 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1210 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1211 PyObject* obj = wxPyMake_wxObject(a,false); \
1212 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1215 wxPyEndBlockThreads(blocked); \
1217 PCLASS::CBNAME(a, b, c, d, e, f); \
1219 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1221 PCLASS::CBNAME(a, b, c, d, e, f); \
1224 //---------------------------------------------------------------------------
1226 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1227 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1228 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1231 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1232 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1234 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1235 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1236 PyObject* obj = wxPyMake_wxObject(a,false); \
1237 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1240 wxPyEndBlockThreads(blocked); \
1242 PCLASS::CBNAME(a, b, c, d, e); \
1244 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1246 PCLASS::CBNAME(a, b, c, d, e); \
1249 //---------------------------------------------------------------------------
1251 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1252 void CBNAME(double a, double b, int c); \
1253 void base_##CBNAME(double a, double b, int c)
1256 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1257 void CLASS::CBNAME(double a, double b, int c) { \
1259 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1260 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1261 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1262 wxPyEndBlockThreads(blocked); \
1264 PCLASS::CBNAME(a, b, c); \
1266 void CLASS::base_##CBNAME(double a, double b, int c) { \
1267 PCLASS::CBNAME(a, b, c); \
1270 //---------------------------------------------------------------------------
1272 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1273 void CBNAME(bool a, double b, double c, int d); \
1274 void base_##CBNAME(bool a, double b, double c, int d)
1277 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1278 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1280 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1281 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1282 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1283 wxPyEndBlockThreads(blocked); \
1285 PCLASS::CBNAME(a, b, c, d); \
1287 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1288 PCLASS::CBNAME(a, b, c, d); \
1291 //---------------------------------------------------------------------------
1292 //---------------------------------------------------------------------------
1294 #define DEC_PYCALLBACK__STRING(CBNAME) \
1295 void CBNAME(const wxString& a); \
1296 void base_##CBNAME(const wxString& a)
1298 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1299 void CLASS::CBNAME(const wxString& a) { \
1301 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1302 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1303 PyObject* s = wx2PyString(a); \
1304 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1307 wxPyEndBlockThreads(blocked); \
1309 PCLASS::CBNAME(a); \
1311 void CLASS::base_##CBNAME(const wxString& a) { \
1312 PCLASS::CBNAME(a); \
1315 //---------------------------------------------------------------------------
1317 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1318 bool CBNAME(const wxString& a); \
1319 bool base_##CBNAME(const wxString& a)
1321 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1322 bool CLASS::CBNAME(const wxString& a) { \
1325 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1326 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1327 PyObject* s = wx2PyString(a); \
1328 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1331 wxPyEndBlockThreads(blocked); \
1333 rval = PCLASS::CBNAME(a); \
1336 bool CLASS::base_##CBNAME(const wxString& a) { \
1337 return PCLASS::CBNAME(a); \
1340 //---------------------------------------------------------------------------
1342 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1343 bool CBNAME(const wxString& a)
1345 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1346 bool CLASS::CBNAME(const wxString& a) { \
1348 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1349 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1350 PyObject* s = wx2PyString(a); \
1351 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1354 wxPyEndBlockThreads(blocked); \
1358 //---------------------------------------------------------------------------
1360 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1361 wxString CBNAME(const wxString& a)
1363 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1364 wxString CLASS::CBNAME(const wxString& a) { \
1366 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1367 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1369 PyObject* s = wx2PyString(a); \
1370 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1373 rval = Py2wxString(ro); \
1377 wxPyEndBlockThreads(blocked); \
1381 //---------------------------------------------------------------------------
1383 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1384 wxString CBNAME(const wxString& a); \
1385 wxString base_##CBNAME(const wxString& a)
1387 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1388 wxString CLASS::CBNAME(const wxString& a) { \
1391 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1392 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1394 PyObject* s = wx2PyString(a); \
1395 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1398 rval = Py2wxString(ro); \
1403 rval = PCLASS::CBNAME(a); \
1404 wxPyEndBlockThreads(blocked); \
1408 //---------------------------------------------------------------------------
1410 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1411 wxString CBNAME(const wxString& a,int b)
1413 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1414 wxString CLASS::CBNAME(const wxString& a,int b) { \
1416 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1417 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1419 PyObject* s = wx2PyString(a); \
1420 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1423 rval = Py2wxString(ro); \
1427 wxPyEndBlockThreads(blocked); \
1431 //---------------------------------------------------------------------------
1433 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1434 bool CBNAME(const wxString& a, const wxString& b); \
1435 bool base_##CBNAME(const wxString& a, const wxString& b)
1437 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1438 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1441 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1442 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1443 PyObject* s1 = wx2PyString(a); \
1444 PyObject* s2 = wx2PyString(b); \
1445 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1449 wxPyEndBlockThreads(blocked); \
1451 rval = PCLASS::CBNAME(a, b); \
1454 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1455 return PCLASS::CBNAME(a, b); \
1458 //---------------------------------------------------------------------------
1460 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1461 wxString CBNAME(); \
1462 wxString base_##CBNAME()
1464 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1465 wxString CLASS::CBNAME() { \
1468 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1469 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1471 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1473 rval = Py2wxString(ro); \
1477 wxPyEndBlockThreads(blocked); \
1479 rval = PCLASS::CBNAME(); \
1482 wxString CLASS::base_##CBNAME() { \
1483 return PCLASS::CBNAME(); \
1486 //---------------------------------------------------------------------------
1488 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1489 wxString CBNAME() const; \
1490 wxString base_##CBNAME() const;
1492 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1493 wxString CLASS::CBNAME() const { \
1496 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1497 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1499 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1501 rval = Py2wxString(ro); \
1505 wxPyEndBlockThreads(blocked); \
1507 rval = PCLASS::CBNAME(); \
1510 wxString CLASS::base_##CBNAME() const { \
1511 return PCLASS::CBNAME(); \
1514 //---------------------------------------------------------------------------
1516 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1519 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1520 wxString CLASS::CBNAME() { \
1522 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1523 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1525 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1527 rval = Py2wxString(ro); \
1531 wxPyEndBlockThreads(blocked); \
1535 //---------------------------------------------------------------------------
1537 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1538 wxString CBNAME() const;
1540 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1541 wxString CLASS::CBNAME() const { \
1543 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1544 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1546 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1548 rval = Py2wxString(ro); \
1552 wxPyEndBlockThreads(blocked); \
1556 //---------------------------------------------------------------------------
1558 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1559 bool CBNAME(const wxHtmlTag& a)
1562 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1563 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1565 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1566 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1567 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1568 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1571 wxPyEndBlockThreads(blocked); \
1575 //---------------------------------------------------------------------------
1577 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1578 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1579 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1581 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1582 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1584 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1585 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1586 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1587 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1590 wxPyEndBlockThreads(blocked); \
1592 PCLASS::CBNAME(cell, x, y); \
1594 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1595 PCLASS::CBNAME(cell, x, y); \
1598 //---------------------------------------------------------------------------
1600 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1601 void CBNAME(const wxColour& c); \
1602 void base_##CBNAME(const wxColour& c)
1604 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1605 void CLASS::CBNAME(const wxColour& c) { \
1607 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1608 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1609 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1610 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1613 wxPyEndBlockThreads(blocked); \
1615 PCLASS::CBNAME(c); \
1617 void CLASS::base_##CBNAME(const wxColour& c) { \
1618 PCLASS::CBNAME(c); \
1621 //---------------------------------------------------------------------------
1623 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1624 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1625 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1627 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1628 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1630 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1631 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1632 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1633 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1634 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1638 wxPyEndBlockThreads(blocked); \
1640 PCLASS::CBNAME(cell, x, y, e); \
1642 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1643 PCLASS::CBNAME(cell, x, y, e); \
1648 //---------------------------------------------------------------------------
1650 #define DEC_PYCALLBACK___pure(CBNAME) \
1654 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1655 void CLASS::CBNAME() { \
1656 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1657 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1658 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1659 wxPyEndBlockThreads(blocked); \
1662 //---------------------------------------------------------------------------
1664 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1668 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1669 wxSize CLASS::CBNAME() { \
1670 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1672 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1673 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1676 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1678 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1680 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1682 PyObject* o1 = PySequence_GetItem(ro, 0); \
1683 PyObject* o2 = PySequence_GetItem(ro, 1); \
1684 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1685 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1687 PyErr_SetString(PyExc_TypeError, errmsg); \
1692 PyErr_SetString(PyExc_TypeError, errmsg); \
1697 wxPyEndBlockThreads(blocked); \
1701 //---------------------------------------------------------------------------
1703 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1704 bool CBNAME(wxWindow* a); \
1705 bool base_##CBNAME(wxWindow* a)
1708 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1709 bool CLASS::CBNAME(wxWindow* a) { \
1712 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1713 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1714 PyObject* obj = wxPyMake_wxObject(a,false); \
1715 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1718 wxPyEndBlockThreads(blocked); \
1720 rval = PCLASS::CBNAME(a); \
1723 bool CLASS::base_##CBNAME(wxWindow* a) { \
1724 return PCLASS::CBNAME(a); \
1727 //---------------------------------------------------------------------------
1729 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1730 bool CBNAME(wxWindow* a, wxDC& b); \
1731 bool base_##CBNAME(wxWindow* a, wxDC& b)
1734 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1735 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1738 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1739 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1740 PyObject* win = wxPyMake_wxObject(a,false); \
1741 PyObject* dc = wxPyMake_wxObject(&b,false); \
1742 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1746 wxPyEndBlockThreads(blocked); \
1748 rval = PCLASS::CBNAME(a, b); \
1751 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1752 return PCLASS::CBNAME(a, b); \
1755 //---------------------------------------------------------------------------
1757 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1758 void CBNAME(wxWindowBase* a); \
1759 void base_##CBNAME(wxWindowBase* a)
1762 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1763 void CLASS::CBNAME(wxWindowBase* a) { \
1765 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1766 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1767 PyObject* obj = wxPyMake_wxObject(a,false); \
1768 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1771 wxPyEndBlockThreads(blocked); \
1773 PCLASS::CBNAME(a); \
1775 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1776 PCLASS::CBNAME(a); \
1779 //---------------------------------------------------------------------------
1781 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1783 bool base_##CBNAME()
1786 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1787 bool CLASS::CBNAME() { \
1790 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1791 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1792 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1793 wxPyEndBlockThreads(blocked); \
1795 rval = PCLASS::CBNAME(); \
1798 bool CLASS::base_##CBNAME() { \
1799 return PCLASS::CBNAME(); \
1802 //---------------------------------------------------------------------------
1804 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1805 bool CBNAME() const; \
1806 bool base_##CBNAME() const
1809 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1810 bool CLASS::CBNAME() const { \
1813 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1814 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1815 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1816 wxPyEndBlockThreads(blocked); \
1818 rval = PCLASS::CBNAME(); \
1821 bool CLASS::base_##CBNAME() const { \
1822 return PCLASS::CBNAME(); \
1825 //---------------------------------------------------------------------------
1827 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1828 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1829 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1832 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1833 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1836 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1837 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1838 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1839 wxPyEndBlockThreads(blocked); \
1841 rval = PCLASS::CBNAME(a, b, c); \
1842 return (wxDragResult)rval; \
1844 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1845 return PCLASS::CBNAME(a, b, c); \
1848 //---------------------------------------------------------------------------
1850 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1851 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1853 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1854 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1855 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1857 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1859 PyObject* obj = wxPyMake_wxObject(&a,false); \
1860 PyObject* s = wx2PyString(b); \
1861 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1864 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1870 wxPyEndBlockThreads(blocked); \
1874 //---------------------------------------------------------------------------
1876 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1877 bool CBNAME(wxDragResult a); \
1878 bool base_##CBNAME(wxDragResult a)
1881 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1882 bool CLASS::CBNAME(wxDragResult a) { \
1885 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1886 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1887 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1888 wxPyEndBlockThreads(blocked); \
1890 rval = PCLASS::CBNAME(a); \
1893 bool CLASS::base_##CBNAME(wxDragResult a) { \
1894 return PCLASS::CBNAME(a); \
1897 //---------------------------------------------------------------------------
1899 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1900 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1903 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1904 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1905 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1907 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1908 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1909 wxPyEndBlockThreads(blocked); \
1910 return (wxDragResult)rval; \
1913 //---------------------------------------------------------------------------
1915 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1916 bool CBNAME(int a, int b, const wxString& c)
1918 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1919 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1921 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1922 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1923 PyObject* s = wx2PyString(c); \
1924 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1927 wxPyEndBlockThreads(blocked); \
1931 //---------------------------------------------------------------------------
1933 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1935 size_t base_##CBNAME()
1938 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1939 size_t CLASS::CBNAME() { \
1942 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1943 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1944 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1945 wxPyEndBlockThreads(blocked); \
1947 rval = PCLASS::CBNAME(); \
1950 size_t CLASS::base_##CBNAME() { \
1951 return PCLASS::CBNAME(); \
1954 //---------------------------------------------------------------------------
1956 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1957 size_t CBNAME() const; \
1958 size_t base_##CBNAME() const
1961 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1962 size_t CLASS::CBNAME() const { \
1965 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1966 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1967 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1968 wxPyEndBlockThreads(blocked); \
1970 rval = PCLASS::CBNAME(); \
1973 size_t CLASS::base_##CBNAME() const { \
1974 return PCLASS::CBNAME(); \
1977 //---------------------------------------------------------------------------
1979 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1980 wxDataFormat CBNAME(size_t a); \
1981 wxDataFormat base_##CBNAME(size_t a)
1984 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1985 wxDataFormat CLASS::CBNAME(size_t a) { \
1986 wxDataFormat rval=0; \
1988 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1989 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1991 wxDataFormat* ptr; \
1992 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1994 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1999 wxPyEndBlockThreads(blocked); \
2001 rval = PCLASS::CBNAME(a); \
2004 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
2005 return PCLASS::CBNAME(a); \
2008 //---------------------------------------------------------------------------
2010 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
2011 void CBNAME(const Type& a); \
2012 void base_##CBNAME(const Type& a)
2015 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
2016 void CLASS::CBNAME(const Type& a) { \
2018 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2019 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2020 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2021 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2024 wxPyEndBlockThreads(blocked); \
2026 PCLASS::CBNAME(a); \
2028 void CLASS::base_##CBNAME(const Type& a) { \
2029 PCLASS::CBNAME(a); \
2033 //---------------------------------------------------------------------------
2035 #define DEC_PYCALLBACK__any(CBNAME, Type) \
2036 void CBNAME(Type& a); \
2037 void base_##CBNAME(Type& a)
2040 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2041 void CLASS::CBNAME(Type& a) { \
2043 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2044 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2045 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2046 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2049 wxPyEndBlockThreads(blocked); \
2051 PCLASS::CBNAME(a); \
2053 void CLASS::base_##CBNAME(Type& a) { \
2054 PCLASS::CBNAME(a); \
2057 //---------------------------------------------------------------------------
2059 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2060 bool CBNAME(Type& a); \
2061 bool base_##CBNAME(Type& a)
2064 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2065 bool CLASS::CBNAME(Type& a) { \
2068 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2069 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2070 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2071 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2074 wxPyEndBlockThreads(blocked); \
2076 rv = PCLASS::CBNAME(a); \
2079 bool CLASS::base_##CBNAME(Type& a) { \
2080 return PCLASS::CBNAME(a); \
2083 //---------------------------------------------------------------------------
2085 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2086 bool CBNAME(Type& a)
2089 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2090 bool CLASS::CBNAME(Type& a) { \
2092 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2093 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2094 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2095 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2098 wxPyEndBlockThreads(blocked); \
2102 //---------------------------------------------------------------------------
2104 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2105 wxString CBNAME(long a, long b) const; \
2106 wxString base_##CBNAME(long a, long b) const
2108 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2109 wxString CLASS::CBNAME(long a, long b) const { \
2112 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2113 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2115 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2117 rval = Py2wxString(ro); \
2121 wxPyEndBlockThreads(blocked); \
2123 rval = PCLASS::CBNAME(a,b); \
2126 wxString CLASS::base_##CBNAME(long a, long b) const { \
2127 return PCLASS::CBNAME(a,b); \
2130 //---------------------------------------------------------------------------
2132 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2133 int CBNAME(long a) const; \
2134 int base_##CBNAME(long a) const
2137 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2138 int CLASS::CBNAME(long a) const { \
2141 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2142 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2144 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2146 rval = PyInt_AsLong(ro); \
2150 wxPyEndBlockThreads(blocked); \
2152 rval = PCLASS::CBNAME(a); \
2155 int CLASS::base_##CBNAME(long a) const { \
2156 return PCLASS::CBNAME(a); \
2162 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2163 int CBNAME(long a) const;
2166 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2167 int CLASS::CBNAME(long a) const { \
2168 int rval=-1; /* this rval is important for OnGetItemImage */ \
2170 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2171 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2173 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2175 rval = PyInt_AsLong(ro); \
2179 wxPyEndBlockThreads(blocked); \
2184 //---------------------------------------------------------------------------
2186 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2187 wxListItemAttr* CBNAME(long a) const; \
2188 wxListItemAttr* base_##CBNAME(long a) const
2191 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2192 wxListItemAttr *CLASS::CBNAME(long a) const { \
2193 wxListItemAttr *rval = NULL; \
2195 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2196 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2198 wxListItemAttr* ptr; \
2199 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2201 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2206 wxPyEndBlockThreads(blocked); \
2208 rval = PCLASS::CBNAME(a); \
2211 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2212 return PCLASS::CBNAME(a); \
2215 //---------------------------------------------------------------------------
2217 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2218 bool CBNAME(wxMouseEvent& e); \
2219 bool base_##CBNAME(wxMouseEvent& e)
2221 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2222 bool CLASS::CBNAME(wxMouseEvent& e) { \
2225 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2226 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2228 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2229 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2231 rval = PyInt_AsLong(ro); \
2236 wxPyEndBlockThreads(blocked); \
2238 return PCLASS::CBNAME(e); \
2241 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2242 return PCLASS::CBNAME(e); \
2246 //---------------------------------------------------------------------------
2248 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2249 wxWizardPage* CBNAME() const
2251 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2252 wxWizardPage* CLASS::CBNAME() const { \
2253 wxWizardPage* rv = NULL; \
2254 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2255 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2257 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2259 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2263 wxPyEndBlockThreads(blocked); \
2267 //---------------------------------------------------------------------------
2269 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2270 wxBitmap CBNAME() const
2272 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2273 wxBitmap CLASS::CBNAME() const { \
2275 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2276 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2279 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2281 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2286 wxPyEndBlockThreads(blocked); \
2290 //---------------------------------------------------------------------------
2292 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2295 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2296 wxObject* CLASS::CBNAME() { \
2297 wxObject* rv = NULL; \
2298 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2299 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2301 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2303 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2307 wxPyEndBlockThreads(blocked); \
2311 //---------------------------------------------------------------------------
2313 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2314 wxObject* CBNAME(const wxString& a)
2316 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2317 wxObject* CLASS::CBNAME(const wxString& a) { \
2318 wxObject* rv = NULL; \
2319 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2320 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2321 PyObject* so = wx2PyString(a); \
2323 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2325 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2330 wxPyEndBlockThreads(blocked); \
2334 //---------------------------------------------------------------------------
2336 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2337 bool CBNAME(wxXmlNode* a)
2340 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2341 bool CLASS::CBNAME(wxXmlNode* a) { \
2343 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2344 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2345 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2346 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2349 wxPyEndBlockThreads(blocked); \
2353 //---------------------------------------------------------------------------
2355 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2356 wxCoord CBNAME(size_t a) const
2359 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2360 wxCoord CLASS::CBNAME(size_t a) const { \
2363 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2364 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2365 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2367 wxPyEndBlockThreads(blocked); \
2371 //---------------------------------------------------------------------------
2373 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2374 void CBNAME(size_t a, size_t b) const; \
2375 void base_##CBNAME(size_t a, size_t b) const
2378 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2379 void CLASS::CBNAME(size_t a, size_t b) const { \
2381 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2382 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2383 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2384 wxPyEndBlockThreads(blocked); \
2386 PCLASS::CBNAME(a,b); \
2388 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2389 PCLASS::CBNAME(a,b); \
2392 //---------------------------------------------------------------------------
2394 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2395 wxCoord CBNAME() const; \
2396 wxCoord base_##CBNAME() const
2399 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2400 wxCoord CLASS::CBNAME() const { \
2403 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2404 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2405 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2406 wxPyEndBlockThreads(blocked); \
2408 rval = PCLASS::CBNAME(); \
2411 wxCoord CLASS::base_##CBNAME() const { \
2412 return PCLASS::CBNAME(); \
2415 //---------------------------------------------------------------------------
2417 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2418 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2421 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2422 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2424 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2425 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2426 PyObject* obj = wxPyMake_wxObject(&a,false); \
2427 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2428 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2431 wxPyEndBlockThreads(blocked); \
2434 //---------------------------------------------------------------------------
2436 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2437 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2438 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2441 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2442 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2444 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2445 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2446 PyObject* obj = wxPyMake_wxObject(&a,false); \
2447 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2448 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2451 wxPyEndBlockThreads(blocked); \
2453 PCLASS::CBNAME(a,b,c); \
2455 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2456 PCLASS::CBNAME(a,b,c); \
2459 //---------------------------------------------------------------------------
2462 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2463 wxString CBNAME(size_t a) const; \
2464 wxString base_##CBNAME(size_t a) const
2466 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2467 wxString CLASS::CBNAME(size_t a) const { \
2470 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2471 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2473 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2475 rval = Py2wxString(ro); \
2479 wxPyEndBlockThreads(blocked); \
2481 rval = PCLASS::CBNAME(a); \
2484 wxString CLASS::base_##CBNAME(size_t a) const { \
2485 return PCLASS::CBNAME(a); \
2488 //---------------------------------------------------------------------------
2490 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2491 wxString CBNAME(size_t a) const
2493 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2494 wxString CLASS::CBNAME(size_t a) const { \
2497 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2498 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2500 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2502 rval = Py2wxString(ro); \
2506 wxPyEndBlockThreads(blocked); \
2510 //---------------------------------------------------------------------------
2512 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2513 wxVisualAttributes CBNAME() const; \
2514 wxVisualAttributes base_##CBNAME()
2517 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2518 wxVisualAttributes CLASS::CBNAME() const { \
2519 wxVisualAttributes rval; \
2521 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2522 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2524 wxVisualAttributes* ptr; \
2525 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2527 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2532 wxPyEndBlockThreads(blocked); \
2534 rval = PCLASS::CBNAME(); \
2537 wxVisualAttributes CLASS::base_##CBNAME() { \
2538 return PCLASS::CBNAME(); \
2541 //---------------------------------------------------------------------------