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/toolbook.h>
68 #include <wx/tooltip.h>
69 #include <wx/treebook.h>
71 #include <wx/vscroll.h>
72 #include <wx/dateevt.h>
73 #include <wx/datectrl.h>
75 #include <wx/hyperlink.h>
76 #include <wx/pickerbase.h>
77 #include <wx/clrpicker.h>
78 #include <wx/filepicker.h>
79 #include <wx/fontpicker.h>
83 # pragma warning(disable:4800)
84 # pragma warning(disable:4190)
87 #ifdef __WXMAC__ // avoid a bug in Carbon headers
91 //---------------------------------------------------------------------------
93 #ifndef wxHAS_POWER_EVENTS
94 class wxPowerEvent
: public wxEvent
97 wxPowerEvent(wxEventType evtType
) : wxEvent(wxID_NONE
, evtType
) {}
99 bool IsVetoed() const { return false; }
100 virtual wxEvent
*Clone() const { return new wxPowerEvent(*this); }
104 //---------------------------------------------------------------------------
105 typedef unsigned char byte
;
106 typedef wxPoint2DDouble wxPoint2D
;
108 #ifndef SWIG_TYPE_TABLE
109 #define SWIG_TYPE_TABLE wxPython_type_table
113 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
115 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
119 #ifndef wxPyUSE_EXPORTED_API
121 void __wxPyPreStart(PyObject
*);
122 void __wxPyCleanup();
123 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
125 void wxSetDefaultPyEncoding(const char* encoding
);
126 const char* wxGetDefaultPyEncoding();
129 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
132 bool wxPyCheckSwigType(const wxChar
* className
);
133 PyObject
* wxPyConstructObject(void* ptr
,
134 const wxChar
* className
,
136 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
137 const wxChar
* className
);
138 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
141 PyObject
* wx2PyString(const wxString
& src
);
142 wxString
Py2wxString(PyObject
* source
);
144 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
145 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
146 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
148 PyObject
* wxPy_ConvertList(wxListBase
* list
);
149 long wxPyGetWinHandle(wxWindow
* win
);
151 void wxPy_ReinitStockObjects(int pass
);
153 bool wxPyInstance_Check(PyObject
* obj
);
154 bool wxPySwigInstance_Check(PyObject
* obj
);
157 #endif // wxPyUSE_EXPORTED_API
158 //---------------------------------------------------------------------------
160 // if we want to handle threads and Python threads are available...
161 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
162 #define WXP_WITH_THREAD
163 #else // no Python threads...
164 #undef WXP_WITH_THREAD
168 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
169 // blocking threads when calling back into Python. Using them instead of my
170 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
171 // wxPyEndBlockThreads.
173 // Unfortunatly there is a bug somewhere when using these new APIs on Python
174 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
175 // at breakpoints located in event handlers. I think that the cause may be
176 // something like the original PyThreadState for the main thread is not being
177 // restored for the callbacks, but I can't see where that could be
178 // happening... So we'll only activate this new change for Python 2.4+ :-(
180 #if PY_VERSION_HEX < 0x02040000
181 #define wxPyUSE_GIL_STATE 0
182 typedef bool wxPyBlock_t
;
184 #define wxPyUSE_GIL_STATE 1
185 typedef PyGILState_STATE wxPyBlock_t
;
189 #ifndef wxPyUSE_EXPORTED_API
191 // For Python --> C++
192 PyThreadState
* wxPyBeginAllowThreads();
193 void wxPyEndAllowThreads(PyThreadState
* state
);
195 // For C++ --> Python
196 wxPyBlock_t
wxPyBeginBlockThreads();
197 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
199 #endif // wxPyUSE_EXPORTED_API
202 // A macro that will help to execute simple statments wrapped in
203 // StartBlock/EndBlockThreads calls
204 #define wxPyBLOCK_THREADS(stmt) \
205 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
207 // Raise the NotImplementedError exception (blocking threads)
208 #define wxPyRaiseNotImplemented() \
209 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
211 // Raise any exception with a string value (blocking threads)
212 #define wxPyErr_SetString(err, str) \
213 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
216 //---------------------------------------------------------------------------
217 // These are helpers used by the typemaps
219 #ifndef wxPyUSE_EXPORTED_API
221 wxString
* wxString_in_helper(PyObject
* source
);
223 byte
* byte_LIST_helper(PyObject
* source
);
224 int* int_LIST_helper(PyObject
* source
);
225 long* long_LIST_helper(PyObject
* source
);
226 char** string_LIST_helper(PyObject
* source
);
227 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
228 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
229 wxString
* wxString_LIST_helper(PyObject
* source
);
230 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
231 wxPen
** wxPen_LIST_helper(PyObject
* source
);
233 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
234 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
235 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
236 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
237 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
238 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
241 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
242 bool wxColour_typecheck(PyObject
* source
);
244 bool wxPyCheckForApp();
247 // Other helpful stuff
248 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
249 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
251 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
252 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
254 #endif // wxPyUSE_EXPORTED_API
256 //---------------------------------------------------------------------------
258 #if PYTHON_API_VERSION < 1009
259 #define PySequence_Fast_GET_ITEM(o, i) \
260 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
263 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
264 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
265 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
267 //---------------------------------------------------------------------------
269 #ifndef wxPyUSE_EXPORTED_API
271 class wxPyCallback
: public wxObject
{
272 DECLARE_ABSTRACT_CLASS(wxPyCallback
)
274 wxPyCallback(PyObject
* func
);
275 wxPyCallback(const wxPyCallback
& other
);
278 void EventThunker(wxEvent
& event
);
283 #endif // wxPyUSE_EXPORTED_API
284 //---------------------------------------------------------------------------
285 //---------------------------------------------------------------------------
286 // These Event classes can be derived from in Python and passed through the
287 // event system without loosing anything. They do this by keeping a reference
288 // to themselves and some special case handling in wxPyCallback::EventThunker.
292 class wxPyEvtSelfRef
{
297 void SetSelf(PyObject
* self
, bool clone
=false);
298 PyObject
* GetSelf() const;
299 bool GetCloned() const { return m_cloned
; }
307 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
308 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
310 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
311 wxPyEvent(const wxPyEvent
& evt
);
314 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
318 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
319 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
321 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
322 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
325 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
330 //----------------------------------------------------------------------
331 // Forward decalre a few things used in the exported API
332 class wxPyClientData
;
334 class wxPyOORClientData
;
335 class wxPyCBInputStream
;
337 void wxPyClientData_dtor(wxPyClientData
* self
);
338 void wxPyUserData_dtor(wxPyUserData
* self
);
339 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
340 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
341 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
343 //---------------------------------------------------------------------------
344 // Export a C API in a struct. Other modules will be able to load this from
345 // the wx.core module and will then have safe access to these functions, even if
346 // in another shared library.
348 class wxPyCallbackHelper
;
352 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
353 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
354 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
355 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
357 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
358 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
359 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
360 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
362 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
364 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
365 wxString (*p_Py2wxString
)(PyObject
* source
);
366 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
368 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
369 int* (*p_int_LIST_helper
)(PyObject
* source
);
370 long* (*p_long_LIST_helper
)(PyObject
* source
);
371 char** (*p_string_LIST_helper
)(PyObject
* source
);
372 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
373 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
374 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
375 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
377 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
378 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
379 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
380 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
381 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
382 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
385 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
386 bool (*p_wxColour_typecheck
)(PyObject
* source
);
388 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
389 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
);
390 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
391 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
392 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
394 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
395 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
396 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
397 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
398 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
399 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
400 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
402 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
403 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
404 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
406 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
407 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
409 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
410 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
412 bool (*p_wxPyCheckForApp
)();
416 #ifdef wxPyUSE_EXPORTED_API
417 // Notice that this is static, not extern. This is by design, each module
418 // needs one, but doesn't have to use it.
419 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
420 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
421 #endif // wxPyUSE_EXPORTED_API
423 //---------------------------------------------------------------------------
425 // A wxObject that holds a reference to a Python object
426 class wxPyUserData
: public wxObject
{
428 wxPyUserData(PyObject
* obj
) {
434 #ifdef wxPyUSE_EXPORTED_API
435 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
437 wxPyUserData_dtor(this);
444 // A wxClientData that holds a refernece to a Python object
445 class wxPyClientData
: public wxClientData
{
447 wxPyClientData(PyObject
* obj
, bool incref
=true) {
455 #ifdef wxPyUSE_EXPORTED_API
456 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
458 wxPyClientData_dtor(this);
466 // Just like wxPyClientData, except when this object is destroyed it does some
467 // OOR magic on the Python Object.
468 class wxPyOORClientData
: public wxPyClientData
{
470 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
471 : wxPyClientData(obj
, incref
) {}
472 ~wxPyOORClientData() {
474 #ifdef wxPyUSE_EXPORTED_API
475 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
477 wxPyOORClientData_dtor(this);
483 //---------------------------------------------------------------------------
484 // A wxImageHandler that can be derived from in Python.
487 class wxPyImageHandler
: public wxImageHandler
{
491 // used for interning method names as PyStrings
492 static PyObject
* m_DoCanRead_Name
;
493 static PyObject
* m_GetImageCount_Name
;
494 static PyObject
* m_LoadFile_Name
;
495 static PyObject
* m_SaveFile_Name
;
497 // converstion helpers
498 PyObject
* py_InputStream(wxInputStream
* stream
);
499 PyObject
* py_Image(wxImage
* image
);
500 PyObject
* py_OutputStream(wxOutputStream
* stream
);
505 void _SetSelf(PyObject
*self
);
507 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
508 bool verbose
=true, int index
=-1 );
509 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
511 virtual int GetImageCount(wxInputStream
& stream
);
512 virtual bool DoCanRead(wxInputStream
&stream
);
516 //---------------------------------------------------------------------------
517 // This class holds an instance of a Python Shadow Class object and assists
518 // with looking up and invoking Python callback methods from C++ virtual
519 // method redirections. For all classes which have virtuals which should be
520 // overridable in wxPython, a new subclass is created that contains a
521 // wxPyCallbackHelper.
524 class wxPyCallbackHelper
{
526 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
528 wxPyCallbackHelper() {
535 ~wxPyCallbackHelper() {
536 #ifdef wxPyUSE_EXPORTED_API
537 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
539 wxPyCBH_delete(this);
543 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
544 bool findCallback(const char* name
, bool setGuard
=true) const;
545 int callCallback(PyObject
* argTuple
) const;
546 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
547 PyObject
* GetLastFound() const { return m_lastFound
; }
549 void setRecursionGuard(PyObject
* method
) const;
550 void clearRecursionGuard(PyObject
* method
) const;
555 PyObject
* m_lastFound
;
558 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
562 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
563 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
=true);
564 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
565 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
566 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
571 //---------------------------------------------------------------------------
573 // This is used in C++ classes that need to be able to make callback to
574 // "overloaded" python methods
577 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
578 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
580 private: wxPyCallbackHelper m_myInst
583 //---------------------------------------------------------------------------
584 // The wxPythonApp class
587 wxPYAPP_ASSERT_SUPPRESS
= 1,
588 wxPYAPP_ASSERT_EXCEPTION
= 2,
589 wxPYAPP_ASSERT_DIALOG
= 4,
590 wxPYAPP_ASSERT_LOG
= 8
593 class wxPyApp
: public wxApp
595 DECLARE_ABSTRACT_CLASS(wxPyApp
)
603 int GetAssertMode() { return m_assertMode
; }
604 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
606 virtual bool OnInitGui();
607 virtual int OnExit();
609 virtual void OnAssertFailure(const wxChar
*file
,
615 virtual void ExitMainLoop();
616 // virtual int FilterEvent(wxEvent& event); // This one too????
618 // For catching Apple Events
619 virtual void MacOpenFile(const wxString
&fileName
);
620 virtual void MacPrintFile(const wxString
&fileName
);
621 virtual void MacNewFile();
622 virtual void MacReopenApp();
624 static bool GetMacSupportPCMenuShortcuts();
625 static long GetMacAboutMenuItemId();
626 static long GetMacPreferencesMenuItemId();
627 static long GetMacExitMenuItemId();
628 static wxString
GetMacHelpMenuTitleName();
630 static void SetMacSupportPCMenuShortcuts(bool val
);
631 static void SetMacAboutMenuItemId(long val
);
632 static void SetMacPreferencesMenuItemId(long val
);
633 static void SetMacExitMenuItemId(long val
);
634 static void SetMacHelpMenuTitleName(const wxString
& val
);
637 void _BootstrapApp();
639 // implementation only
640 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
644 bool m_startupComplete
;
647 extern wxPyApp
*wxPythonApp
;
650 //----------------------------------------------------------------------
651 // These macros are used to implement the virtual methods that should
652 // redirect to a Python method if one exists. The names designate the
653 // return type, if any, as well as any parameter types.
654 //---------------------------------------------------------------------------
656 #define DEC_PYCALLBACK__(CBNAME) \
660 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
661 void CLASS::CBNAME() { \
663 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
664 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
665 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
666 wxPyEndBlockThreads(blocked); \
671 #define DEC_PYCALLBACK_VOID_(CBNAME) \
672 DEC_PYCALLBACK__(CBNAME)
674 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
675 IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)
677 //---------------------------------------------------------------------------
679 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
680 bool CBNAME(int a, int b)
683 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
684 bool CLASS::CBNAME(int a, int b) { \
685 bool rval=false, found; \
686 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
687 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
688 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
689 wxPyEndBlockThreads(blocked); \
691 rval = PCLASS::CBNAME(a,b); \
695 //---------------------------------------------------------------------------
697 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
698 void CBNAME(int a, int b)
701 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
702 void CLASS::CBNAME(int a, int b) { \
704 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
705 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
706 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
707 wxPyEndBlockThreads(blocked); \
709 PCLASS::CBNAME(a,b); \
712 //---------------------------------------------------------------------------
714 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
718 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
719 void CLASS::CBNAME(int a) { \
721 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
722 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
723 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
724 wxPyEndBlockThreads(blocked); \
729 //---------------------------------------------------------------------------
731 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
732 void CBNAME(int a, int b, int c, int d)
735 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
736 void CLASS::CBNAME(int a, int b, int c, int d) { \
738 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
739 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
740 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
741 wxPyEndBlockThreads(blocked); \
743 PCLASS::CBNAME(a,b,c,d); \
746 //---------------------------------------------------------------------------
747 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
748 void CBNAME(int a, int b, int c, int d, int e)
751 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
752 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
754 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
755 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
756 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
757 wxPyEndBlockThreads(blocked); \
759 PCLASS::CBNAME(a,b,c,d,e); \
762 //---------------------------------------------------------------------------
764 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
765 void CBNAME(int* a, int* b) const
768 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
769 void CLASS::CBNAME(int* a, int* b) const { \
770 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
772 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
773 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
775 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
777 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
778 PyObject* o1 = PySequence_GetItem(ro, 0); \
779 PyObject* o2 = PySequence_GetItem(ro, 1); \
780 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
781 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
784 PyErr_SetString(PyExc_TypeError, errmsg); \
789 PyErr_SetString(PyExc_TypeError, errmsg); \
794 wxPyEndBlockThreads(blocked); \
796 PCLASS::CBNAME(a,b); \
799 //---------------------------------------------------------------------------
801 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
802 wxSize CBNAME() const
805 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
806 wxSize CLASS::CBNAME() const { \
807 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
808 bool found; wxSize rval(0,0); \
809 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
810 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
812 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
814 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
815 PyObject* o1 = PySequence_GetItem(ro, 0); \
816 PyObject* o2 = PySequence_GetItem(ro, 1); \
817 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
818 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
821 PyErr_SetString(PyExc_TypeError, errmsg); \
826 PyErr_SetString(PyExc_TypeError, errmsg); \
831 wxPyEndBlockThreads(blocked); \
833 return PCLASS::CBNAME(); \
838 //---------------------------------------------------------------------------
840 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
844 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
845 bool CLASS::CBNAME(bool a) { \
846 bool rval=false, found; \
847 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
848 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
849 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
850 wxPyEndBlockThreads(blocked); \
852 rval = PCLASS::CBNAME(a); \
856 //---------------------------------------------------------------------------
858 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
862 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
863 bool CLASS::CBNAME(int a) { \
864 bool rval=false, found; \
865 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
866 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
867 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
868 wxPyEndBlockThreads(blocked); \
870 rval = PCLASS::CBNAME(a); \
874 //---------------------------------------------------------------------------
876 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
880 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
881 bool CLASS::CBNAME(int a) { \
883 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
884 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
885 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
887 wxPyEndBlockThreads(blocked); \
892 //---------------------------------------------------------------------------
894 #define DEC_PYCALLBACK__DC(CBNAME) \
898 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
899 void CLASS::CBNAME(wxDC& a) { \
901 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
902 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
903 PyObject* obj = wxPyMake_wxObject(&a,false); \
904 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
907 wxPyEndBlockThreads(blocked); \
913 //---------------------------------------------------------------------------
915 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
916 void CBNAME(wxDC& a, bool b)
919 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
920 void CLASS::CBNAME(wxDC& a, bool b) { \
922 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
923 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
924 PyObject* obj = wxPyMake_wxObject(&a,false); \
925 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
928 wxPyEndBlockThreads(blocked); \
930 PCLASS::CBNAME(a, b); \
933 //---------------------------------------------------------------------------
935 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
936 void CBNAME(wxDC& a, bool b)
939 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
940 void CLASS::CBNAME(wxDC& a, bool b) { \
942 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
943 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
944 PyObject* obj = wxPyMake_wxObject(&a,false); \
945 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
948 wxPyEndBlockThreads(blocked); \
950 PCLASS::CBNAME(a, b); \
953 //---------------------------------------------------------------------------
955 #define DEC_PYCALLBACK__2DBL(CBNAME) \
956 void CBNAME(double a, double b)
959 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
960 void CLASS::CBNAME(double a, double b) { \
962 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
963 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
964 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
965 wxPyEndBlockThreads(blocked); \
967 PCLASS::CBNAME(a, b); \
970 //---------------------------------------------------------------------------
972 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
973 void CBNAME(double a, double b, int c, int d)
976 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
977 void CLASS::CBNAME(double a, double b, int c, int d) { \
979 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
980 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
981 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
983 wxPyEndBlockThreads(blocked); \
985 PCLASS::CBNAME(a, b, c, d); \
988 //---------------------------------------------------------------------------
990 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
991 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
994 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
995 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
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("(Oddddi)", obj, b, c, d, e, (int)f)); \
1003 wxPyEndBlockThreads(blocked); \
1005 PCLASS::CBNAME(a, b, c, d, e, f); \
1008 //---------------------------------------------------------------------------
1010 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1011 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1014 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1015 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1017 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1019 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1020 PyObject* obj = wxPyMake_wxObject(&a,false); \
1021 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1024 wxPyEndBlockThreads(blocked); \
1026 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1030 //---------------------------------------------------------------------------
1032 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1033 void CBNAME(bool a, double b, double c, int d, int e)
1036 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1037 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1039 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1040 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1041 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1043 wxPyEndBlockThreads(blocked); \
1045 PCLASS::CBNAME(a, b, c, d, e); \
1048 //---------------------------------------------------------------------------
1050 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1051 void CBNAME(wxDC& a, double b, double c, double d, double e)
1054 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1055 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1057 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1058 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1059 PyObject* obj = wxPyMake_wxObject(&a,false); \
1060 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1063 wxPyEndBlockThreads(blocked); \
1065 PCLASS::CBNAME(a, b, c, d, e); \
1068 //---------------------------------------------------------------------------
1070 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1071 void CBNAME(wxDC& a, bool b)
1074 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1075 void CLASS::CBNAME(wxDC& a, bool b) { \
1077 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1078 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1079 PyObject* obj = wxPyMake_wxObject(&a,false); \
1080 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1083 wxPyEndBlockThreads(blocked); \
1085 PCLASS::CBNAME(a, b); \
1088 //---------------------------------------------------------------------------
1090 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1091 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1094 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1095 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1098 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1099 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1100 PyObject* obj = wxPyMake_wxObject(a,false); \
1101 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1104 wxPyEndBlockThreads(blocked); \
1106 PCLASS::CBNAME(a, b, c, d, e, f); \
1109 //---------------------------------------------------------------------------
1111 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1112 void CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1115 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1116 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1118 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1119 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1120 PyObject* obj = wxPyMake_wxObject(a,false); \
1121 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1124 wxPyEndBlockThreads(blocked); \
1126 PCLASS::CBNAME(a, b, c, d, e); \
1129 //---------------------------------------------------------------------------
1131 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1132 void CBNAME(double a, double b, int c)
1135 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1136 void CLASS::CBNAME(double a, double b, int c) { \
1138 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1139 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1140 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1141 wxPyEndBlockThreads(blocked); \
1143 PCLASS::CBNAME(a, b, c); \
1146 //---------------------------------------------------------------------------
1148 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1149 void CBNAME(bool a, double b, double c, int d)
1152 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1153 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1155 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1156 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1157 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1158 wxPyEndBlockThreads(blocked); \
1160 PCLASS::CBNAME(a, b, c, d); \
1163 //---------------------------------------------------------------------------
1164 //---------------------------------------------------------------------------
1166 #define DEC_PYCALLBACK__STRING(CBNAME) \
1167 void CBNAME(const wxString& a)
1169 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1170 void CLASS::CBNAME(const wxString& a) { \
1172 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1173 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1174 PyObject* s = wx2PyString(a); \
1175 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1178 wxPyEndBlockThreads(blocked); \
1180 PCLASS::CBNAME(a); \
1183 //---------------------------------------------------------------------------
1185 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1186 bool CBNAME(const wxString& a)
1188 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1189 bool CLASS::CBNAME(const wxString& a) { \
1192 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1193 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1194 PyObject* s = wx2PyString(a); \
1195 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1198 wxPyEndBlockThreads(blocked); \
1200 rval = PCLASS::CBNAME(a); \
1204 //---------------------------------------------------------------------------
1206 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1207 bool CBNAME(const wxString& a)
1209 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1210 bool CLASS::CBNAME(const wxString& a) { \
1212 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1213 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1214 PyObject* s = wx2PyString(a); \
1215 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1218 wxPyEndBlockThreads(blocked); \
1222 //---------------------------------------------------------------------------
1224 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1225 wxString CBNAME(const wxString& a)
1227 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1228 wxString CLASS::CBNAME(const wxString& a) { \
1230 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1231 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1233 PyObject* s = wx2PyString(a); \
1234 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1237 rval = Py2wxString(ro); \
1241 wxPyEndBlockThreads(blocked); \
1245 //---------------------------------------------------------------------------
1247 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1248 wxString CBNAME(const wxString& a)
1250 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1251 wxString CLASS::CBNAME(const wxString& a) { \
1254 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1255 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1257 PyObject* s = wx2PyString(a); \
1258 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1261 rval = Py2wxString(ro); \
1266 rval = PCLASS::CBNAME(a); \
1267 wxPyEndBlockThreads(blocked); \
1271 //---------------------------------------------------------------------------
1273 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1274 wxString CBNAME(const wxString& a,int b)
1276 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1277 wxString CLASS::CBNAME(const wxString& a,int b) { \
1279 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1280 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1282 PyObject* s = wx2PyString(a); \
1283 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1286 rval = Py2wxString(ro); \
1290 wxPyEndBlockThreads(blocked); \
1294 //---------------------------------------------------------------------------
1296 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1297 bool CBNAME(const wxString& a, const wxString& b)
1299 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1300 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1303 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1304 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1305 PyObject* s1 = wx2PyString(a); \
1306 PyObject* s2 = wx2PyString(b); \
1307 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1311 wxPyEndBlockThreads(blocked); \
1313 rval = PCLASS::CBNAME(a, b); \
1317 //---------------------------------------------------------------------------
1319 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1322 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1323 wxString CLASS::CBNAME() { \
1326 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1327 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1329 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1331 rval = Py2wxString(ro); \
1335 wxPyEndBlockThreads(blocked); \
1337 rval = PCLASS::CBNAME(); \
1341 //---------------------------------------------------------------------------
1343 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1344 wxString CBNAME() const
1346 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1347 wxString CLASS::CBNAME() const { \
1350 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1351 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1353 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1355 rval = Py2wxString(ro); \
1359 wxPyEndBlockThreads(blocked); \
1361 rval = PCLASS::CBNAME(); \
1365 //---------------------------------------------------------------------------
1367 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1370 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1371 wxString CLASS::CBNAME() { \
1373 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1374 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1376 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1378 rval = Py2wxString(ro); \
1382 wxPyEndBlockThreads(blocked); \
1386 //---------------------------------------------------------------------------
1388 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1389 wxString CBNAME() const;
1391 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1392 wxString CLASS::CBNAME() const { \
1394 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1395 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1397 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1399 rval = Py2wxString(ro); \
1403 wxPyEndBlockThreads(blocked); \
1407 //---------------------------------------------------------------------------
1409 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1410 bool CBNAME(const wxHtmlTag& a)
1413 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1414 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1416 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1417 if (wxPyCBH_findCallback2(m_myInst, #CBNAME, false)) { \
1418 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1419 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1422 wxPyEndBlockThreads(blocked); \
1426 //---------------------------------------------------------------------------
1428 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1429 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1431 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1432 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1434 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1435 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1436 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1437 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1440 wxPyEndBlockThreads(blocked); \
1442 PCLASS::CBNAME(cell, x, y); \
1445 //---------------------------------------------------------------------------
1447 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1448 void CBNAME(const wxColour& c);
1450 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1451 void CLASS::CBNAME(const wxColour& c) { \
1453 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1454 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1455 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1456 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1459 wxPyEndBlockThreads(blocked); \
1461 PCLASS::CBNAME(c); \
1464 //---------------------------------------------------------------------------
1466 #define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
1467 bool CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1469 #define IMP_PYCALLBACK_BOOL_CELLINTINTME(CLASS, PCLASS, CBNAME) \
1470 bool CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1471 bool rval=false, found; \
1472 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1473 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1474 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1475 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1476 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1480 wxPyEndBlockThreads(blocked); \
1482 rval = PCLASS::CBNAME(cell, x, y, e); \
1487 //---------------------------------------------------------------------------
1489 #define DEC_PYCALLBACK___pure(CBNAME) \
1493 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1494 void CLASS::CBNAME() { \
1495 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1496 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1497 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1498 wxPyEndBlockThreads(blocked); \
1501 //---------------------------------------------------------------------------
1503 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1507 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1508 wxSize CLASS::CBNAME() { \
1509 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1511 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1512 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1515 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1517 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1519 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1521 PyObject* o1 = PySequence_GetItem(ro, 0); \
1522 PyObject* o2 = PySequence_GetItem(ro, 1); \
1523 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1524 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1526 PyErr_SetString(PyExc_TypeError, errmsg); \
1531 PyErr_SetString(PyExc_TypeError, errmsg); \
1536 wxPyEndBlockThreads(blocked); \
1540 //---------------------------------------------------------------------------
1542 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1543 bool CBNAME(wxWindow* a)
1546 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1547 bool CLASS::CBNAME(wxWindow* a) { \
1550 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1551 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1552 PyObject* obj = wxPyMake_wxObject(a,false); \
1553 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1556 wxPyEndBlockThreads(blocked); \
1558 rval = PCLASS::CBNAME(a); \
1562 //---------------------------------------------------------------------------
1564 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1565 bool CBNAME(wxWindow* a, wxDC& b)
1568 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1569 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1572 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1573 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1574 PyObject* win = wxPyMake_wxObject(a,false); \
1575 PyObject* dc = wxPyMake_wxObject(&b,false); \
1576 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1580 wxPyEndBlockThreads(blocked); \
1582 rval = PCLASS::CBNAME(a, b); \
1586 //---------------------------------------------------------------------------
1588 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1589 void CBNAME(wxWindowBase* a)
1592 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1593 void CLASS::CBNAME(wxWindowBase* a) { \
1595 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1596 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1597 PyObject* obj = wxPyMake_wxObject(a,false); \
1598 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1601 wxPyEndBlockThreads(blocked); \
1603 PCLASS::CBNAME(a); \
1606 //---------------------------------------------------------------------------
1608 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1612 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1613 bool CLASS::CBNAME() { \
1616 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1617 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1618 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1619 wxPyEndBlockThreads(blocked); \
1621 rval = PCLASS::CBNAME(); \
1625 //---------------------------------------------------------------------------
1627 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1631 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1632 bool CLASS::CBNAME() const { \
1635 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1636 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1637 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1638 wxPyEndBlockThreads(blocked); \
1640 rval = PCLASS::CBNAME(); \
1644 //---------------------------------------------------------------------------
1646 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1647 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1650 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1651 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1654 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1655 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1656 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1657 wxPyEndBlockThreads(blocked); \
1659 rval = PCLASS::CBNAME(a, b, c); \
1660 return (wxDragResult)rval; \
1663 //---------------------------------------------------------------------------
1665 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1666 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1668 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1669 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1670 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1672 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1674 PyObject* obj = wxPyMake_wxObject(&a,false); \
1675 PyObject* s = wx2PyString(b); \
1676 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1679 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1680 /* release ownership of the C++ wx.FSFile object. */ \
1681 PyObject_SetAttrString(ro, "thisown", Py_False); \
1687 wxPyEndBlockThreads(blocked); \
1691 //---------------------------------------------------------------------------
1693 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1694 bool CBNAME(wxDragResult a)
1697 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1698 bool CLASS::CBNAME(wxDragResult a) { \
1701 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1702 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1703 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1704 wxPyEndBlockThreads(blocked); \
1706 rval = PCLASS::CBNAME(a); \
1710 //---------------------------------------------------------------------------
1712 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1713 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1716 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1717 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1718 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1720 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1721 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1722 wxPyEndBlockThreads(blocked); \
1723 return (wxDragResult)rval; \
1726 //---------------------------------------------------------------------------
1728 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1729 bool CBNAME(int a, int b, const wxString& c)
1731 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1732 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1734 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1735 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1736 PyObject* s = wx2PyString(c); \
1737 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1740 wxPyEndBlockThreads(blocked); \
1744 //---------------------------------------------------------------------------
1746 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1750 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1751 size_t CLASS::CBNAME() { \
1754 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1755 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1756 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1757 wxPyEndBlockThreads(blocked); \
1759 rval = PCLASS::CBNAME(); \
1763 //---------------------------------------------------------------------------
1765 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1766 size_t CBNAME() const
1769 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1770 size_t CLASS::CBNAME() const { \
1773 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1774 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1775 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1776 wxPyEndBlockThreads(blocked); \
1778 rval = PCLASS::CBNAME(); \
1782 //---------------------------------------------------------------------------
1784 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1785 wxDataFormat CBNAME(size_t a)
1788 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1789 wxDataFormat CLASS::CBNAME(size_t a) { \
1790 wxDataFormat rval=0; \
1792 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1793 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1795 wxDataFormat* ptr; \
1796 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1798 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1803 wxPyEndBlockThreads(blocked); \
1805 rval = PCLASS::CBNAME(a); \
1809 //---------------------------------------------------------------------------
1811 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1812 void CBNAME(const Type& a)
1815 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1816 void CLASS::CBNAME(const Type& a) { \
1818 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1819 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1820 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1821 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1824 wxPyEndBlockThreads(blocked); \
1826 PCLASS::CBNAME(a); \
1830 //---------------------------------------------------------------------------
1832 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1833 void CBNAME(Type& a)
1836 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1837 void CLASS::CBNAME(Type& a) { \
1839 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1840 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1841 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1842 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1845 wxPyEndBlockThreads(blocked); \
1847 PCLASS::CBNAME(a); \
1850 //---------------------------------------------------------------------------
1852 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1853 bool CBNAME(Type& a)
1856 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1857 bool CLASS::CBNAME(Type& a) { \
1860 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1861 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1862 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1863 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1866 wxPyEndBlockThreads(blocked); \
1868 rv = PCLASS::CBNAME(a); \
1872 //---------------------------------------------------------------------------
1874 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1875 bool CBNAME(Type& a)
1878 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1879 bool CLASS::CBNAME(Type& a) { \
1881 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1882 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1883 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1884 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1887 wxPyEndBlockThreads(blocked); \
1891 //---------------------------------------------------------------------------
1893 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1894 wxString CBNAME(long a, long b) const
1896 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1897 wxString CLASS::CBNAME(long a, long b) const { \
1900 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1901 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1903 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1905 rval = Py2wxString(ro); \
1909 wxPyEndBlockThreads(blocked); \
1911 rval = PCLASS::CBNAME(a,b); \
1915 //---------------------------------------------------------------------------
1917 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1918 int CBNAME(long a) const
1921 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1922 int CLASS::CBNAME(long a) const { \
1925 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1926 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1928 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1930 rval = PyInt_AsLong(ro); \
1934 wxPyEndBlockThreads(blocked); \
1936 rval = PCLASS::CBNAME(a); \
1941 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
1942 int CBNAME(long a) const;
1945 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
1946 int CLASS::CBNAME(long a) const { \
1947 int rval=-1; /* this rval is important for OnGetItemImage */ \
1949 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1950 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1952 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1954 rval = PyInt_AsLong(ro); \
1958 wxPyEndBlockThreads(blocked); \
1963 //---------------------------------------------------------------------------
1965 #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
1966 int CBNAME(long a, long b) const
1969 #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \
1970 int CLASS::CBNAME(long a, long b) const { \
1973 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1974 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1976 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1978 rval = PyInt_AsLong(ro); \
1982 wxPyEndBlockThreads(blocked); \
1984 rval = PCLASS::CBNAME(a, b); \
1989 #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \
1990 int CBNAME(long a, long b) const;
1993 #define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME) \
1994 int CLASS::CBNAME(long a, long b) const { \
1995 int rval=-1; /* this rval is important for OnGetItemImage */ \
1997 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1998 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2000 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2002 rval = PyInt_AsLong(ro); \
2006 wxPyEndBlockThreads(blocked); \
2011 //---------------------------------------------------------------------------
2013 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2014 wxListItemAttr* CBNAME(long a) const
2017 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2018 wxListItemAttr *CLASS::CBNAME(long a) const { \
2019 wxListItemAttr *rval = NULL; \
2021 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2022 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2024 wxListItemAttr* ptr; \
2025 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2027 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2032 wxPyEndBlockThreads(blocked); \
2034 rval = PCLASS::CBNAME(a); \
2038 //---------------------------------------------------------------------------
2040 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2041 bool CBNAME(wxMouseEvent& e)
2043 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2044 bool CLASS::CBNAME(wxMouseEvent& e) { \
2047 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2048 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2050 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2051 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2053 rval = PyInt_AsLong(ro); \
2058 wxPyEndBlockThreads(blocked); \
2060 return PCLASS::CBNAME(e); \
2064 //---------------------------------------------------------------------------
2066 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2067 wxWizardPage* CBNAME() const
2069 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2070 wxWizardPage* CLASS::CBNAME() const { \
2071 wxWizardPage* rv = NULL; \
2072 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2073 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2075 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2077 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2081 wxPyEndBlockThreads(blocked); \
2085 //---------------------------------------------------------------------------
2087 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2088 wxBitmap CBNAME() const
2090 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2091 wxBitmap CLASS::CBNAME() const { \
2093 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2094 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2097 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2099 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2104 wxPyEndBlockThreads(blocked); \
2108 //---------------------------------------------------------------------------
2110 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2113 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2114 wxObject* CLASS::CBNAME() { \
2115 wxObject* rv = NULL; \
2116 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2117 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2119 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2121 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2125 wxPyEndBlockThreads(blocked); \
2129 //---------------------------------------------------------------------------
2131 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2132 wxObject* CBNAME(const wxString& a)
2134 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2135 wxObject* CLASS::CBNAME(const wxString& a) { \
2136 wxObject* rv = NULL; \
2137 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2138 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2139 PyObject* so = wx2PyString(a); \
2141 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2143 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2148 wxPyEndBlockThreads(blocked); \
2152 //---------------------------------------------------------------------------
2154 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2155 bool CBNAME(wxXmlNode* a)
2158 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2159 bool CLASS::CBNAME(wxXmlNode* a) { \
2161 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2162 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2163 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2164 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2167 wxPyEndBlockThreads(blocked); \
2171 //---------------------------------------------------------------------------
2173 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2174 wxCoord CBNAME(size_t a) const
2177 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2178 wxCoord CLASS::CBNAME(size_t a) const { \
2181 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2182 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2183 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2185 wxPyEndBlockThreads(blocked); \
2189 //---------------------------------------------------------------------------
2191 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2192 void CBNAME(size_t a, size_t b) const
2195 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2196 void CLASS::CBNAME(size_t a, size_t b) const { \
2198 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2199 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2200 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2201 wxPyEndBlockThreads(blocked); \
2203 PCLASS::CBNAME(a,b); \
2205 //---------------------------------------------------------------------------
2207 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2208 wxCoord CBNAME() const
2211 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2212 wxCoord CLASS::CBNAME() const { \
2215 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2216 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2217 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2218 wxPyEndBlockThreads(blocked); \
2220 rval = PCLASS::CBNAME(); \
2224 //---------------------------------------------------------------------------
2226 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2227 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2229 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2230 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2232 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2233 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2234 PyObject* obj = wxPyMake_wxObject(&a,false); \
2235 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2236 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2239 wxPyEndBlockThreads(blocked); \
2244 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2245 void CBNAME(wxDC& a, const wxRect& b, size_t c) const
2247 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2248 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2250 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2251 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2252 PyObject* obj = wxPyMake_wxObject(&a,false); \
2253 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2254 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2257 wxPyEndBlockThreads(blocked); \
2259 PCLASS::CBNAME(a,b,c); \
2263 //---------------------------------------------------------------------------
2264 // Same as the above set, but the wxRect is not const
2266 #define DEC_PYCALLBACK__DCRECTSIZET2_constpure(CBNAME) \
2267 void CBNAME(wxDC& a, wxRect& b, size_t c) const;
2269 #define IMP_PYCALLBACK__DCRECTSIZET2_constpure(CLASS, PCLASS, CBNAME) \
2270 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2272 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2273 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2274 PyObject* obj = wxPyMake_wxObject(&a,false); \
2275 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2276 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2279 wxPyEndBlockThreads(blocked); \
2284 #define DEC_PYCALLBACK__DCRECTSIZET2_const(CBNAME) \
2285 void CBNAME(wxDC& a, wxRect& b, size_t c) const
2287 #define IMP_PYCALLBACK__DCRECTSIZET2_const(CLASS, PCLASS, CBNAME) \
2288 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2290 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2291 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2292 PyObject* obj = wxPyMake_wxObject(&a,false); \
2293 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2294 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2297 wxPyEndBlockThreads(blocked); \
2299 PCLASS::CBNAME(a,b,c); \
2304 //---------------------------------------------------------------------------
2308 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2309 wxString CBNAME(size_t a) const
2311 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2312 wxString CLASS::CBNAME(size_t a) const { \
2315 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2316 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2318 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2320 rval = Py2wxString(ro); \
2324 wxPyEndBlockThreads(blocked); \
2326 rval = PCLASS::CBNAME(a); \
2330 //---------------------------------------------------------------------------
2332 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2333 wxString CBNAME(size_t a) const
2335 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2336 wxString CLASS::CBNAME(size_t a) const { \
2339 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2340 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2342 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2344 rval = Py2wxString(ro); \
2348 wxPyEndBlockThreads(blocked); \
2352 //---------------------------------------------------------------------------
2354 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2355 wxVisualAttributes CBNAME() const
2358 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2359 wxVisualAttributes CLASS::CBNAME() const { \
2360 wxVisualAttributes rval; \
2362 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2363 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2365 wxVisualAttributes* ptr; \
2366 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2368 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2373 wxPyEndBlockThreads(blocked); \
2375 rval = PCLASS::CBNAME(); \
2379 //---------------------------------------------------------------------------