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>
82 #include <wx/srchctrl.h>
86 # pragma warning(disable:4800)
87 # pragma warning(disable:4190)
90 #ifdef __WXMAC__ // avoid a bug in Carbon headers
94 //---------------------------------------------------------------------------
96 #ifndef wxHAS_POWER_EVENTS
97 class wxPowerEvent
: public wxEvent
100 wxPowerEvent(wxEventType evtType
) : wxEvent(wxID_NONE
, evtType
) {}
102 bool IsVetoed() const { return false; }
103 virtual wxEvent
*Clone() const { return new wxPowerEvent(*this); }
107 //---------------------------------------------------------------------------
108 typedef unsigned char byte
;
109 typedef unsigned char* buffer
;
111 typedef wxPoint2DDouble wxPoint2D
;
112 typedef wxRect2DDouble wxRect2D
;
114 #ifndef SWIG_TYPE_TABLE
115 #define SWIG_TYPE_TABLE wxPython_type_table
119 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
121 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
125 #ifndef wxPyUSE_EXPORTED_API
127 void __wxPyPreStart(PyObject
*);
128 void __wxPyCleanup();
129 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
131 void wxSetDefaultPyEncoding(const char* encoding
);
132 const char* wxGetDefaultPyEncoding();
135 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
138 bool wxPyCheckSwigType(const wxChar
* className
);
139 PyObject
* wxPyConstructObject(void* ptr
,
140 const wxChar
* className
,
142 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
143 const wxChar
* className
);
144 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
147 PyObject
* wx2PyString(const wxString
& src
);
148 wxString
Py2wxString(PyObject
* source
);
150 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
151 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
152 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
154 PyObject
* wxPy_ConvertList(wxListBase
* list
);
155 long wxPyGetWinHandle(wxWindow
* win
);
157 void wxPy_ReinitStockObjects(int pass
);
159 bool wxPyInstance_Check(PyObject
* obj
);
160 bool wxPySwigInstance_Check(PyObject
* obj
);
163 #endif // wxPyUSE_EXPORTED_API
164 //---------------------------------------------------------------------------
166 // if we want to handle threads and Python threads are available...
167 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
168 #define WXP_WITH_THREAD
169 #else // no Python threads...
170 #undef WXP_WITH_THREAD
174 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
175 // blocking threads when calling back into Python. Using them instead of my
176 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
177 // wxPyEndBlockThreads.
179 // Unfortunatly there is a bug somewhere when using these new APIs on Python
180 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
181 // at breakpoints located in event handlers. I think that the cause may be
182 // something like the original PyThreadState for the main thread is not being
183 // restored for the callbacks, but I can't see where that could be
184 // happening... So we'll only activate this new change for Python 2.4+ :-(
186 #if PY_VERSION_HEX < 0x02040000
187 #define wxPyUSE_GIL_STATE 0
188 typedef bool wxPyBlock_t
;
189 #define wxPyBlock_t_default false
191 #define wxPyUSE_GIL_STATE 1
192 typedef PyGILState_STATE wxPyBlock_t
;
193 #define wxPyBlock_t_default PyGILState_UNLOCKED
197 // Python 2.5 changes the type of some API parameter and return types. Using
198 // this typedef for versions < 2.5 will help with the transition...
199 #if PY_VERSION_HEX < 0x02050000
200 typedef int Py_ssize_t
;
204 #ifndef wxPyUSE_EXPORTED_API
206 // For Python --> C++
207 PyThreadState
* wxPyBeginAllowThreads();
208 void wxPyEndAllowThreads(PyThreadState
* state
);
210 // For C++ --> Python
211 wxPyBlock_t
wxPyBeginBlockThreads();
212 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
214 #endif // wxPyUSE_EXPORTED_API
217 // A macro that will help to execute simple statments wrapped in
218 // StartBlock/EndBlockThreads calls
219 #define wxPyBLOCK_THREADS(stmt) \
220 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
222 // Raise the NotImplementedError exception (blocking threads)
223 #define wxPyRaiseNotImplemented() \
224 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
226 // Raise any exception with a string value (blocking threads)
227 #define wxPyErr_SetString(err, str) \
228 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
231 //---------------------------------------------------------------------------
232 // These are helpers used by the typemaps
234 #ifndef wxPyUSE_EXPORTED_API
236 wxString
* wxString_in_helper(PyObject
* source
);
238 byte
* byte_LIST_helper(PyObject
* source
);
239 int* int_LIST_helper(PyObject
* source
);
240 long* long_LIST_helper(PyObject
* source
);
241 char** string_LIST_helper(PyObject
* source
);
242 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
243 wxPoint2D
* wxPoint2D_LIST_helper(PyObject
* source
, size_t* npoints
);
244 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
245 wxString
* wxString_LIST_helper(PyObject
* source
);
246 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
247 wxPen
** wxPen_LIST_helper(PyObject
* source
);
249 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
250 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
251 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
252 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
253 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
254 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
255 bool wxRect2D_helper(PyObject
* source
, wxRect2D
** obj
);
256 bool wxPosition_helper(PyObject
* source
, wxPosition
** obj
);
259 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
260 bool wxColour_typecheck(PyObject
* source
);
263 // Other helpful stuff
264 bool wxPyCheckForApp();
265 bool wxPyTestDisplayAvailable();
267 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
268 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
270 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
271 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
272 PyObject
* wxArrayDouble2PyList_helper(const wxArrayDouble
& arr
);
274 #endif // wxPyUSE_EXPORTED_API
276 //---------------------------------------------------------------------------
278 #if PYTHON_API_VERSION < 1009
279 #define PySequence_Fast_GET_ITEM(o, i) \
280 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
283 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
284 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
285 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
287 //---------------------------------------------------------------------------
289 #ifndef wxPyUSE_EXPORTED_API
291 class wxPyCallback
: public wxObject
{
292 DECLARE_ABSTRACT_CLASS(wxPyCallback
)
294 wxPyCallback(PyObject
* func
);
295 wxPyCallback(const wxPyCallback
& other
);
298 void EventThunker(wxEvent
& event
);
303 #endif // wxPyUSE_EXPORTED_API
304 //---------------------------------------------------------------------------
305 //---------------------------------------------------------------------------
306 // These Event classes can be derived from in Python and passed through the
307 // event system without loosing anything. They do this by keeping a reference
308 // to themselves and some special case handling in wxPyCallback::EventThunker.
312 class wxPyEvtSelfRef
{
317 void SetSelf(PyObject
* self
, bool clone
=false);
318 PyObject
* GetSelf() const;
319 bool GetCloned() const { return m_cloned
; }
327 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
328 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
330 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
331 wxPyEvent(const wxPyEvent
& evt
);
334 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
338 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
339 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
341 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
342 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
345 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
350 //----------------------------------------------------------------------
351 // Forward decalre a few things used in the exported API
352 class wxPyClientData
;
354 class wxPyOORClientData
;
355 class wxPyCBInputStream
;
357 void wxPyClientData_dtor(wxPyClientData
* self
);
358 void wxPyUserData_dtor(wxPyUserData
* self
);
359 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
360 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
361 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
363 //---------------------------------------------------------------------------
364 // Export a C API in a struct. Other modules will be able to load this from
365 // the wx.core module and will then have safe access to these functions, even if
366 // in another shared library.
368 class wxPyCallbackHelper
;
372 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
373 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
374 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
375 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
377 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
378 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
379 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
380 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
382 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
384 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
385 wxString (*p_Py2wxString
)(PyObject
* source
);
386 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
388 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
389 int* (*p_int_LIST_helper
)(PyObject
* source
);
390 long* (*p_long_LIST_helper
)(PyObject
* source
);
391 char** (*p_string_LIST_helper
)(PyObject
* source
);
392 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
393 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
394 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
395 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
397 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
398 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
399 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
400 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
401 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
402 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2D
** obj
);
405 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
406 bool (*p_wxColour_typecheck
)(PyObject
* source
);
408 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
409 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
);
410 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
411 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
412 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
414 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
415 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
416 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
417 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
418 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
419 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
420 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
422 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
423 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
424 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
426 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
427 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
429 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
430 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
432 bool (*p_wxPyCheckForApp
)();
434 // Add all new items at the end...
435 PyObject
* (*p_wxArrayDoublePyList_helper
)(const wxArrayDouble
& arr
);
436 wxPoint2D
* (*p_wxPoint2D_LIST_helper
)(PyObject
* source
, size_t* npoints
);
437 bool (*p_wxRect2D_helper
)(PyObject
* source
, wxRect2D
** obj
);
438 bool (*p_wxPosition_helper
)(PyObject
* source
, wxPosition
** obj
);
443 #ifdef wxPyUSE_EXPORTED_API
444 // Notice that this is static, not extern. This is by design, each module
445 // needs one, but doesn't have to use it.
446 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
447 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
448 #endif // wxPyUSE_EXPORTED_API
450 //---------------------------------------------------------------------------
452 // A wxObject that holds a reference to a Python object
453 class wxPyUserData
: public wxObject
{
455 wxPyUserData(PyObject
* obj
) {
461 #ifdef wxPyUSE_EXPORTED_API
462 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
464 wxPyUserData_dtor(this);
471 // A wxClientData that holds a refernece to a Python object
472 class wxPyClientData
: public wxClientData
{
474 wxPyClientData(PyObject
* obj
, bool incref
=true) {
482 #ifdef wxPyUSE_EXPORTED_API
483 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
485 wxPyClientData_dtor(this);
493 // Just like wxPyClientData, except when this object is destroyed it does some
494 // OOR magic on the Python Object.
495 class wxPyOORClientData
: public wxPyClientData
{
497 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
498 : wxPyClientData(obj
, incref
) {}
499 ~wxPyOORClientData() {
501 #ifdef wxPyUSE_EXPORTED_API
502 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
504 wxPyOORClientData_dtor(this);
510 //---------------------------------------------------------------------------
511 // A wxImageHandler that can be derived from in Python.
514 class wxPyImageHandler
: public wxImageHandler
{
518 // used for interning method names as PyStrings
519 static PyObject
* m_DoCanRead_Name
;
520 static PyObject
* m_GetImageCount_Name
;
521 static PyObject
* m_LoadFile_Name
;
522 static PyObject
* m_SaveFile_Name
;
524 // converstion helpers
525 PyObject
* py_InputStream(wxInputStream
* stream
);
526 PyObject
* py_Image(wxImage
* image
);
527 PyObject
* py_OutputStream(wxOutputStream
* stream
);
532 void _SetSelf(PyObject
*self
);
534 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
535 bool verbose
=true, int index
=-1 );
536 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
538 virtual int GetImageCount(wxInputStream
& stream
);
539 virtual bool DoCanRead(wxInputStream
&stream
);
543 //---------------------------------------------------------------------------
544 // This class holds an instance of a Python Shadow Class object and assists
545 // with looking up and invoking Python callback methods from C++ virtual
546 // method redirections. For all classes which have virtuals which should be
547 // overridable in wxPython, a new subclass is created that contains a
548 // wxPyCallbackHelper.
551 class wxPyCallbackHelper
{
553 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
555 wxPyCallbackHelper() {
562 ~wxPyCallbackHelper() {
563 #ifdef wxPyUSE_EXPORTED_API
564 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
566 wxPyCBH_delete(this);
570 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
571 bool findCallback(const char* name
, bool setGuard
=true) const;
572 int callCallback(PyObject
* argTuple
) const;
573 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
574 PyObject
* GetLastFound() const { return m_lastFound
; }
576 void setRecursionGuard(PyObject
* method
) const;
577 void clearRecursionGuard(PyObject
* method
) const;
582 PyObject
* m_lastFound
;
585 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
589 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
590 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
=true);
591 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
592 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
593 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
598 //---------------------------------------------------------------------------
600 // This is used in C++ classes that need to be able to make callback to
601 // "overloaded" python methods
604 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
605 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
607 private: wxPyCallbackHelper m_myInst
610 //---------------------------------------------------------------------------
611 // The wxPythonApp class
614 wxPYAPP_ASSERT_SUPPRESS
= 1,
615 wxPYAPP_ASSERT_EXCEPTION
= 2,
616 wxPYAPP_ASSERT_DIALOG
= 4,
617 wxPYAPP_ASSERT_LOG
= 8
620 class wxPyApp
: public wxApp
622 DECLARE_ABSTRACT_CLASS(wxPyApp
)
630 int GetAssertMode() { return m_assertMode
; }
631 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
633 virtual bool OnInitGui();
634 virtual int OnExit();
636 virtual void OnAssertFailure(const wxChar
*file
,
642 virtual void ExitMainLoop();
643 // virtual int FilterEvent(wxEvent& event); // This one too????
645 // For catching Apple Events
646 virtual void MacOpenFile(const wxString
& fileName
);
647 virtual void MacOpenURL(const wxString
& url
);
648 virtual void MacPrintFile(const wxString
& fileName
);
649 virtual void MacNewFile();
650 virtual void MacReopenApp();
652 static bool GetMacSupportPCMenuShortcuts();
653 static long GetMacAboutMenuItemId();
654 static long GetMacPreferencesMenuItemId();
655 static long GetMacExitMenuItemId();
656 static wxString
GetMacHelpMenuTitleName();
658 static void SetMacSupportPCMenuShortcuts(bool val
);
659 static void SetMacAboutMenuItemId(long val
);
660 static void SetMacPreferencesMenuItemId(long val
);
661 static void SetMacExitMenuItemId(long val
);
662 static void SetMacHelpMenuTitleName(const wxString
& val
);
665 void _BootstrapApp();
667 // implementation only
668 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
672 bool m_startupComplete
;
675 extern wxPyApp
*wxPythonApp
;
678 //----------------------------------------------------------------------
679 // These macros are used to implement the virtual methods that should
680 // redirect to a Python method if one exists. The names designate the
681 // return type, if any, as well as any parameter types.
682 //---------------------------------------------------------------------------
684 #define DEC_PYCALLBACK__(CBNAME) \
688 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
689 void CLASS::CBNAME() { \
691 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
692 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
693 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
694 wxPyEndBlockThreads(blocked); \
699 #define DEC_PYCALLBACK_VOID_(CBNAME) \
700 DEC_PYCALLBACK__(CBNAME)
702 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
703 IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)
705 //---------------------------------------------------------------------------
707 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
708 bool CBNAME(int a, int b)
711 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
712 bool CLASS::CBNAME(int a, int b) { \
713 bool rval=false, found; \
714 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
715 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
716 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
717 wxPyEndBlockThreads(blocked); \
719 rval = PCLASS::CBNAME(a,b); \
723 //---------------------------------------------------------------------------
725 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
726 void CBNAME(int a, int b)
729 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
730 void CLASS::CBNAME(int a, int b) { \
732 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
733 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
734 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
735 wxPyEndBlockThreads(blocked); \
737 PCLASS::CBNAME(a,b); \
740 //---------------------------------------------------------------------------
742 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
746 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
747 void CLASS::CBNAME(int a) { \
749 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
750 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
751 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
752 wxPyEndBlockThreads(blocked); \
757 //---------------------------------------------------------------------------
759 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
760 void CBNAME(int a, int b, int c, int d)
763 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
764 void CLASS::CBNAME(int a, int b, int c, int d) { \
766 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
767 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
768 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
769 wxPyEndBlockThreads(blocked); \
771 PCLASS::CBNAME(a,b,c,d); \
774 //---------------------------------------------------------------------------
775 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
776 void CBNAME(int a, int b, int c, int d, int e)
779 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
780 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
782 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
783 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
784 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
785 wxPyEndBlockThreads(blocked); \
787 PCLASS::CBNAME(a,b,c,d,e); \
790 //---------------------------------------------------------------------------
792 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
793 void CBNAME(int* a, int* b) const
796 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
797 void CLASS::CBNAME(int* a, int* b) const { \
798 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
800 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
801 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
803 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
805 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
806 PyObject* o1 = PySequence_GetItem(ro, 0); \
807 PyObject* o2 = PySequence_GetItem(ro, 1); \
808 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
809 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
812 PyErr_SetString(PyExc_TypeError, errmsg); \
817 PyErr_SetString(PyExc_TypeError, errmsg); \
822 wxPyEndBlockThreads(blocked); \
824 PCLASS::CBNAME(a,b); \
827 //---------------------------------------------------------------------------
829 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
830 wxSize CBNAME() const
833 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
834 wxSize CLASS::CBNAME() const { \
835 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
836 bool found; wxSize rval(0,0); \
837 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
838 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
840 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
842 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
843 PyObject* o1 = PySequence_GetItem(ro, 0); \
844 PyObject* o2 = PySequence_GetItem(ro, 1); \
845 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
846 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
849 PyErr_SetString(PyExc_TypeError, errmsg); \
854 PyErr_SetString(PyExc_TypeError, errmsg); \
859 wxPyEndBlockThreads(blocked); \
861 return PCLASS::CBNAME(); \
866 //---------------------------------------------------------------------------
868 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
872 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
873 bool CLASS::CBNAME(bool a) { \
874 bool rval=false, found; \
875 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
876 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
877 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
878 wxPyEndBlockThreads(blocked); \
880 rval = PCLASS::CBNAME(a); \
884 //---------------------------------------------------------------------------
886 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
890 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
891 bool CLASS::CBNAME(int a) { \
892 bool rval=false, found; \
893 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
894 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
895 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
896 wxPyEndBlockThreads(blocked); \
898 rval = PCLASS::CBNAME(a); \
902 //---------------------------------------------------------------------------
904 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
908 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
909 bool CLASS::CBNAME(int a) { \
911 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
912 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
913 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
915 wxPyEndBlockThreads(blocked); \
920 //---------------------------------------------------------------------------
922 #define DEC_PYCALLBACK_INT_WIN(CBNAME) \
923 int CBNAME(wxWindow* a)
926 #define IMP_PYCALLBACK_INT_WIN(CLASS, PCLASS, CBNAME) \
927 int CLASS::CBNAME(wxWindow* a) { \
930 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
931 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
932 PyObject* obj = wxPyMake_wxObject(a, false); \
933 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)",obj)); \
936 wxPyEndBlockThreads(blocked); \
938 rval = PCLASS::CBNAME(a); \
943 //---------------------------------------------------------------------------
945 #define DEC_PYCALLBACK__DC(CBNAME) \
949 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
950 void CLASS::CBNAME(wxDC& a) { \
952 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
953 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
954 PyObject* obj = wxPyMake_wxObject(&a,false); \
955 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
958 wxPyEndBlockThreads(blocked); \
964 //---------------------------------------------------------------------------
966 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
967 void CBNAME(wxDC& a, bool b)
970 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
971 void CLASS::CBNAME(wxDC& a, bool b) { \
973 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
974 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
975 PyObject* obj = wxPyMake_wxObject(&a,false); \
976 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
979 wxPyEndBlockThreads(blocked); \
981 PCLASS::CBNAME(a, b); \
984 //---------------------------------------------------------------------------
986 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
987 void CBNAME(wxDC& a, bool b)
990 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
991 void CLASS::CBNAME(wxDC& a, bool b) { \
993 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
994 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
995 PyObject* obj = wxPyMake_wxObject(&a,false); \
996 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
999 wxPyEndBlockThreads(blocked); \
1001 PCLASS::CBNAME(a, b); \
1004 //---------------------------------------------------------------------------
1006 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1007 void CBNAME(double a, double b)
1010 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1011 void CLASS::CBNAME(double a, double b) { \
1013 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1014 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1015 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1016 wxPyEndBlockThreads(blocked); \
1018 PCLASS::CBNAME(a, b); \
1021 //---------------------------------------------------------------------------
1023 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1024 void CBNAME(double a, double b, int c, int d)
1027 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1028 void CLASS::CBNAME(double a, double b, int c, int d) { \
1030 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1031 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1032 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1034 wxPyEndBlockThreads(blocked); \
1036 PCLASS::CBNAME(a, b, c, d); \
1039 //---------------------------------------------------------------------------
1041 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1042 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1045 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1046 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1048 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1049 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1050 PyObject* obj = wxPyMake_wxObject(&a,false); \
1051 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1054 wxPyEndBlockThreads(blocked); \
1056 PCLASS::CBNAME(a, b, c, d, e, f); \
1059 //---------------------------------------------------------------------------
1061 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1062 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1065 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1066 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1068 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1070 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1071 PyObject* obj = wxPyMake_wxObject(&a,false); \
1072 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1075 wxPyEndBlockThreads(blocked); \
1077 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1081 //---------------------------------------------------------------------------
1083 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1084 void CBNAME(bool a, double b, double c, int d, int e)
1087 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1088 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1090 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1091 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1092 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1094 wxPyEndBlockThreads(blocked); \
1096 PCLASS::CBNAME(a, b, c, d, e); \
1099 //---------------------------------------------------------------------------
1101 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1102 void CBNAME(wxDC& a, double b, double c, double d, double e)
1105 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1106 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1108 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1109 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1110 PyObject* obj = wxPyMake_wxObject(&a,false); \
1111 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1114 wxPyEndBlockThreads(blocked); \
1116 PCLASS::CBNAME(a, b, c, d, e); \
1119 //---------------------------------------------------------------------------
1121 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1122 void CBNAME(wxDC& a, bool b)
1125 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1126 void CLASS::CBNAME(wxDC& a, bool b) { \
1128 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1129 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1130 PyObject* obj = wxPyMake_wxObject(&a,false); \
1131 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1134 wxPyEndBlockThreads(blocked); \
1136 PCLASS::CBNAME(a, b); \
1139 //---------------------------------------------------------------------------
1141 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1142 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1145 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1146 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1149 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1150 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1151 PyObject* obj = wxPyMake_wxObject(a,false); \
1152 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1155 wxPyEndBlockThreads(blocked); \
1157 PCLASS::CBNAME(a, b, c, d, e, f); \
1160 //---------------------------------------------------------------------------
1162 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1163 void CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1166 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1167 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1169 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1170 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1171 PyObject* obj = wxPyMake_wxObject(a,false); \
1172 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1175 wxPyEndBlockThreads(blocked); \
1177 PCLASS::CBNAME(a, b, c, d, e); \
1180 //---------------------------------------------------------------------------
1182 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1183 void CBNAME(double a, double b, int c)
1186 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1187 void CLASS::CBNAME(double a, double b, int c) { \
1189 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1190 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1191 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1192 wxPyEndBlockThreads(blocked); \
1194 PCLASS::CBNAME(a, b, c); \
1197 //---------------------------------------------------------------------------
1199 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1200 void CBNAME(bool a, double b, double c, int d)
1203 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1204 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1206 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1207 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1208 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1209 wxPyEndBlockThreads(blocked); \
1211 PCLASS::CBNAME(a, b, c, d); \
1214 //---------------------------------------------------------------------------
1215 //---------------------------------------------------------------------------
1217 #define DEC_PYCALLBACK__STRING(CBNAME) \
1218 void CBNAME(const wxString& a)
1220 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1221 void CLASS::CBNAME(const wxString& a) { \
1223 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1224 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1225 PyObject* s = wx2PyString(a); \
1226 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1229 wxPyEndBlockThreads(blocked); \
1231 PCLASS::CBNAME(a); \
1234 //---------------------------------------------------------------------------
1236 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1237 bool CBNAME(const wxString& a)
1239 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1240 bool CLASS::CBNAME(const wxString& a) { \
1243 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1244 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1245 PyObject* s = wx2PyString(a); \
1246 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1249 wxPyEndBlockThreads(blocked); \
1251 rval = PCLASS::CBNAME(a); \
1255 //---------------------------------------------------------------------------
1257 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1258 bool CBNAME(const wxString& a)
1260 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1261 bool CLASS::CBNAME(const wxString& a) { \
1263 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1264 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1265 PyObject* s = wx2PyString(a); \
1266 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1269 wxPyEndBlockThreads(blocked); \
1273 //---------------------------------------------------------------------------
1275 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1276 wxString CBNAME(const wxString& a)
1278 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1279 wxString CLASS::CBNAME(const wxString& a) { \
1281 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1282 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1284 PyObject* s = wx2PyString(a); \
1285 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1288 rval = Py2wxString(ro); \
1292 wxPyEndBlockThreads(blocked); \
1296 //---------------------------------------------------------------------------
1298 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1299 wxString CBNAME(const wxString& a)
1301 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1302 wxString CLASS::CBNAME(const wxString& a) { \
1305 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1306 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1308 PyObject* s = wx2PyString(a); \
1309 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1312 rval = Py2wxString(ro); \
1316 wxPyEndBlockThreads(blocked); \
1318 rval = PCLASS::CBNAME(a); \
1322 //---------------------------------------------------------------------------
1324 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1325 wxString CBNAME(const wxString& a,int b)
1327 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1328 wxString CLASS::CBNAME(const wxString& a,int b) { \
1330 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1331 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1333 PyObject* s = wx2PyString(a); \
1334 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1337 rval = Py2wxString(ro); \
1341 wxPyEndBlockThreads(blocked); \
1345 //---------------------------------------------------------------------------
1347 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1348 bool CBNAME(const wxString& a, const wxString& b)
1350 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1351 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1354 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1355 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1356 PyObject* s1 = wx2PyString(a); \
1357 PyObject* s2 = wx2PyString(b); \
1358 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1362 wxPyEndBlockThreads(blocked); \
1364 rval = PCLASS::CBNAME(a, b); \
1368 //---------------------------------------------------------------------------
1370 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1373 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1374 wxString CLASS::CBNAME() { \
1377 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1378 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1380 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1382 rval = Py2wxString(ro); \
1386 wxPyEndBlockThreads(blocked); \
1388 rval = PCLASS::CBNAME(); \
1392 //---------------------------------------------------------------------------
1394 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1395 wxString CBNAME() const
1397 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1398 wxString CLASS::CBNAME() const { \
1401 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1402 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1404 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1406 rval = Py2wxString(ro); \
1410 wxPyEndBlockThreads(blocked); \
1412 rval = PCLASS::CBNAME(); \
1416 //---------------------------------------------------------------------------
1418 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1421 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1422 wxString CLASS::CBNAME() { \
1424 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1425 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1427 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1429 rval = Py2wxString(ro); \
1433 wxPyEndBlockThreads(blocked); \
1437 //---------------------------------------------------------------------------
1439 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1440 wxString CBNAME() const;
1442 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1443 wxString CLASS::CBNAME() const { \
1445 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1446 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1448 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1450 rval = Py2wxString(ro); \
1454 wxPyEndBlockThreads(blocked); \
1458 //---------------------------------------------------------------------------
1460 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1461 bool CBNAME(const wxHtmlTag& a)
1464 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1465 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1467 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1468 if (wxPyCBH_findCallback2(m_myInst, #CBNAME, false)) { \
1469 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1470 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1473 wxPyEndBlockThreads(blocked); \
1477 //---------------------------------------------------------------------------
1479 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1480 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1482 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1483 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1485 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1486 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1487 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1488 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1491 wxPyEndBlockThreads(blocked); \
1493 PCLASS::CBNAME(cell, x, y); \
1496 //---------------------------------------------------------------------------
1498 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1499 void CBNAME(const wxColour& c);
1501 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1502 void CLASS::CBNAME(const wxColour& c) { \
1504 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1505 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1506 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1507 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1510 wxPyEndBlockThreads(blocked); \
1512 PCLASS::CBNAME(c); \
1515 //---------------------------------------------------------------------------
1516 #define DEC_PYCALLBACK__INTCOLOUR(CBNAME) \
1517 void CBNAME(int a, const wxColour& c);
1519 #define IMP_PYCALLBACK__INTCOLOUR(CLASS, PCLASS, CBNAME) \
1520 void CLASS::CBNAME(int a, const wxColour& c) { \
1522 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1523 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1524 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1525 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1528 wxPyEndBlockThreads(blocked); \
1530 PCLASS::CBNAME(a, c); \
1533 //---------------------------------------------------------------------------
1535 #define DEC_PYCALLBACK__INTFONT(CBNAME) \
1536 void CBNAME(int a, const wxFont& c);
1538 #define IMP_PYCALLBACK__INTFONT(CLASS, PCLASS, CBNAME) \
1539 void CLASS::CBNAME(int a, const wxFont& c) { \
1541 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1542 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1543 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxFont"), 0); \
1544 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1547 wxPyEndBlockThreads(blocked); \
1549 PCLASS::CBNAME(a, c); \
1552 //---------------------------------------------------------------------------
1554 #define DEC_PYCALLBACK__FONT(CBNAME) \
1555 void CBNAME(const wxFont& a);
1557 #define IMP_PYCALLBACK__FONT(CLASS, PCLASS, CBNAME) \
1558 void CLASS::CBNAME(const wxFont& a) { \
1560 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1561 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1562 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxFont"), 0); \
1563 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); \
1566 wxPyEndBlockThreads(blocked); \
1568 PCLASS::CBNAME(a); \
1571 //---------------------------------------------------------------------------
1573 #define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
1574 bool CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1576 #define IMP_PYCALLBACK_BOOL_CELLINTINTME(CLASS, PCLASS, CBNAME) \
1577 bool CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1578 bool rval=false, found; \
1579 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1580 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1581 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1582 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1583 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1587 wxPyEndBlockThreads(blocked); \
1589 rval = PCLASS::CBNAME(cell, x, y, e); \
1594 //---------------------------------------------------------------------------
1596 #define DEC_PYCALLBACK___pure(CBNAME) \
1600 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1601 void CLASS::CBNAME() { \
1602 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1603 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1604 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1605 wxPyEndBlockThreads(blocked); \
1608 //---------------------------------------------------------------------------
1610 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1614 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1615 wxSize CLASS::CBNAME() { \
1616 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1618 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1619 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1622 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1624 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1626 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1628 PyObject* o1 = PySequence_GetItem(ro, 0); \
1629 PyObject* o2 = PySequence_GetItem(ro, 1); \
1630 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1631 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1633 PyErr_SetString(PyExc_TypeError, errmsg); \
1638 PyErr_SetString(PyExc_TypeError, errmsg); \
1643 wxPyEndBlockThreads(blocked); \
1647 //---------------------------------------------------------------------------
1649 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1650 bool CBNAME(wxWindow* a)
1653 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1654 bool CLASS::CBNAME(wxWindow* a) { \
1657 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1658 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1659 PyObject* obj = wxPyMake_wxObject(a,false); \
1660 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1663 wxPyEndBlockThreads(blocked); \
1665 rval = PCLASS::CBNAME(a); \
1671 #define DEC_PYCALLBACK_BOOL_WXWIN_pure(CBNAME) \
1672 bool CBNAME(wxWindow* a)
1674 #define IMP_PYCALLBACK_BOOL_WXWIN_pure(CLASS, PCLASS, CBNAME) \
1675 bool CLASS::CBNAME(wxWindow* a) { \
1678 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1679 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1680 PyObject* obj = wxPyMake_wxObject(a,false); \
1681 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1684 wxPyEndBlockThreads(blocked); \
1688 //---------------------------------------------------------------------------
1690 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1691 bool CBNAME(wxWindow* a, wxDC& b)
1694 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1695 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1698 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1699 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1700 PyObject* win = wxPyMake_wxObject(a,false); \
1701 PyObject* dc = wxPyMake_wxObject(&b,false); \
1702 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1706 wxPyEndBlockThreads(blocked); \
1708 rval = PCLASS::CBNAME(a, b); \
1712 //---------------------------------------------------------------------------
1714 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1715 void CBNAME(wxWindowBase* a)
1718 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1719 void CLASS::CBNAME(wxWindowBase* a) { \
1721 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1722 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1723 PyObject* obj = wxPyMake_wxObject(a,false); \
1724 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1727 wxPyEndBlockThreads(blocked); \
1729 PCLASS::CBNAME(a); \
1732 //---------------------------------------------------------------------------
1734 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1738 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1739 bool CLASS::CBNAME() { \
1742 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1743 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1744 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1745 wxPyEndBlockThreads(blocked); \
1747 rval = PCLASS::CBNAME(); \
1751 //---------------------------------------------------------------------------
1753 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1757 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1758 bool CLASS::CBNAME() const { \
1761 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1762 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1763 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1764 wxPyEndBlockThreads(blocked); \
1766 rval = PCLASS::CBNAME(); \
1770 //---------------------------------------------------------------------------
1772 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1773 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1776 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1777 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1780 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1781 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1782 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1783 wxPyEndBlockThreads(blocked); \
1785 rval = PCLASS::CBNAME(a, b, c); \
1786 return (wxDragResult)rval; \
1789 //---------------------------------------------------------------------------
1791 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1792 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1794 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1795 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1796 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1798 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1800 PyObject* obj = wxPyMake_wxObject(&a,false); \
1801 PyObject* s = wx2PyString(b); \
1802 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1805 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1806 /* release ownership of the C++ wx.FSFile object. */ \
1807 PyObject_SetAttrString(ro, "thisown", Py_False); \
1813 wxPyEndBlockThreads(blocked); \
1817 //---------------------------------------------------------------------------
1819 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1820 bool CBNAME(wxDragResult a)
1823 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1824 bool CLASS::CBNAME(wxDragResult a) { \
1827 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1828 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1829 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1830 wxPyEndBlockThreads(blocked); \
1832 rval = PCLASS::CBNAME(a); \
1836 //---------------------------------------------------------------------------
1838 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1839 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1842 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1843 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1844 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1846 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1847 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1848 wxPyEndBlockThreads(blocked); \
1849 return (wxDragResult)rval; \
1852 //---------------------------------------------------------------------------
1854 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1855 bool CBNAME(int a, int b, const wxString& c)
1857 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1858 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1860 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1861 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1862 PyObject* s = wx2PyString(c); \
1863 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1866 wxPyEndBlockThreads(blocked); \
1870 //---------------------------------------------------------------------------
1872 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1876 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1877 size_t CLASS::CBNAME() { \
1880 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1881 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1882 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1883 wxPyEndBlockThreads(blocked); \
1885 rval = PCLASS::CBNAME(); \
1889 //---------------------------------------------------------------------------
1891 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1892 size_t CBNAME() const
1895 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1896 size_t CLASS::CBNAME() const { \
1899 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1900 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1901 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1902 wxPyEndBlockThreads(blocked); \
1904 rval = PCLASS::CBNAME(); \
1908 //---------------------------------------------------------------------------
1910 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1911 wxDataFormat CBNAME(size_t a)
1914 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1915 wxDataFormat CLASS::CBNAME(size_t a) { \
1916 wxDataFormat rval=0; \
1918 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1919 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1921 wxDataFormat* ptr; \
1922 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1924 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1929 wxPyEndBlockThreads(blocked); \
1931 rval = PCLASS::CBNAME(a); \
1935 //---------------------------------------------------------------------------
1937 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1938 void CBNAME(const Type& a)
1941 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1942 void CLASS::CBNAME(const Type& a) { \
1944 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1945 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1946 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1947 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1950 wxPyEndBlockThreads(blocked); \
1952 PCLASS::CBNAME(a); \
1956 //---------------------------------------------------------------------------
1958 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1959 void CBNAME(Type& a)
1962 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1963 void CLASS::CBNAME(Type& a) { \
1965 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1966 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1967 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1968 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1971 wxPyEndBlockThreads(blocked); \
1973 PCLASS::CBNAME(a); \
1976 //---------------------------------------------------------------------------
1978 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1979 bool CBNAME(Type& a)
1982 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1983 bool CLASS::CBNAME(Type& a) { \
1986 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1987 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1988 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1989 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1992 wxPyEndBlockThreads(blocked); \
1994 rv = PCLASS::CBNAME(a); \
1998 //---------------------------------------------------------------------------
2000 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2001 bool CBNAME(Type& a)
2004 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2005 bool CLASS::CBNAME(Type& a) { \
2007 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2008 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2009 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2010 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2013 wxPyEndBlockThreads(blocked); \
2017 //---------------------------------------------------------------------------
2019 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2020 wxString CBNAME(long a, long b) const
2022 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2023 wxString CLASS::CBNAME(long a, long b) const { \
2026 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2027 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2029 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2031 rval = Py2wxString(ro); \
2035 wxPyEndBlockThreads(blocked); \
2037 rval = PCLASS::CBNAME(a,b); \
2041 //---------------------------------------------------------------------------
2043 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2044 int CBNAME(long a) const
2047 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2048 int CLASS::CBNAME(long a) const { \
2051 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2052 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2054 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2056 rval = PyInt_AsLong(ro); \
2060 wxPyEndBlockThreads(blocked); \
2062 rval = PCLASS::CBNAME(a); \
2067 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2068 int CBNAME(long a) const;
2071 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2072 int CLASS::CBNAME(long a) const { \
2073 int rval=-1; /* this rval is important for OnGetItemImage */ \
2075 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2076 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2078 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2080 rval = PyInt_AsLong(ro); \
2084 wxPyEndBlockThreads(blocked); \
2089 //---------------------------------------------------------------------------
2091 #define DEC_PYCALLBACK_INT_INT(CBNAME) \
2095 #define IMP_PYCALLBACK_INT_INT(CLASS, PCLASS, CBNAME) \
2096 int CLASS::CBNAME(int a) { \
2099 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2100 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2102 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
2104 rval = PyInt_AsLong(ro); \
2108 wxPyEndBlockThreads(blocked); \
2110 rval = PCLASS::CBNAME(a); \
2114 //---------------------------------------------------------------------------
2116 #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
2117 int CBNAME(long a, long b) const
2120 #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \
2121 int CLASS::CBNAME(long a, long b) const { \
2124 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2125 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2127 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2129 rval = PyInt_AsLong(ro); \
2133 wxPyEndBlockThreads(blocked); \
2135 rval = PCLASS::CBNAME(a, b); \
2140 #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \
2141 int CBNAME(long a, long b) const;
2144 #define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME) \
2145 int CLASS::CBNAME(long a, long b) const { \
2146 int rval=-1; /* this rval is important for OnGetItemImage */ \
2148 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2149 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2151 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2153 rval = PyInt_AsLong(ro); \
2157 wxPyEndBlockThreads(blocked); \
2162 //---------------------------------------------------------------------------
2164 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2165 wxListItemAttr* CBNAME(long a) const
2168 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2169 wxListItemAttr *CLASS::CBNAME(long a) const { \
2170 wxListItemAttr *rval = NULL; \
2172 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2173 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2175 wxListItemAttr* ptr; \
2176 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2178 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2183 wxPyEndBlockThreads(blocked); \
2185 rval = PCLASS::CBNAME(a); \
2189 //---------------------------------------------------------------------------
2191 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2192 bool CBNAME(wxMouseEvent& e)
2194 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2195 bool CLASS::CBNAME(wxMouseEvent& e) { \
2198 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2199 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2201 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2202 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2204 rval = PyInt_AsLong(ro); \
2209 wxPyEndBlockThreads(blocked); \
2211 return PCLASS::CBNAME(e); \
2215 //---------------------------------------------------------------------------
2217 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2218 wxWizardPage* CBNAME() const
2220 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2221 wxWizardPage* CLASS::CBNAME() const { \
2222 wxWizardPage* rv = NULL; \
2223 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2224 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2226 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2228 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2232 wxPyEndBlockThreads(blocked); \
2236 //---------------------------------------------------------------------------
2238 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2239 wxBitmap CBNAME() const
2241 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2242 wxBitmap CLASS::CBNAME() const { \
2244 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2245 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2248 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2250 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2255 wxPyEndBlockThreads(blocked); \
2259 //---------------------------------------------------------------------------
2261 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2264 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2265 wxObject* CLASS::CBNAME() { \
2266 wxObject* rv = NULL; \
2267 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2268 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2270 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2272 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2276 wxPyEndBlockThreads(blocked); \
2280 //---------------------------------------------------------------------------
2282 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2283 wxObject* CBNAME(const wxString& a)
2285 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2286 wxObject* CLASS::CBNAME(const wxString& a) { \
2287 wxObject* rv = NULL; \
2288 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2289 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2290 PyObject* so = wx2PyString(a); \
2292 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2294 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2299 wxPyEndBlockThreads(blocked); \
2303 //---------------------------------------------------------------------------
2305 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2306 bool CBNAME(wxXmlNode* a)
2309 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2310 bool CLASS::CBNAME(wxXmlNode* a) { \
2312 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2313 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2314 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2315 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2318 wxPyEndBlockThreads(blocked); \
2322 //---------------------------------------------------------------------------
2324 #define DEC_PYCALLBACK_COORD_SIZET_const(CBNAME) \
2325 wxCoord CBNAME(size_t a) const
2327 #define IMP_PYCALLBACK_COORD_SIZET_const(CLASS, PCLASS, CBNAME) \
2328 wxCoord CLASS::CBNAME(size_t a) const { \
2331 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2332 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2333 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2335 wxPyEndBlockThreads(blocked); \
2337 rval = PCLASS::CBNAME(a); \
2342 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2343 wxCoord CBNAME(size_t a) const
2345 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2346 wxCoord CLASS::CBNAME(size_t a) const { \
2349 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2350 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2351 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2353 wxPyEndBlockThreads(blocked); \
2357 //---------------------------------------------------------------------------
2359 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2360 void CBNAME(size_t a, size_t b) const
2363 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2364 void CLASS::CBNAME(size_t a, size_t b) const { \
2366 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2367 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2368 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2369 wxPyEndBlockThreads(blocked); \
2371 PCLASS::CBNAME(a,b); \
2373 //---------------------------------------------------------------------------
2375 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2376 wxCoord CBNAME() const
2379 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2380 wxCoord CLASS::CBNAME() const { \
2383 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2384 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2385 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2386 wxPyEndBlockThreads(blocked); \
2388 rval = PCLASS::CBNAME(); \
2392 //---------------------------------------------------------------------------
2394 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2395 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2397 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2398 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2400 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2401 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2402 PyObject* obj = wxPyMake_wxObject(&a,false); \
2403 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2404 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2405 Py_DECREF(obj); Py_DECREF(ro); \
2407 wxPyEndBlockThreads(blocked); \
2412 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2413 void CBNAME(wxDC& a, const wxRect& b, size_t c) const
2415 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2416 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2418 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2419 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2420 PyObject* obj = wxPyMake_wxObject(&a,false); \
2421 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2422 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2423 Py_DECREF(obj); Py_DECREF(ro); \
2425 wxPyEndBlockThreads(blocked); \
2427 PCLASS::CBNAME(a,b,c); \
2431 //---------------------------------------------------------------------------
2432 // Same as the above set, but the wxRect is not const
2434 #define DEC_PYCALLBACK__DCRECTSIZET2_constpure(CBNAME) \
2435 void CBNAME(wxDC& a, wxRect& b, size_t c) const;
2437 #define IMP_PYCALLBACK__DCRECTSIZET2_constpure(CLASS, PCLASS, CBNAME) \
2438 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2440 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2441 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2442 PyObject* obj = wxPyMake_wxObject(&a,false); \
2443 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2444 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2445 Py_DECREF(obj); Py_DECREF(ro); \
2447 wxPyEndBlockThreads(blocked); \
2452 #define DEC_PYCALLBACK__DCRECTSIZET2_const(CBNAME) \
2453 void CBNAME(wxDC& a, wxRect& b, size_t c) const
2455 #define IMP_PYCALLBACK__DCRECTSIZET2_const(CLASS, PCLASS, CBNAME) \
2456 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2458 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2459 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2460 PyObject* obj = wxPyMake_wxObject(&a,false); \
2461 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2462 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2463 Py_DECREF(obj); Py_DECREF(ro); \
2465 wxPyEndBlockThreads(blocked); \
2467 PCLASS::CBNAME(a,b,c); \
2470 //---------------------------------------------------------------------------
2472 #define DEC_PYCALLBACK__DCRECTINTINT_const(CBNAME) \
2473 void CBNAME(wxDC& a, const wxRect& b, int c, int d) const
2475 #define IMP_PYCALLBACK__DCRECTINTINT_const(CLASS, PCLASS, CBNAME) \
2476 void CLASS::CBNAME(wxDC& a, const wxRect& b, int c, int d) const { \
2478 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2479 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2480 PyObject* obj = wxPyMake_wxObject(&a,false); \
2481 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2482 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOii)", obj, ro, c, d)); \
2483 Py_DECREF(obj); Py_DECREF(ro); \
2485 wxPyEndBlockThreads(blocked); \
2487 PCLASS::CBNAME(a,b,c,d); \
2491 //---------------------------------------------------------------------------
2493 #define DEC_PYCALLBACK__RECTINT(CBNAME) \
2494 void CBNAME(const wxRect& a, int b)
2496 #define IMP_PYCALLBACK__RECTINT(CLASS, PCLASS, CBNAME) \
2497 void CLASS::CBNAME(const wxRect& a, int b) { \
2499 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2500 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2501 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2502 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b)); \
2505 wxPyEndBlockThreads(blocked); \
2507 PCLASS::CBNAME(a,b); \
2511 #define DEC_PYCALLBACK_BOOL_RECTINT(CBNAME) \
2512 bool CBNAME(const wxRect& a, int b)
2514 #define IMP_PYCALLBACK_BOOL_RECTINT(CLASS, PCLASS, CBNAME) \
2515 bool CLASS::CBNAME(const wxRect& a, int b) { \
2517 bool rval = false; \
2518 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2519 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2520 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2521 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b));\
2524 wxPyEndBlockThreads(blocked); \
2526 rval = PCLASS::CBNAME(a,b); \
2531 //---------------------------------------------------------------------------
2533 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2534 wxString CBNAME(size_t a) const
2536 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2537 wxString CLASS::CBNAME(size_t a) const { \
2540 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2541 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2543 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2545 rval = Py2wxString(ro); \
2549 wxPyEndBlockThreads(blocked); \
2551 rval = PCLASS::CBNAME(a); \
2555 //---------------------------------------------------------------------------
2557 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2558 wxString CBNAME(size_t a) const
2560 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2561 wxString CLASS::CBNAME(size_t a) const { \
2564 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2565 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2567 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2569 rval = Py2wxString(ro); \
2573 wxPyEndBlockThreads(blocked); \
2577 //---------------------------------------------------------------------------
2579 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2580 wxVisualAttributes CBNAME() const
2583 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2584 wxVisualAttributes CLASS::CBNAME() const { \
2585 wxVisualAttributes rval; \
2587 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2588 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2590 wxVisualAttributes* ptr; \
2591 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2593 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2598 wxPyEndBlockThreads(blocked); \
2600 rval = PCLASS::CBNAME(); \
2604 //---------------------------------------------------------------------------
2606 #define DEC_PYCALLBACK_FONT_INT(CBNAME) \
2607 wxFont CBNAME(int a)
2609 #define IMP_PYCALLBACK_FONT_INT(CLASS, PCLASS, CBNAME) \
2610 wxFont CLASS::CBNAME(int a) { \
2613 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2614 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2617 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2619 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxFont"))) \
2624 wxPyEndBlockThreads(blocked); \
2626 rv = PCLASS::CBNAME(a); \
2630 //---------------------------------------------------------------------------
2632 #define DEC_PYCALLBACK_COLOUR_INT(CBNAME) \
2633 wxColour CBNAME(int a)
2635 #define IMP_PYCALLBACK_COLOUR_INT(CLASS, PCLASS, CBNAME) \
2636 wxColour CLASS::CBNAME(int a) { \
2639 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2640 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2643 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2645 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxColour"))) \
2650 wxPyEndBlockThreads(blocked); \
2652 rv = PCLASS::CBNAME(a); \
2656 //---------------------------------------------------------------------------