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>
32 #include <wx/numdlg.h>
34 #include <wx/docview.h>
35 #include <wx/encconv.h>
36 #include <wx/fdrepdlg.h>
37 #include <wx/fileconf.h>
38 #include <wx/filesys.h>
39 #include <wx/fontdlg.h>
40 #include <wx/fs_inet.h>
41 #include <wx/fs_mem.h>
42 #include <wx/fs_zip.h>
43 #include <wx/gbsizer.h>
44 #include <wx/geometry.h>
45 #include <wx/htmllbox.h>
47 #include <wx/imaglist.h>
49 #include <wx/laywin.h>
50 #include <wx/listbook.h>
51 #include <wx/minifram.h>
52 #include <wx/notebook.h>
54 #include <wx/printdlg.h>
55 #include <wx/process.h>
56 #include <wx/progdlg.h>
57 #include <wx/sashwin.h>
58 #include <wx/spinbutt.h>
59 #include <wx/spinctrl.h>
60 #include <wx/splash.h>
61 #include <wx/splitter.h>
62 #include <wx/statline.h>
63 #include <wx/stream.h>
64 #include <wx/sysopt.h>
65 #include <wx/taskbar.h>
66 #include <wx/tglbtn.h>
67 #include <wx/tipwin.h>
68 #include <wx/toolbook.h>
69 #include <wx/tooltip.h>
70 #include <wx/treebook.h>
72 #include <wx/vscroll.h>
73 #include <wx/dateevt.h>
74 #include <wx/datectrl.h>
76 #include <wx/hyperlink.h>
77 #include <wx/pickerbase.h>
78 #include <wx/clrpicker.h>
79 #include <wx/filepicker.h>
80 #include <wx/fontpicker.h>
81 #include <wx/collpane.h>
85 # pragma warning(disable:4800)
86 # pragma warning(disable:4190)
89 #ifdef __WXMAC__ // avoid a bug in Carbon headers
93 //---------------------------------------------------------------------------
95 #ifndef wxHAS_POWER_EVENTS
96 class wxPowerEvent
: public wxEvent
99 wxPowerEvent(wxEventType evtType
) : wxEvent(wxID_NONE
, evtType
) {}
101 bool IsVetoed() const { return false; }
102 virtual wxEvent
*Clone() const { return new wxPowerEvent(*this); }
106 //---------------------------------------------------------------------------
107 typedef unsigned char byte
;
108 typedef unsigned char* buffer
;
110 typedef wxPoint2DDouble wxPoint2D
;
111 typedef wxRect2DDouble wxRect2D
;
113 #ifndef SWIG_TYPE_TABLE
114 #define SWIG_TYPE_TABLE wxPython_type_table
118 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
120 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
124 #ifndef wxPyUSE_EXPORTED_API
126 void __wxPyPreStart(PyObject
*);
127 void __wxPyCleanup();
128 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
130 void wxSetDefaultPyEncoding(const char* encoding
);
131 const char* wxGetDefaultPyEncoding();
134 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
137 bool wxPyCheckSwigType(const wxChar
* className
);
138 PyObject
* wxPyConstructObject(void* ptr
,
139 const wxChar
* className
,
141 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
142 const wxChar
* className
);
143 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
146 PyObject
* wx2PyString(const wxString
& src
);
147 wxString
Py2wxString(PyObject
* source
);
149 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
150 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
151 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
153 PyObject
* wxPy_ConvertList(wxListBase
* list
);
154 long wxPyGetWinHandle(wxWindow
* win
);
156 void wxPy_ReinitStockObjects(int pass
);
158 bool wxPyInstance_Check(PyObject
* obj
);
159 bool wxPySwigInstance_Check(PyObject
* obj
);
162 #endif // wxPyUSE_EXPORTED_API
163 //---------------------------------------------------------------------------
165 // if we want to handle threads and Python threads are available...
166 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
167 #define WXP_WITH_THREAD
168 #else // no Python threads...
169 #undef WXP_WITH_THREAD
173 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
174 // blocking threads when calling back into Python. Using them instead of my
175 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
176 // wxPyEndBlockThreads.
178 // Unfortunatly there is a bug somewhere when using these new APIs on Python
179 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
180 // at breakpoints located in event handlers. I think that the cause may be
181 // something like the original PyThreadState for the main thread is not being
182 // restored for the callbacks, but I can't see where that could be
183 // happening... So we'll only activate this new change for Python 2.4+ :-(
185 #if PY_VERSION_HEX < 0x02040000
186 #define wxPyUSE_GIL_STATE 0
187 typedef bool wxPyBlock_t
;
189 #define wxPyUSE_GIL_STATE 1
190 typedef PyGILState_STATE wxPyBlock_t
;
194 // Python 2.5 changes the type of some API parameter and return types. Using
195 // this typedef for versions < 2.5 will help with the transition...
196 #if PY_VERSION_HEX < 0x02050000
197 typedef int Py_ssize_t
;
201 #ifndef wxPyUSE_EXPORTED_API
203 // For Python --> C++
204 PyThreadState
* wxPyBeginAllowThreads();
205 void wxPyEndAllowThreads(PyThreadState
* state
);
207 // For C++ --> Python
208 wxPyBlock_t
wxPyBeginBlockThreads();
209 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
211 #endif // wxPyUSE_EXPORTED_API
214 // A macro that will help to execute simple statments wrapped in
215 // StartBlock/EndBlockThreads calls
216 #define wxPyBLOCK_THREADS(stmt) \
217 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
219 // Raise the NotImplementedError exception (blocking threads)
220 #define wxPyRaiseNotImplemented() \
221 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
223 // Raise any exception with a string value (blocking threads)
224 #define wxPyErr_SetString(err, str) \
225 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
228 //---------------------------------------------------------------------------
229 // These are helpers used by the typemaps
231 #ifndef wxPyUSE_EXPORTED_API
233 wxString
* wxString_in_helper(PyObject
* source
);
235 byte
* byte_LIST_helper(PyObject
* source
);
236 int* int_LIST_helper(PyObject
* source
);
237 long* long_LIST_helper(PyObject
* source
);
238 char** string_LIST_helper(PyObject
* source
);
239 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
240 wxPoint2D
* wxPoint2D_LIST_helper(PyObject
* source
, size_t* npoints
);
241 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
242 wxString
* wxString_LIST_helper(PyObject
* source
);
243 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
244 wxPen
** wxPen_LIST_helper(PyObject
* source
);
246 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
247 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
248 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
249 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
250 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
251 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
252 bool wxRect2D_helper(PyObject
* source
, wxRect2D
** obj
);
255 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
256 bool wxColour_typecheck(PyObject
* source
);
259 // Other helpful stuff
260 bool wxPyCheckForApp();
261 bool wxPyTestDisplayAvailable();
263 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
264 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
266 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
267 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
268 PyObject
* wxArrayDouble2PyList_helper(const wxArrayDouble
& arr
);
270 #endif // wxPyUSE_EXPORTED_API
272 //---------------------------------------------------------------------------
274 #if PYTHON_API_VERSION < 1009
275 #define PySequence_Fast_GET_ITEM(o, i) \
276 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
279 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
280 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
281 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
283 //---------------------------------------------------------------------------
285 #ifndef wxPyUSE_EXPORTED_API
287 class wxPyCallback
: public wxObject
{
288 DECLARE_ABSTRACT_CLASS(wxPyCallback
)
290 wxPyCallback(PyObject
* func
);
291 wxPyCallback(const wxPyCallback
& other
);
294 void EventThunker(wxEvent
& event
);
299 #endif // wxPyUSE_EXPORTED_API
300 //---------------------------------------------------------------------------
301 //---------------------------------------------------------------------------
302 // These Event classes can be derived from in Python and passed through the
303 // event system without loosing anything. They do this by keeping a reference
304 // to themselves and some special case handling in wxPyCallback::EventThunker.
308 class wxPyEvtSelfRef
{
313 void SetSelf(PyObject
* self
, bool clone
=false);
314 PyObject
* GetSelf() const;
315 bool GetCloned() const { return m_cloned
; }
323 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
324 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
326 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
327 wxPyEvent(const wxPyEvent
& evt
);
330 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
334 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
335 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
337 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
338 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
341 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
346 //----------------------------------------------------------------------
347 // Forward decalre a few things used in the exported API
348 class wxPyClientData
;
350 class wxPyOORClientData
;
351 class wxPyCBInputStream
;
353 void wxPyClientData_dtor(wxPyClientData
* self
);
354 void wxPyUserData_dtor(wxPyUserData
* self
);
355 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
356 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
357 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
359 //---------------------------------------------------------------------------
360 // Export a C API in a struct. Other modules will be able to load this from
361 // the wx.core module and will then have safe access to these functions, even if
362 // in another shared library.
364 class wxPyCallbackHelper
;
368 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
369 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
370 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
371 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
373 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
374 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
375 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
376 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
378 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
380 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
381 wxString (*p_Py2wxString
)(PyObject
* source
);
382 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
384 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
385 int* (*p_int_LIST_helper
)(PyObject
* source
);
386 long* (*p_long_LIST_helper
)(PyObject
* source
);
387 char** (*p_string_LIST_helper
)(PyObject
* source
);
388 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
389 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
390 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
391 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
393 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
394 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
395 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
396 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
397 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
398 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2D
** obj
);
401 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
402 bool (*p_wxColour_typecheck
)(PyObject
* source
);
404 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
405 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
);
406 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
407 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
408 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
410 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
411 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
412 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
413 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
414 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
415 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
416 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
418 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
419 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
420 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
422 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
423 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
425 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
426 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
428 bool (*p_wxPyCheckForApp
)();
430 // Add all new items at the end...
431 PyObject
* (*p_wxArrayDoublePyList_helper
)(const wxArrayDouble
& arr
);
432 wxPoint2D
* (*p_wxPoint2D_LIST_helper
)(PyObject
* source
, size_t* npoints
);
433 bool (*p_wxRect2D_helper
)(PyObject
* source
, wxRect2D
** obj
);
438 #ifdef wxPyUSE_EXPORTED_API
439 // Notice that this is static, not extern. This is by design, each module
440 // needs one, but doesn't have to use it.
441 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
442 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
443 #endif // wxPyUSE_EXPORTED_API
445 //---------------------------------------------------------------------------
447 // A wxObject that holds a reference to a Python object
448 class wxPyUserData
: public wxObject
{
450 wxPyUserData(PyObject
* obj
) {
456 #ifdef wxPyUSE_EXPORTED_API
457 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
459 wxPyUserData_dtor(this);
466 // A wxClientData that holds a refernece to a Python object
467 class wxPyClientData
: public wxClientData
{
469 wxPyClientData(PyObject
* obj
, bool incref
=true) {
477 #ifdef wxPyUSE_EXPORTED_API
478 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
480 wxPyClientData_dtor(this);
488 // Just like wxPyClientData, except when this object is destroyed it does some
489 // OOR magic on the Python Object.
490 class wxPyOORClientData
: public wxPyClientData
{
492 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
493 : wxPyClientData(obj
, incref
) {}
494 ~wxPyOORClientData() {
496 #ifdef wxPyUSE_EXPORTED_API
497 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
499 wxPyOORClientData_dtor(this);
505 //---------------------------------------------------------------------------
506 // A wxImageHandler that can be derived from in Python.
509 class wxPyImageHandler
: public wxImageHandler
{
513 // used for interning method names as PyStrings
514 static PyObject
* m_DoCanRead_Name
;
515 static PyObject
* m_GetImageCount_Name
;
516 static PyObject
* m_LoadFile_Name
;
517 static PyObject
* m_SaveFile_Name
;
519 // converstion helpers
520 PyObject
* py_InputStream(wxInputStream
* stream
);
521 PyObject
* py_Image(wxImage
* image
);
522 PyObject
* py_OutputStream(wxOutputStream
* stream
);
527 void _SetSelf(PyObject
*self
);
529 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
530 bool verbose
=true, int index
=-1 );
531 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
533 virtual int GetImageCount(wxInputStream
& stream
);
534 virtual bool DoCanRead(wxInputStream
&stream
);
538 //---------------------------------------------------------------------------
539 // This class holds an instance of a Python Shadow Class object and assists
540 // with looking up and invoking Python callback methods from C++ virtual
541 // method redirections. For all classes which have virtuals which should be
542 // overridable in wxPython, a new subclass is created that contains a
543 // wxPyCallbackHelper.
546 class wxPyCallbackHelper
{
548 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
550 wxPyCallbackHelper() {
557 ~wxPyCallbackHelper() {
558 #ifdef wxPyUSE_EXPORTED_API
559 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
561 wxPyCBH_delete(this);
565 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
566 bool findCallback(const char* name
, bool setGuard
=true) const;
567 int callCallback(PyObject
* argTuple
) const;
568 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
569 PyObject
* GetLastFound() const { return m_lastFound
; }
571 void setRecursionGuard(PyObject
* method
) const;
572 void clearRecursionGuard(PyObject
* method
) const;
577 PyObject
* m_lastFound
;
580 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
584 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
585 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
=true);
586 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
587 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
588 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
593 //---------------------------------------------------------------------------
595 // This is used in C++ classes that need to be able to make callback to
596 // "overloaded" python methods
599 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
600 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
602 private: wxPyCallbackHelper m_myInst
605 //---------------------------------------------------------------------------
606 // The wxPythonApp class
609 wxPYAPP_ASSERT_SUPPRESS
= 1,
610 wxPYAPP_ASSERT_EXCEPTION
= 2,
611 wxPYAPP_ASSERT_DIALOG
= 4,
612 wxPYAPP_ASSERT_LOG
= 8
615 class wxPyApp
: public wxApp
617 DECLARE_ABSTRACT_CLASS(wxPyApp
)
625 int GetAssertMode() { return m_assertMode
; }
626 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
628 virtual bool OnInitGui();
629 virtual int OnExit();
631 virtual void OnAssertFailure(const wxChar
*file
,
637 virtual void ExitMainLoop();
638 // virtual int FilterEvent(wxEvent& event); // This one too????
640 // For catching Apple Events
641 virtual void MacOpenFile(const wxString
&fileName
);
642 virtual void MacPrintFile(const wxString
&fileName
);
643 virtual void MacNewFile();
644 virtual void MacReopenApp();
646 static bool GetMacSupportPCMenuShortcuts();
647 static long GetMacAboutMenuItemId();
648 static long GetMacPreferencesMenuItemId();
649 static long GetMacExitMenuItemId();
650 static wxString
GetMacHelpMenuTitleName();
652 static void SetMacSupportPCMenuShortcuts(bool val
);
653 static void SetMacAboutMenuItemId(long val
);
654 static void SetMacPreferencesMenuItemId(long val
);
655 static void SetMacExitMenuItemId(long val
);
656 static void SetMacHelpMenuTitleName(const wxString
& val
);
659 void _BootstrapApp();
661 // implementation only
662 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
666 bool m_startupComplete
;
669 extern wxPyApp
*wxPythonApp
;
672 //----------------------------------------------------------------------
673 // These macros are used to implement the virtual methods that should
674 // redirect to a Python method if one exists. The names designate the
675 // return type, if any, as well as any parameter types.
676 //---------------------------------------------------------------------------
678 #define DEC_PYCALLBACK__(CBNAME) \
682 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
683 void CLASS::CBNAME() { \
685 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
686 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
687 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
688 wxPyEndBlockThreads(blocked); \
693 #define DEC_PYCALLBACK_VOID_(CBNAME) \
694 DEC_PYCALLBACK__(CBNAME)
696 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
697 IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)
699 //---------------------------------------------------------------------------
701 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
702 bool CBNAME(int a, int b)
705 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
706 bool CLASS::CBNAME(int a, int b) { \
707 bool rval=false, found; \
708 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
709 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
710 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
711 wxPyEndBlockThreads(blocked); \
713 rval = PCLASS::CBNAME(a,b); \
717 //---------------------------------------------------------------------------
719 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
720 void CBNAME(int a, int b)
723 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
724 void CLASS::CBNAME(int a, int b) { \
726 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
727 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
728 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
729 wxPyEndBlockThreads(blocked); \
731 PCLASS::CBNAME(a,b); \
734 //---------------------------------------------------------------------------
736 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
740 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
741 void CLASS::CBNAME(int a) { \
743 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
744 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
745 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
746 wxPyEndBlockThreads(blocked); \
751 //---------------------------------------------------------------------------
753 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
754 void CBNAME(int a, int b, int c, int d)
757 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
758 void CLASS::CBNAME(int a, int b, int c, int d) { \
760 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
761 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
762 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
763 wxPyEndBlockThreads(blocked); \
765 PCLASS::CBNAME(a,b,c,d); \
768 //---------------------------------------------------------------------------
769 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
770 void CBNAME(int a, int b, int c, int d, int e)
773 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
774 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
776 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
778 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
779 wxPyEndBlockThreads(blocked); \
781 PCLASS::CBNAME(a,b,c,d,e); \
784 //---------------------------------------------------------------------------
786 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
787 void CBNAME(int* a, int* b) const
790 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
791 void CLASS::CBNAME(int* a, int* b) const { \
792 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
794 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
795 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
797 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
799 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
800 PyObject* o1 = PySequence_GetItem(ro, 0); \
801 PyObject* o2 = PySequence_GetItem(ro, 1); \
802 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
803 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
806 PyErr_SetString(PyExc_TypeError, errmsg); \
811 PyErr_SetString(PyExc_TypeError, errmsg); \
816 wxPyEndBlockThreads(blocked); \
818 PCLASS::CBNAME(a,b); \
821 //---------------------------------------------------------------------------
823 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
824 wxSize CBNAME() const
827 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
828 wxSize CLASS::CBNAME() const { \
829 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
830 bool found; wxSize rval(0,0); \
831 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
832 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
834 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
836 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
837 PyObject* o1 = PySequence_GetItem(ro, 0); \
838 PyObject* o2 = PySequence_GetItem(ro, 1); \
839 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
840 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
843 PyErr_SetString(PyExc_TypeError, errmsg); \
848 PyErr_SetString(PyExc_TypeError, errmsg); \
853 wxPyEndBlockThreads(blocked); \
855 return PCLASS::CBNAME(); \
860 //---------------------------------------------------------------------------
862 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
866 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
867 bool CLASS::CBNAME(bool a) { \
868 bool rval=false, found; \
869 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
870 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
871 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
872 wxPyEndBlockThreads(blocked); \
874 rval = PCLASS::CBNAME(a); \
878 //---------------------------------------------------------------------------
880 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
884 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
885 bool CLASS::CBNAME(int a) { \
886 bool rval=false, found; \
887 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
888 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
889 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
890 wxPyEndBlockThreads(blocked); \
892 rval = PCLASS::CBNAME(a); \
896 //---------------------------------------------------------------------------
898 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
902 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
903 bool CLASS::CBNAME(int a) { \
905 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
906 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
907 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
909 wxPyEndBlockThreads(blocked); \
914 //---------------------------------------------------------------------------
916 #define DEC_PYCALLBACK_INT_WIN(CBNAME) \
917 int CBNAME(wxWindow* a)
920 #define IMP_PYCALLBACK_INT_WIN(CLASS, PCLASS, CBNAME) \
921 int CLASS::CBNAME(wxWindow* a) { \
924 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
925 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
926 PyObject* obj = wxPyMake_wxObject(a, false); \
927 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)",obj)); \
930 wxPyEndBlockThreads(blocked); \
932 rval = PCLASS::CBNAME(a); \
937 //---------------------------------------------------------------------------
939 #define DEC_PYCALLBACK__DC(CBNAME) \
943 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
944 void CLASS::CBNAME(wxDC& a) { \
946 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
947 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
948 PyObject* obj = wxPyMake_wxObject(&a,false); \
949 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
952 wxPyEndBlockThreads(blocked); \
958 //---------------------------------------------------------------------------
960 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
961 void CBNAME(wxDC& a, bool b)
964 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
965 void CLASS::CBNAME(wxDC& a, bool b) { \
967 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
968 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
969 PyObject* obj = wxPyMake_wxObject(&a,false); \
970 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
973 wxPyEndBlockThreads(blocked); \
975 PCLASS::CBNAME(a, b); \
978 //---------------------------------------------------------------------------
980 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
981 void CBNAME(wxDC& a, bool b)
984 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
985 void CLASS::CBNAME(wxDC& a, bool b) { \
987 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
988 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
989 PyObject* obj = wxPyMake_wxObject(&a,false); \
990 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
993 wxPyEndBlockThreads(blocked); \
995 PCLASS::CBNAME(a, b); \
998 //---------------------------------------------------------------------------
1000 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1001 void CBNAME(double a, double b)
1004 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1005 void CLASS::CBNAME(double a, double b) { \
1007 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1008 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1009 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1010 wxPyEndBlockThreads(blocked); \
1012 PCLASS::CBNAME(a, b); \
1015 //---------------------------------------------------------------------------
1017 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1018 void CBNAME(double a, double b, int c, int d)
1021 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1022 void CLASS::CBNAME(double a, double b, int c, int d) { \
1024 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1025 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1026 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1028 wxPyEndBlockThreads(blocked); \
1030 PCLASS::CBNAME(a, b, c, d); \
1033 //---------------------------------------------------------------------------
1035 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1036 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1039 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1040 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1042 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1043 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1044 PyObject* obj = wxPyMake_wxObject(&a,false); \
1045 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1048 wxPyEndBlockThreads(blocked); \
1050 PCLASS::CBNAME(a, b, c, d, e, f); \
1053 //---------------------------------------------------------------------------
1055 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1056 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1059 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1060 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1062 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1064 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1065 PyObject* obj = wxPyMake_wxObject(&a,false); \
1066 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1069 wxPyEndBlockThreads(blocked); \
1071 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1075 //---------------------------------------------------------------------------
1077 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1078 void CBNAME(bool a, double b, double c, int d, int e)
1081 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1082 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1084 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1085 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1086 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1088 wxPyEndBlockThreads(blocked); \
1090 PCLASS::CBNAME(a, b, c, d, e); \
1093 //---------------------------------------------------------------------------
1095 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1096 void CBNAME(wxDC& a, double b, double c, double d, double e)
1099 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1100 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1102 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1103 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1104 PyObject* obj = wxPyMake_wxObject(&a,false); \
1105 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1108 wxPyEndBlockThreads(blocked); \
1110 PCLASS::CBNAME(a, b, c, d, e); \
1113 //---------------------------------------------------------------------------
1115 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1116 void CBNAME(wxDC& a, bool b)
1119 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1120 void CLASS::CBNAME(wxDC& a, bool b) { \
1122 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1123 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1124 PyObject* obj = wxPyMake_wxObject(&a,false); \
1125 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1128 wxPyEndBlockThreads(blocked); \
1130 PCLASS::CBNAME(a, b); \
1133 //---------------------------------------------------------------------------
1135 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1136 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1139 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1140 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1143 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1144 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1145 PyObject* obj = wxPyMake_wxObject(a,false); \
1146 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1149 wxPyEndBlockThreads(blocked); \
1151 PCLASS::CBNAME(a, b, c, d, e, f); \
1154 //---------------------------------------------------------------------------
1156 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1157 void CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1160 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1161 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1163 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1164 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1165 PyObject* obj = wxPyMake_wxObject(a,false); \
1166 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1169 wxPyEndBlockThreads(blocked); \
1171 PCLASS::CBNAME(a, b, c, d, e); \
1174 //---------------------------------------------------------------------------
1176 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1177 void CBNAME(double a, double b, int c)
1180 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1181 void CLASS::CBNAME(double a, double b, int c) { \
1183 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1184 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1185 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1186 wxPyEndBlockThreads(blocked); \
1188 PCLASS::CBNAME(a, b, c); \
1191 //---------------------------------------------------------------------------
1193 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1194 void CBNAME(bool a, double b, double c, int d)
1197 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1198 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1200 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1201 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1202 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1203 wxPyEndBlockThreads(blocked); \
1205 PCLASS::CBNAME(a, b, c, d); \
1208 //---------------------------------------------------------------------------
1209 //---------------------------------------------------------------------------
1211 #define DEC_PYCALLBACK__STRING(CBNAME) \
1212 void CBNAME(const wxString& a)
1214 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1215 void CLASS::CBNAME(const wxString& a) { \
1217 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1218 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1219 PyObject* s = wx2PyString(a); \
1220 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1223 wxPyEndBlockThreads(blocked); \
1225 PCLASS::CBNAME(a); \
1228 //---------------------------------------------------------------------------
1230 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1231 bool CBNAME(const wxString& a)
1233 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1234 bool CLASS::CBNAME(const wxString& a) { \
1237 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1238 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1239 PyObject* s = wx2PyString(a); \
1240 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1243 wxPyEndBlockThreads(blocked); \
1245 rval = PCLASS::CBNAME(a); \
1249 //---------------------------------------------------------------------------
1251 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1252 bool CBNAME(const wxString& a)
1254 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1255 bool CLASS::CBNAME(const wxString& a) { \
1257 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1258 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1259 PyObject* s = wx2PyString(a); \
1260 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1263 wxPyEndBlockThreads(blocked); \
1267 //---------------------------------------------------------------------------
1269 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1270 wxString CBNAME(const wxString& a)
1272 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1273 wxString CLASS::CBNAME(const wxString& a) { \
1275 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1276 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1278 PyObject* s = wx2PyString(a); \
1279 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1282 rval = Py2wxString(ro); \
1286 wxPyEndBlockThreads(blocked); \
1290 //---------------------------------------------------------------------------
1292 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1293 wxString CBNAME(const wxString& a)
1295 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1296 wxString CLASS::CBNAME(const wxString& a) { \
1299 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1300 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1302 PyObject* s = wx2PyString(a); \
1303 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1306 rval = Py2wxString(ro); \
1310 wxPyEndBlockThreads(blocked); \
1312 rval = PCLASS::CBNAME(a); \
1316 //---------------------------------------------------------------------------
1318 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1319 wxString CBNAME(const wxString& a,int b)
1321 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1322 wxString CLASS::CBNAME(const wxString& a,int b) { \
1324 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1325 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1327 PyObject* s = wx2PyString(a); \
1328 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1331 rval = Py2wxString(ro); \
1335 wxPyEndBlockThreads(blocked); \
1339 //---------------------------------------------------------------------------
1341 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1342 bool CBNAME(const wxString& a, const wxString& b)
1344 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1345 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1348 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1349 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1350 PyObject* s1 = wx2PyString(a); \
1351 PyObject* s2 = wx2PyString(b); \
1352 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1356 wxPyEndBlockThreads(blocked); \
1358 rval = PCLASS::CBNAME(a, b); \
1362 //---------------------------------------------------------------------------
1364 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1367 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1368 wxString CLASS::CBNAME() { \
1371 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1372 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1374 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1376 rval = Py2wxString(ro); \
1380 wxPyEndBlockThreads(blocked); \
1382 rval = PCLASS::CBNAME(); \
1386 //---------------------------------------------------------------------------
1388 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1389 wxString CBNAME() const
1391 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1392 wxString CLASS::CBNAME() const { \
1395 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1396 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1398 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1400 rval = Py2wxString(ro); \
1404 wxPyEndBlockThreads(blocked); \
1406 rval = PCLASS::CBNAME(); \
1410 //---------------------------------------------------------------------------
1412 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1415 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1416 wxString CLASS::CBNAME() { \
1418 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1419 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1421 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1423 rval = Py2wxString(ro); \
1427 wxPyEndBlockThreads(blocked); \
1431 //---------------------------------------------------------------------------
1433 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1434 wxString CBNAME() const;
1436 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1437 wxString CLASS::CBNAME() const { \
1439 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1440 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1442 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1444 rval = Py2wxString(ro); \
1448 wxPyEndBlockThreads(blocked); \
1452 //---------------------------------------------------------------------------
1454 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1455 bool CBNAME(const wxHtmlTag& a)
1458 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1459 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1461 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1462 if (wxPyCBH_findCallback2(m_myInst, #CBNAME, false)) { \
1463 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1464 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1467 wxPyEndBlockThreads(blocked); \
1471 //---------------------------------------------------------------------------
1473 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1474 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1476 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1477 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1479 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1480 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1481 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1482 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1485 wxPyEndBlockThreads(blocked); \
1487 PCLASS::CBNAME(cell, x, y); \
1490 //---------------------------------------------------------------------------
1492 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1493 void CBNAME(const wxColour& c);
1495 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1496 void CLASS::CBNAME(const wxColour& c) { \
1498 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1499 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1500 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1501 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1504 wxPyEndBlockThreads(blocked); \
1506 PCLASS::CBNAME(c); \
1509 //---------------------------------------------------------------------------
1510 #define DEC_PYCALLBACK__INTCOLOUR(CBNAME) \
1511 void CBNAME(int a, const wxColour& c);
1513 #define IMP_PYCALLBACK__INTCOLOUR(CLASS, PCLASS, CBNAME) \
1514 void CLASS::CBNAME(int a, const wxColour& c) { \
1516 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1517 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1518 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1519 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1522 wxPyEndBlockThreads(blocked); \
1524 PCLASS::CBNAME(a, c); \
1527 //---------------------------------------------------------------------------
1529 #define DEC_PYCALLBACK__INTFONT(CBNAME) \
1530 void CBNAME(int a, const wxFont& c);
1532 #define IMP_PYCALLBACK__INTFONT(CLASS, PCLASS, CBNAME) \
1533 void CLASS::CBNAME(int a, const wxFont& c) { \
1535 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1536 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1537 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxFont"), 0); \
1538 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1541 wxPyEndBlockThreads(blocked); \
1543 PCLASS::CBNAME(a, c); \
1546 //---------------------------------------------------------------------------
1548 #define DEC_PYCALLBACK__FONT(CBNAME) \
1549 void CBNAME(const wxFont& a);
1551 #define IMP_PYCALLBACK__FONT(CLASS, PCLASS, CBNAME) \
1552 void CLASS::CBNAME(const wxFont& a) { \
1554 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1555 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1556 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxFont"), 0); \
1557 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); \
1560 wxPyEndBlockThreads(blocked); \
1562 PCLASS::CBNAME(a); \
1565 //---------------------------------------------------------------------------
1567 #define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
1568 bool CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1570 #define IMP_PYCALLBACK_BOOL_CELLINTINTME(CLASS, PCLASS, CBNAME) \
1571 bool CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1572 bool rval=false, found; \
1573 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1574 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1575 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1576 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1577 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1581 wxPyEndBlockThreads(blocked); \
1583 rval = PCLASS::CBNAME(cell, x, y, e); \
1588 //---------------------------------------------------------------------------
1590 #define DEC_PYCALLBACK___pure(CBNAME) \
1594 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1595 void CLASS::CBNAME() { \
1596 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1597 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1598 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1599 wxPyEndBlockThreads(blocked); \
1602 //---------------------------------------------------------------------------
1604 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1608 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1609 wxSize CLASS::CBNAME() { \
1610 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1612 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1613 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1616 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1618 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1620 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1622 PyObject* o1 = PySequence_GetItem(ro, 0); \
1623 PyObject* o2 = PySequence_GetItem(ro, 1); \
1624 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1625 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1627 PyErr_SetString(PyExc_TypeError, errmsg); \
1632 PyErr_SetString(PyExc_TypeError, errmsg); \
1637 wxPyEndBlockThreads(blocked); \
1641 //---------------------------------------------------------------------------
1643 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1644 bool CBNAME(wxWindow* a)
1647 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1648 bool CLASS::CBNAME(wxWindow* a) { \
1651 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1652 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1653 PyObject* obj = wxPyMake_wxObject(a,false); \
1654 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1657 wxPyEndBlockThreads(blocked); \
1659 rval = PCLASS::CBNAME(a); \
1665 #define DEC_PYCALLBACK_BOOL_WXWIN_pure(CBNAME) \
1666 bool CBNAME(wxWindow* a)
1668 #define IMP_PYCALLBACK_BOOL_WXWIN_pure(CLASS, PCLASS, CBNAME) \
1669 bool CLASS::CBNAME(wxWindow* a) { \
1672 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1673 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1674 PyObject* obj = wxPyMake_wxObject(a,false); \
1675 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1678 wxPyEndBlockThreads(blocked); \
1682 //---------------------------------------------------------------------------
1684 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1685 bool CBNAME(wxWindow* a, wxDC& b)
1688 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1689 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1692 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1693 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1694 PyObject* win = wxPyMake_wxObject(a,false); \
1695 PyObject* dc = wxPyMake_wxObject(&b,false); \
1696 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1700 wxPyEndBlockThreads(blocked); \
1702 rval = PCLASS::CBNAME(a, b); \
1706 //---------------------------------------------------------------------------
1708 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1709 void CBNAME(wxWindowBase* a)
1712 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1713 void CLASS::CBNAME(wxWindowBase* a) { \
1715 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1716 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1717 PyObject* obj = wxPyMake_wxObject(a,false); \
1718 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1721 wxPyEndBlockThreads(blocked); \
1723 PCLASS::CBNAME(a); \
1726 //---------------------------------------------------------------------------
1728 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1732 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1733 bool CLASS::CBNAME() { \
1736 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1737 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1738 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1739 wxPyEndBlockThreads(blocked); \
1741 rval = PCLASS::CBNAME(); \
1745 //---------------------------------------------------------------------------
1747 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1751 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1752 bool CLASS::CBNAME() const { \
1755 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1756 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1757 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1758 wxPyEndBlockThreads(blocked); \
1760 rval = PCLASS::CBNAME(); \
1764 //---------------------------------------------------------------------------
1766 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1767 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1770 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1771 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1774 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1775 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1776 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1777 wxPyEndBlockThreads(blocked); \
1779 rval = PCLASS::CBNAME(a, b, c); \
1780 return (wxDragResult)rval; \
1783 //---------------------------------------------------------------------------
1785 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1786 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1788 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1789 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1790 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1792 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1794 PyObject* obj = wxPyMake_wxObject(&a,false); \
1795 PyObject* s = wx2PyString(b); \
1796 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1799 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1800 /* release ownership of the C++ wx.FSFile object. */ \
1801 PyObject_SetAttrString(ro, "thisown", Py_False); \
1807 wxPyEndBlockThreads(blocked); \
1811 //---------------------------------------------------------------------------
1813 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1814 bool CBNAME(wxDragResult a)
1817 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1818 bool CLASS::CBNAME(wxDragResult a) { \
1821 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1822 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1823 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1824 wxPyEndBlockThreads(blocked); \
1826 rval = PCLASS::CBNAME(a); \
1830 //---------------------------------------------------------------------------
1832 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1833 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1836 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1837 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1838 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1840 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1841 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1842 wxPyEndBlockThreads(blocked); \
1843 return (wxDragResult)rval; \
1846 //---------------------------------------------------------------------------
1848 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1849 bool CBNAME(int a, int b, const wxString& c)
1851 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1852 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1854 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1855 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1856 PyObject* s = wx2PyString(c); \
1857 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1860 wxPyEndBlockThreads(blocked); \
1864 //---------------------------------------------------------------------------
1866 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1870 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1871 size_t CLASS::CBNAME() { \
1874 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1875 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1876 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1877 wxPyEndBlockThreads(blocked); \
1879 rval = PCLASS::CBNAME(); \
1883 //---------------------------------------------------------------------------
1885 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1886 size_t CBNAME() const
1889 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1890 size_t CLASS::CBNAME() const { \
1893 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1894 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1895 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1896 wxPyEndBlockThreads(blocked); \
1898 rval = PCLASS::CBNAME(); \
1902 //---------------------------------------------------------------------------
1904 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1905 wxDataFormat CBNAME(size_t a)
1908 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1909 wxDataFormat CLASS::CBNAME(size_t a) { \
1910 wxDataFormat rval=0; \
1912 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1913 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1915 wxDataFormat* ptr; \
1916 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1918 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1923 wxPyEndBlockThreads(blocked); \
1925 rval = PCLASS::CBNAME(a); \
1929 //---------------------------------------------------------------------------
1931 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1932 void CBNAME(const Type& a)
1935 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1936 void CLASS::CBNAME(const Type& a) { \
1938 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1939 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1940 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1941 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1944 wxPyEndBlockThreads(blocked); \
1946 PCLASS::CBNAME(a); \
1950 //---------------------------------------------------------------------------
1952 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1953 void CBNAME(Type& a)
1956 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1957 void CLASS::CBNAME(Type& a) { \
1959 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1960 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1961 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1962 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1965 wxPyEndBlockThreads(blocked); \
1967 PCLASS::CBNAME(a); \
1970 //---------------------------------------------------------------------------
1972 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1973 bool CBNAME(Type& a)
1976 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1977 bool CLASS::CBNAME(Type& a) { \
1980 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1981 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1982 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1983 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1986 wxPyEndBlockThreads(blocked); \
1988 rv = PCLASS::CBNAME(a); \
1992 //---------------------------------------------------------------------------
1994 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1995 bool CBNAME(Type& a)
1998 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
1999 bool CLASS::CBNAME(Type& a) { \
2001 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2002 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2003 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2004 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2007 wxPyEndBlockThreads(blocked); \
2011 //---------------------------------------------------------------------------
2013 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2014 wxString CBNAME(long a, long b) const
2016 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2017 wxString CLASS::CBNAME(long a, long b) const { \
2020 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2021 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2023 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2025 rval = Py2wxString(ro); \
2029 wxPyEndBlockThreads(blocked); \
2031 rval = PCLASS::CBNAME(a,b); \
2035 //---------------------------------------------------------------------------
2037 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2038 int CBNAME(long a) const
2041 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2042 int CLASS::CBNAME(long a) const { \
2045 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2046 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2048 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2050 rval = PyInt_AsLong(ro); \
2054 wxPyEndBlockThreads(blocked); \
2056 rval = PCLASS::CBNAME(a); \
2061 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2062 int CBNAME(long a) const;
2065 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2066 int CLASS::CBNAME(long a) const { \
2067 int rval=-1; /* this rval is important for OnGetItemImage */ \
2069 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2070 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2072 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2074 rval = PyInt_AsLong(ro); \
2078 wxPyEndBlockThreads(blocked); \
2083 //---------------------------------------------------------------------------
2085 #define DEC_PYCALLBACK_INT_INT(CBNAME) \
2089 #define IMP_PYCALLBACK_INT_INT(CLASS, PCLASS, CBNAME) \
2090 int CLASS::CBNAME(int a) { \
2093 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2094 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2096 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
2098 rval = PyInt_AsLong(ro); \
2102 wxPyEndBlockThreads(blocked); \
2104 rval = PCLASS::CBNAME(a); \
2108 //---------------------------------------------------------------------------
2110 #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
2111 int CBNAME(long a, long b) const
2114 #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \
2115 int CLASS::CBNAME(long a, long b) const { \
2118 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2119 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2121 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2123 rval = PyInt_AsLong(ro); \
2127 wxPyEndBlockThreads(blocked); \
2129 rval = PCLASS::CBNAME(a, b); \
2134 #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \
2135 int CBNAME(long a, long b) const;
2138 #define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME) \
2139 int CLASS::CBNAME(long a, long b) const { \
2140 int rval=-1; /* this rval is important for OnGetItemImage */ \
2142 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2143 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2145 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2147 rval = PyInt_AsLong(ro); \
2151 wxPyEndBlockThreads(blocked); \
2156 //---------------------------------------------------------------------------
2158 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2159 wxListItemAttr* CBNAME(long a) const
2162 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2163 wxListItemAttr *CLASS::CBNAME(long a) const { \
2164 wxListItemAttr *rval = NULL; \
2166 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2167 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2169 wxListItemAttr* ptr; \
2170 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2172 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2177 wxPyEndBlockThreads(blocked); \
2179 rval = PCLASS::CBNAME(a); \
2183 //---------------------------------------------------------------------------
2185 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2186 bool CBNAME(wxMouseEvent& e)
2188 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2189 bool CLASS::CBNAME(wxMouseEvent& e) { \
2192 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2193 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2195 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2196 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2198 rval = PyInt_AsLong(ro); \
2203 wxPyEndBlockThreads(blocked); \
2205 return PCLASS::CBNAME(e); \
2209 //---------------------------------------------------------------------------
2211 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2212 wxWizardPage* CBNAME() const
2214 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2215 wxWizardPage* CLASS::CBNAME() const { \
2216 wxWizardPage* rv = NULL; \
2217 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2218 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2220 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2222 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2226 wxPyEndBlockThreads(blocked); \
2230 //---------------------------------------------------------------------------
2232 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2233 wxBitmap CBNAME() const
2235 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2236 wxBitmap CLASS::CBNAME() const { \
2238 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2239 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2242 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2244 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2249 wxPyEndBlockThreads(blocked); \
2253 //---------------------------------------------------------------------------
2255 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2258 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2259 wxObject* CLASS::CBNAME() { \
2260 wxObject* rv = NULL; \
2261 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2262 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2264 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2266 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2270 wxPyEndBlockThreads(blocked); \
2274 //---------------------------------------------------------------------------
2276 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2277 wxObject* CBNAME(const wxString& a)
2279 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2280 wxObject* CLASS::CBNAME(const wxString& a) { \
2281 wxObject* rv = NULL; \
2282 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2283 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2284 PyObject* so = wx2PyString(a); \
2286 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2288 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2293 wxPyEndBlockThreads(blocked); \
2297 //---------------------------------------------------------------------------
2299 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2300 bool CBNAME(wxXmlNode* a)
2303 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2304 bool CLASS::CBNAME(wxXmlNode* a) { \
2306 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2307 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2308 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2309 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2312 wxPyEndBlockThreads(blocked); \
2316 //---------------------------------------------------------------------------
2318 #define DEC_PYCALLBACK_COORD_SIZET_const(CBNAME) \
2319 wxCoord CBNAME(size_t a) const
2321 #define IMP_PYCALLBACK_COORD_SIZET_const(CLASS, PCLASS, CBNAME) \
2322 wxCoord CLASS::CBNAME(size_t a) const { \
2325 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2326 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2327 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2329 wxPyEndBlockThreads(blocked); \
2331 rval = PCLASS::CBNAME(a); \
2336 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2337 wxCoord CBNAME(size_t a) const
2339 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2340 wxCoord CLASS::CBNAME(size_t a) const { \
2343 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2344 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2345 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2347 wxPyEndBlockThreads(blocked); \
2351 //---------------------------------------------------------------------------
2353 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2354 void CBNAME(size_t a, size_t b) const
2357 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2358 void CLASS::CBNAME(size_t a, size_t b) const { \
2360 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2361 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2362 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2363 wxPyEndBlockThreads(blocked); \
2365 PCLASS::CBNAME(a,b); \
2367 //---------------------------------------------------------------------------
2369 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2370 wxCoord CBNAME() const
2373 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2374 wxCoord CLASS::CBNAME() const { \
2377 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2378 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2379 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2380 wxPyEndBlockThreads(blocked); \
2382 rval = PCLASS::CBNAME(); \
2386 //---------------------------------------------------------------------------
2388 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2389 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2391 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2392 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2394 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2395 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2396 PyObject* obj = wxPyMake_wxObject(&a,false); \
2397 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2398 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2399 Py_DECREF(obj); Py_DECREF(ro); \
2401 wxPyEndBlockThreads(blocked); \
2406 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2407 void CBNAME(wxDC& a, const wxRect& b, size_t c) const
2409 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2410 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2412 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2413 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2414 PyObject* obj = wxPyMake_wxObject(&a,false); \
2415 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2416 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2417 Py_DECREF(obj); Py_DECREF(ro); \
2419 wxPyEndBlockThreads(blocked); \
2421 PCLASS::CBNAME(a,b,c); \
2425 //---------------------------------------------------------------------------
2426 // Same as the above set, but the wxRect is not const
2428 #define DEC_PYCALLBACK__DCRECTSIZET2_constpure(CBNAME) \
2429 void CBNAME(wxDC& a, wxRect& b, size_t c) const;
2431 #define IMP_PYCALLBACK__DCRECTSIZET2_constpure(CLASS, PCLASS, CBNAME) \
2432 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2434 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2435 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2436 PyObject* obj = wxPyMake_wxObject(&a,false); \
2437 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2438 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2439 Py_DECREF(obj); Py_DECREF(ro); \
2441 wxPyEndBlockThreads(blocked); \
2446 #define DEC_PYCALLBACK__DCRECTSIZET2_const(CBNAME) \
2447 void CBNAME(wxDC& a, wxRect& b, size_t c) const
2449 #define IMP_PYCALLBACK__DCRECTSIZET2_const(CLASS, PCLASS, CBNAME) \
2450 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2452 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2453 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2454 PyObject* obj = wxPyMake_wxObject(&a,false); \
2455 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2456 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2457 Py_DECREF(obj); Py_DECREF(ro); \
2459 wxPyEndBlockThreads(blocked); \
2461 PCLASS::CBNAME(a,b,c); \
2464 //---------------------------------------------------------------------------
2466 #define DEC_PYCALLBACK__DCRECTINTINT_const(CBNAME) \
2467 void CBNAME(wxDC& a, const wxRect& b, int c, int d) const
2469 #define IMP_PYCALLBACK__DCRECTINTINT_const(CLASS, PCLASS, CBNAME) \
2470 void CLASS::CBNAME(wxDC& a, const wxRect& b, int c, int d) const { \
2472 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2473 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2474 PyObject* obj = wxPyMake_wxObject(&a,false); \
2475 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2476 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOii)", obj, ro, c, d)); \
2477 Py_DECREF(obj); Py_DECREF(ro); \
2479 wxPyEndBlockThreads(blocked); \
2481 PCLASS::CBNAME(a,b,c,d); \
2485 //---------------------------------------------------------------------------
2487 #define DEC_PYCALLBACK__RECTINT(CBNAME) \
2488 void CBNAME(const wxRect& a, int b)
2490 #define IMP_PYCALLBACK__RECTINT(CLASS, PCLASS, CBNAME) \
2491 void CLASS::CBNAME(const wxRect& a, int b) { \
2493 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2494 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2495 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2496 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b)); \
2499 wxPyEndBlockThreads(blocked); \
2501 PCLASS::CBNAME(a,b); \
2505 #define DEC_PYCALLBACK_BOOL_RECTINT(CBNAME) \
2506 bool CBNAME(const wxRect& a, int b)
2508 #define IMP_PYCALLBACK_BOOL_RECTINT(CLASS, PCLASS, CBNAME) \
2509 bool CLASS::CBNAME(const wxRect& a, int b) { \
2511 bool rval = false; \
2512 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2513 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2514 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2515 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b));\
2518 wxPyEndBlockThreads(blocked); \
2520 rval = PCLASS::CBNAME(a,b); \
2525 //---------------------------------------------------------------------------
2527 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2528 wxString CBNAME(size_t a) const
2530 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2531 wxString CLASS::CBNAME(size_t a) const { \
2534 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2535 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2537 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2539 rval = Py2wxString(ro); \
2543 wxPyEndBlockThreads(blocked); \
2545 rval = PCLASS::CBNAME(a); \
2549 //---------------------------------------------------------------------------
2551 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2552 wxString CBNAME(size_t a) const
2554 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2555 wxString CLASS::CBNAME(size_t a) const { \
2558 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2559 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2561 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2563 rval = Py2wxString(ro); \
2567 wxPyEndBlockThreads(blocked); \
2571 //---------------------------------------------------------------------------
2573 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2574 wxVisualAttributes CBNAME() const
2577 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2578 wxVisualAttributes CLASS::CBNAME() const { \
2579 wxVisualAttributes rval; \
2581 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2582 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2584 wxVisualAttributes* ptr; \
2585 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2587 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2592 wxPyEndBlockThreads(blocked); \
2594 rval = PCLASS::CBNAME(); \
2598 //---------------------------------------------------------------------------
2600 #define DEC_PYCALLBACK_FONT_INT(CBNAME) \
2601 wxFont CBNAME(int a)
2603 #define IMP_PYCALLBACK_FONT_INT(CLASS, PCLASS, CBNAME) \
2604 wxFont CLASS::CBNAME(int a) { \
2607 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2608 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2611 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2613 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxFont"))) \
2618 wxPyEndBlockThreads(blocked); \
2620 rv = PCLASS::CBNAME(a); \
2624 //---------------------------------------------------------------------------
2626 #define DEC_PYCALLBACK_COLOUR_INT(CBNAME) \
2627 wxColour CBNAME(int a)
2629 #define IMP_PYCALLBACK_COLOUR_INT(CLASS, PCLASS, CBNAME) \
2630 wxColour CLASS::CBNAME(int a) { \
2633 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2634 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2637 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2639 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxColour"))) \
2644 wxPyEndBlockThreads(blocked); \
2646 rv = PCLASS::CBNAME(a); \
2650 //---------------------------------------------------------------------------