1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/choicebk.h>
24 #include <wx/clipbrd.h>
25 #include <wx/colordlg.h>
26 #include <wx/config.h>
27 #include <wx/cshelp.h>
28 #include <wx/dcmirror.h>
30 #include <wx/dirctrl.h>
31 #include <wx/dirdlg.h>
33 #include <wx/docview.h>
34 #include <wx/encconv.h>
35 #include <wx/fdrepdlg.h>
36 #include <wx/fileconf.h>
37 #include <wx/filesys.h>
38 #include <wx/fontdlg.h>
39 #include <wx/fs_inet.h>
40 #include <wx/fs_mem.h>
41 #include <wx/fs_zip.h>
42 #include <wx/gbsizer.h>
43 #include <wx/geometry.h>
44 #include <wx/htmllbox.h>
46 #include <wx/imaglist.h>
48 #include <wx/laywin.h>
49 #include <wx/listbook.h>
50 #include <wx/minifram.h>
51 #include <wx/notebook.h>
53 #include <wx/printdlg.h>
54 #include <wx/process.h>
55 #include <wx/progdlg.h>
56 #include <wx/sashwin.h>
57 #include <wx/spinbutt.h>
58 #include <wx/spinctrl.h>
59 #include <wx/splash.h>
60 #include <wx/splitter.h>
61 #include <wx/statline.h>
62 #include <wx/stream.h>
63 #include <wx/sysopt.h>
64 #include <wx/taskbar.h>
65 #include <wx/tglbtn.h>
66 #include <wx/tipwin.h>
67 #include <wx/tooltip.h>
69 #include <wx/vscroll.h>
73 # pragma warning(disable:4800)
74 # pragma warning(disable:4190)
77 #ifdef __WXMAC__ // avoid a bug in Carbon headers
81 //---------------------------------------------------------------------------
83 typedef unsigned char byte
;
84 typedef wxPoint2DDouble wxPoint2D
;
87 #ifndef wxPyUSE_EXPORTED_API
89 void __wxPyPreStart(PyObject
*);
91 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
92 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
);
94 void wxSetDefaultPyEncoding(const char* encoding
);
95 const char* wxGetDefaultPyEncoding();
98 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
101 bool wxPyCheckSwigType(const wxChar
* className
);
102 PyObject
* wxPyConstructObject(void* ptr
,
103 const wxChar
* className
,
105 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
106 const wxChar
* className
);
107 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
110 PyObject
* wx2PyString(const wxString
& src
);
111 wxString
Py2wxString(PyObject
* source
);
113 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
114 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
115 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
117 PyObject
* wxPy_ConvertList(wxListBase
* list
);
118 long wxPyGetWinHandle(wxWindow
* win
);
120 void wxPy_ReinitStockObjects(int pass
);
122 bool wxPyInstance_Check(PyObject
* obj
);
123 bool wxPySwigInstance_Check(PyObject
* obj
);
126 #endif // wxPyUSE_EXPORTED_API
127 //---------------------------------------------------------------------------
129 // if we want to handle threads and Python threads are available...
130 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
131 #define WXP_WITH_THREAD
132 #else // no Python threads...
133 #undef WXP_WITH_THREAD
136 #ifndef wxPyUSE_EXPORTED_API
138 // For Python --> C++
139 PyThreadState
* wxPyBeginAllowThreads();
140 void wxPyEndAllowThreads(PyThreadState
* state
);
142 // For C++ --> Python
143 bool wxPyBeginBlockThreads();
144 void wxPyEndBlockThreads(bool blocked
);
146 #endif // wxPyUSE_EXPORTED_API
149 // A macro that will help to execute simple statments wrapped in
150 // StartBlock/EndBlockThreads calls
151 #define wxPyBLOCK_THREADS(stmt) \
152 { bool blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
154 // Raise the NotImplementedError exception (blocking threads)
155 #define wxPyRaiseNotImplemented() \
156 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
158 // Raise any exception witha string value (blocking threads)
159 #define wxPyErr_SetString(err, str) \
160 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
163 //---------------------------------------------------------------------------
164 // These are helpers used by the typemaps
166 #ifndef wxPyUSE_EXPORTED_API
168 wxString
* wxString_in_helper(PyObject
* source
);
170 byte
* byte_LIST_helper(PyObject
* source
);
171 int* int_LIST_helper(PyObject
* source
);
172 long* long_LIST_helper(PyObject
* source
);
173 char** string_LIST_helper(PyObject
* source
);
174 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
175 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
176 wxString
* wxString_LIST_helper(PyObject
* source
);
177 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
178 wxPen
** wxPen_LIST_helper(PyObject
* source
);
180 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
181 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
182 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
183 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
184 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
185 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
188 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
189 bool wxColour_typecheck(PyObject
* source
);
191 bool wxPyCheckForApp();
195 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
197 // If source is an object instance then it may already be the right type
198 if (wxPySwigInstance_Check(source
)) {
200 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
205 // otherwise a 2-tuple of integers is expected
206 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
207 PyObject
* o1
= PySequence_GetItem(source
, 0);
208 PyObject
* o2
= PySequence_GetItem(source
, 1);
209 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
214 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
222 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
223 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
229 // Other helpful stuff
230 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
231 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
233 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
234 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
236 #endif // wxPyUSE_EXPORTED_API
238 //---------------------------------------------------------------------------
240 #if PYTHON_API_VERSION < 1009
241 #define PySequence_Fast_GET_ITEM(o, i) \
242 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
245 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
246 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
247 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
249 //---------------------------------------------------------------------------
251 #ifndef wxPyUSE_EXPORTED_API
253 class wxPyCallback
: public wxObject
{
254 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
256 wxPyCallback(PyObject
* func
);
257 wxPyCallback(const wxPyCallback
& other
);
260 void EventThunker(wxEvent
& event
);
265 #endif // wxPyUSE_EXPORTED_API
266 //---------------------------------------------------------------------------
267 //---------------------------------------------------------------------------
268 // These Event classes can be derived from in Python and passed through the
269 // event system without loosing anything. They do this by keeping a reference
270 // to themselves and some special case handling in wxPyCallback::EventThunker.
274 class wxPyEvtSelfRef
{
279 void SetSelf(PyObject
* self
, bool clone
=false);
280 PyObject
* GetSelf() const;
281 bool GetCloned() const { return m_cloned
; }
289 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
290 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
292 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
293 wxPyEvent(const wxPyEvent
& evt
);
296 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
300 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
301 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
303 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
304 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
307 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
312 //----------------------------------------------------------------------
313 // Forward decalre a few things used in the exported API
314 class wxPyClientData
;
316 class wxPyOORClientData
;
317 class wxPyCBInputStream
;
319 void wxPyClientData_dtor(wxPyClientData
* self
);
320 void wxPyUserData_dtor(wxPyUserData
* self
);
321 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
322 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
325 //---------------------------------------------------------------------------
326 // Export a C API in a struct. Other modules will be able to load this from
327 // the wx.core module and will then have safe access to these functions, even if
328 // in another shared library.
330 class wxPyCallbackHelper
;
331 struct swig_type_info
;
332 struct swig_const_info
;
334 // Make SunCC happy and make typedef's for these that are extern "C"
335 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
336 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
337 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
338 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
339 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
340 typedef const char * (*p_SWIG_Python_TypePrettyName_t
)(const swig_type_info
*);
341 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
342 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
343 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
344 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
345 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
346 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
347 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
348 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
349 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
350 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
351 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
352 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
357 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
358 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
359 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
360 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
361 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
362 p_SWIG_Python_TypePrettyName_t p_SWIG_Python_TypePrettyName
;
363 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
364 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
365 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
366 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
367 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
368 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
369 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
370 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
371 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
372 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
373 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
374 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
376 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
377 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
378 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
379 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
381 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
382 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
383 bool (*p_wxPyBeginBlockThreads
)();
384 void (*p_wxPyEndBlockThreads
)(bool blocked
);
386 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
388 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
389 wxString (*p_Py2wxString
)(PyObject
* source
);
390 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
392 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
393 int* (*p_int_LIST_helper
)(PyObject
* source
);
394 long* (*p_long_LIST_helper
)(PyObject
* source
);
395 char** (*p_string_LIST_helper
)(PyObject
* source
);
396 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
397 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
398 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
399 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
401 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
402 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
403 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
404 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
405 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
406 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
409 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
410 bool (*p_wxColour_typecheck
)(PyObject
* source
);
412 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
413 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
414 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
415 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
416 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
418 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
419 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
420 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
421 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
422 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
423 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
424 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
426 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
427 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
428 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
430 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
432 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
433 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
435 bool (*p_wxPyCheckForApp
)();
439 #ifdef wxPyUSE_EXPORTED_API
440 // Notice that this is static, not extern. This is by design, each module
441 // needs one, but doesn't have to use it.
442 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
443 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
444 #endif // wxPyUSE_EXPORTED_API
446 //---------------------------------------------------------------------------
448 // A wxObject that holds a reference to a Python object
449 class wxPyUserData
: public wxObject
{
451 wxPyUserData(PyObject
* obj
) {
457 #ifdef wxPyUSE_EXPORTED_API
458 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
460 wxPyUserData_dtor(this);
467 // A wxClientData that holds a refernece to a Python object
468 class wxPyClientData
: public wxClientData
{
470 wxPyClientData(PyObject
* obj
, bool incref
=true) {
478 #ifdef wxPyUSE_EXPORTED_API
479 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
481 wxPyClientData_dtor(this);
489 // Just like wxPyClientData, except when this object is destroyed it does some
490 // OOR magic on the Python Object.
491 class wxPyOORClientData
: public wxPyClientData
{
493 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
494 : wxPyClientData(obj
, incref
) {}
495 ~wxPyOORClientData() {
497 #ifdef wxPyUSE_EXPORTED_API
498 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
500 wxPyOORClientData_dtor(this);
506 //---------------------------------------------------------------------------
507 // This class holds an instance of a Python Shadow Class object and assists
508 // with looking up and invoking Python callback methods from C++ virtual
509 // method redirections. For all classes which have virtuals which should be
510 // overridable in wxPython, a new subclass is created that contains a
511 // wxPyCallbackHelper.
514 class wxPyCallbackHelper
{
516 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
518 wxPyCallbackHelper() {
525 ~wxPyCallbackHelper() {
526 #ifdef wxPyUSE_EXPORTED_API
527 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
529 wxPyCBH_delete(this);
533 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
534 bool findCallback(const char* name
) const;
535 int callCallback(PyObject
* argTuple
) const;
536 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
537 PyObject
* GetLastFound() const { return m_lastFound
; }
542 PyObject
* m_lastFound
;
545 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
549 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
550 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
551 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
552 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
553 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
558 //---------------------------------------------------------------------------
560 // This is used in C++ classes that need to be able to make callback to
561 // "overloaded" python methods
564 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
565 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
567 private: wxPyCallbackHelper m_myInst
570 //---------------------------------------------------------------------------
571 // The wxPythonApp class
574 wxPYAPP_ASSERT_SUPPRESS
= 1,
575 wxPYAPP_ASSERT_EXCEPTION
= 2,
576 wxPYAPP_ASSERT_DIALOG
= 4,
577 wxPYAPP_ASSERT_LOG
= 8
580 class wxPyApp
: public wxApp
582 DECLARE_ABSTRACT_CLASS(wxPyApp
);
590 int GetAssertMode() { return m_assertMode
; }
591 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
593 virtual bool OnInitGui();
594 virtual int OnExit();
596 virtual void OnAssert(const wxChar
*file
,
601 // virtual int FilterEvent(wxEvent& event); // This one too????
603 // For catching Apple Events
604 virtual void MacOpenFile(const wxString
&fileName
);
605 virtual void MacPrintFile(const wxString
&fileName
);
606 virtual void MacNewFile();
607 virtual void MacReopenApp();
609 static bool GetMacSupportPCMenuShortcuts();
610 static long GetMacAboutMenuItemId();
611 static long GetMacPreferencesMenuItemId();
612 static long GetMacExitMenuItemId();
613 static wxString
GetMacHelpMenuTitleName();
615 static void SetMacSupportPCMenuShortcuts(bool val
);
616 static void SetMacAboutMenuItemId(long val
);
617 static void SetMacPreferencesMenuItemId(long val
);
618 static void SetMacExitMenuItemId(long val
);
619 static void SetMacHelpMenuTitleName(const wxString
& val
);
622 void _BootstrapApp();
624 // implementation only
625 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
629 bool m_startupComplete
;
632 extern wxPyApp
*wxPythonApp
;
635 //----------------------------------------------------------------------
636 // These macros are used to implement the virtual methods that should
637 // redirect to a Python method if one exists. The names designate the
638 // return type, if any, as well as any parameter types.
639 //---------------------------------------------------------------------------
641 #define DEC_PYCALLBACK__(CBNAME) \
646 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
647 void CLASS::CBNAME() { \
649 bool blocked = wxPyBeginBlockThreads(); \
650 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
651 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
652 wxPyEndBlockThreads(blocked); \
656 void CLASS::base_##CBNAME() { \
660 //---------------------------------------------------------------------------
662 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
663 bool CBNAME(int a, int b); \
664 bool base_##CBNAME(int a, int b)
667 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
668 bool CLASS::CBNAME(int a, int b) { \
669 bool rval=false, found; \
670 bool blocked = wxPyBeginBlockThreads(); \
671 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
672 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
673 wxPyEndBlockThreads(blocked); \
675 rval = PCLASS::CBNAME(a,b); \
678 bool CLASS::base_##CBNAME(int a, int b) { \
679 return PCLASS::CBNAME(a,b); \
682 //---------------------------------------------------------------------------
684 #define DEC_PYCALLBACK_VOID_(CBNAME) \
689 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
690 void CLASS::CBNAME() { \
692 bool blocked = wxPyBeginBlockThreads(); \
693 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
694 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
695 wxPyEndBlockThreads(blocked); \
699 void CLASS::base_##CBNAME() { \
703 //---------------------------------------------------------------------------
705 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
706 void CBNAME(int a, int b); \
707 void base_##CBNAME(int a, int b)
710 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
711 void CLASS::CBNAME(int a, int b) { \
713 bool blocked = wxPyBeginBlockThreads(); \
714 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
715 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
716 wxPyEndBlockThreads(blocked); \
718 PCLASS::CBNAME(a,b); \
720 void CLASS::base_##CBNAME(int a, int b) { \
721 PCLASS::CBNAME(a,b); \
724 //---------------------------------------------------------------------------
726 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
727 void CBNAME(int a); \
728 void base_##CBNAME(int a)
731 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
732 void CLASS::CBNAME(int a) { \
734 bool blocked = wxPyBeginBlockThreads(); \
735 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
736 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
737 wxPyEndBlockThreads(blocked); \
741 void CLASS::base_##CBNAME(int a) { \
745 //---------------------------------------------------------------------------
747 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
748 void CBNAME(int a, int b, int c, int d); \
749 void base_##CBNAME(int a, int b, int c, int d)
752 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
753 void CLASS::CBNAME(int a, int b, int c, int d) { \
755 bool blocked = wxPyBeginBlockThreads(); \
756 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
757 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
758 wxPyEndBlockThreads(blocked); \
760 PCLASS::CBNAME(a,b,c,d); \
762 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
763 PCLASS::CBNAME(a,b,c,d); \
766 //---------------------------------------------------------------------------
767 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
768 void CBNAME(int a, int b, int c, int d, int e); \
769 void base_##CBNAME(int a, int b, int c, int d, int e)
772 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
773 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
775 bool blocked = wxPyBeginBlockThreads(); \
776 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
777 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
778 wxPyEndBlockThreads(blocked); \
780 PCLASS::CBNAME(a,b,c,d,e); \
782 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
783 PCLASS::CBNAME(a,b,c,d,e); \
786 //---------------------------------------------------------------------------
788 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
789 void CBNAME(int* a, int* b) const; \
790 void base_##CBNAME(int* a, int* b) const
793 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
794 void CLASS::CBNAME(int* a, int* b) const { \
795 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
797 bool blocked = wxPyBeginBlockThreads(); \
798 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
800 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
802 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
803 PyObject* o1 = PySequence_GetItem(ro, 0); \
804 PyObject* o2 = PySequence_GetItem(ro, 1); \
805 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
806 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
809 PyErr_SetString(PyExc_TypeError, errmsg); \
814 PyErr_SetString(PyExc_TypeError, errmsg); \
819 wxPyEndBlockThreads(blocked); \
821 PCLASS::CBNAME(a,b); \
823 void CLASS::base_##CBNAME(int* a, int* b) const { \
824 PCLASS::CBNAME(a,b); \
828 //---------------------------------------------------------------------------
830 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
831 wxSize CBNAME() const; \
832 wxSize base_##CBNAME() const
835 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
836 wxSize CLASS::CBNAME() const { \
837 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
838 bool found; wxSize rval(0,0); \
839 bool blocked = wxPyBeginBlockThreads(); \
840 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
842 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
844 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
845 PyObject* o1 = PySequence_GetItem(ro, 0); \
846 PyObject* o2 = PySequence_GetItem(ro, 1); \
847 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
848 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
851 PyErr_SetString(PyExc_TypeError, errmsg); \
856 PyErr_SetString(PyExc_TypeError, errmsg); \
861 wxPyEndBlockThreads(blocked); \
863 return PCLASS::CBNAME(); \
867 wxSize CLASS::base_##CBNAME() const { \
868 return PCLASS::CBNAME(); \
872 //---------------------------------------------------------------------------
874 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
875 bool CBNAME(bool a); \
876 bool base_##CBNAME(bool a)
879 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
880 bool CLASS::CBNAME(bool a) { \
881 bool rval=false, found; \
882 bool blocked = wxPyBeginBlockThreads(); \
883 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
884 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
885 wxPyEndBlockThreads(blocked); \
887 rval = PCLASS::CBNAME(a); \
890 bool CLASS::base_##CBNAME(bool a) { \
891 return PCLASS::CBNAME(a); \
894 //---------------------------------------------------------------------------
896 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
897 bool CBNAME(int a); \
898 bool base_##CBNAME(int a)
901 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
902 bool CLASS::CBNAME(int a) { \
903 bool rval=false, found; \
904 bool blocked = wxPyBeginBlockThreads(); \
905 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
906 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
907 wxPyEndBlockThreads(blocked); \
909 rval = PCLASS::CBNAME(a); \
912 bool CLASS::base_##CBNAME(int a) { \
913 return PCLASS::CBNAME(a); \
916 //---------------------------------------------------------------------------
918 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
922 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
923 bool CLASS::CBNAME(int a) { \
925 bool blocked = wxPyBeginBlockThreads(); \
926 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
927 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
929 wxPyEndBlockThreads(blocked); \
934 //---------------------------------------------------------------------------
936 #define DEC_PYCALLBACK__DC(CBNAME) \
937 void CBNAME(wxDC& a); \
938 void base_##CBNAME(wxDC& a)
941 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
942 void CLASS::CBNAME(wxDC& a) { \
944 bool blocked = wxPyBeginBlockThreads(); \
945 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
946 PyObject* obj = wxPyMake_wxObject(&a,false); \
947 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
950 wxPyEndBlockThreads(blocked); \
954 void CLASS::base_##CBNAME(wxDC& a) { \
960 //---------------------------------------------------------------------------
962 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
963 void CBNAME(wxDC& a, bool b); \
964 void base_##CBNAME(wxDC& a, bool b)
967 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
968 void CLASS::CBNAME(wxDC& a, bool b) { \
970 bool blocked = wxPyBeginBlockThreads(); \
971 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
972 PyObject* obj = wxPyMake_wxObject(&a,false); \
973 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
976 wxPyEndBlockThreads(blocked); \
978 PCLASS::CBNAME(a, b); \
980 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
981 PCLASS::CBNAME(a, b); \
984 //---------------------------------------------------------------------------
986 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
987 void CBNAME(wxDC& a, bool b); \
988 void base_##CBNAME(wxDC& a, bool b)
991 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
992 void CLASS::CBNAME(wxDC& a, bool b) { \
994 bool blocked = wxPyBeginBlockThreads(); \
995 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
996 PyObject* obj = wxPyMake_wxObject(&a,false); \
997 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1000 wxPyEndBlockThreads(blocked); \
1002 PCLASS::CBNAME(a, b); \
1004 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1005 PCLASS::CBNAME(a, b); \
1008 //---------------------------------------------------------------------------
1010 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1011 void CBNAME(double a, double b); \
1012 void base_##CBNAME(double a, double b)
1015 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1016 void CLASS::CBNAME(double a, double b) { \
1018 bool blocked = wxPyBeginBlockThreads(); \
1019 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1020 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1021 wxPyEndBlockThreads(blocked); \
1023 PCLASS::CBNAME(a, b); \
1025 void CLASS::base_##CBNAME(double a, double b) { \
1026 PCLASS::CBNAME(a, b); \
1029 //---------------------------------------------------------------------------
1031 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1032 void CBNAME(double a, double b, int c, int d); \
1033 void base_##CBNAME(double a, double b, int c, int d)
1036 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1037 void CLASS::CBNAME(double a, double b, int c, int d) { \
1039 bool blocked = wxPyBeginBlockThreads(); \
1040 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1041 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1043 wxPyEndBlockThreads(blocked); \
1045 PCLASS::CBNAME(a, b, c, d); \
1047 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1048 PCLASS::CBNAME(a, b, c, d); \
1051 //---------------------------------------------------------------------------
1053 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1054 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1055 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1058 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1059 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1061 bool blocked = wxPyBeginBlockThreads(); \
1062 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1063 PyObject* obj = wxPyMake_wxObject(&a,false); \
1064 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1067 wxPyEndBlockThreads(blocked); \
1069 PCLASS::CBNAME(a, b, c, d, e, f); \
1071 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1072 PCLASS::CBNAME(a, b, c, d, e, f); \
1075 //---------------------------------------------------------------------------
1077 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1078 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1079 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1082 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1083 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1085 bool blocked = wxPyBeginBlockThreads(); \
1087 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1088 PyObject* obj = wxPyMake_wxObject(&a,false); \
1089 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1092 wxPyEndBlockThreads(blocked); \
1094 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1097 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1098 return PCLASS::CBNAME(a, b, c, d, e, f); \
1101 //---------------------------------------------------------------------------
1103 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1104 void CBNAME(bool a, double b, double c, int d, int e); \
1105 void base_##CBNAME(bool a, double b, double c, int d, int e)
1108 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1109 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1111 bool blocked = wxPyBeginBlockThreads(); \
1112 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1113 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1115 wxPyEndBlockThreads(blocked); \
1117 PCLASS::CBNAME(a, b, c, d, e); \
1119 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1120 PCLASS::CBNAME(a, b, c, d, e); \
1123 //---------------------------------------------------------------------------
1125 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1126 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1127 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1130 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1131 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1133 bool blocked = wxPyBeginBlockThreads(); \
1134 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1135 PyObject* obj = wxPyMake_wxObject(&a,false); \
1136 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1139 wxPyEndBlockThreads(blocked); \
1141 PCLASS::CBNAME(a, b, c, d, e); \
1143 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1144 PCLASS::CBNAME(a, b, c, d, e); \
1147 //---------------------------------------------------------------------------
1149 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1150 void CBNAME(wxDC& a, bool b); \
1151 void base_##CBNAME(wxDC& a, bool b)
1154 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1155 void CLASS::CBNAME(wxDC& a, bool b) { \
1157 bool blocked = wxPyBeginBlockThreads(); \
1158 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1159 PyObject* obj = wxPyMake_wxObject(&a,false); \
1160 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1163 wxPyEndBlockThreads(blocked); \
1165 PCLASS::CBNAME(a, b); \
1167 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1168 PCLASS::CBNAME(a, b); \
1171 //---------------------------------------------------------------------------
1173 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1174 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1175 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1178 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1179 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1182 bool blocked = wxPyBeginBlockThreads(); \
1183 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1184 PyObject* obj = wxPyMake_wxObject(a,false); \
1185 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1188 wxPyEndBlockThreads(blocked); \
1190 PCLASS::CBNAME(a, b, c, d, e, f); \
1192 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1194 PCLASS::CBNAME(a, b, c, d, e, f); \
1197 //---------------------------------------------------------------------------
1199 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1200 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1201 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1204 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1205 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1207 bool blocked = wxPyBeginBlockThreads(); \
1208 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1209 PyObject* obj = wxPyMake_wxObject(a,false); \
1210 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1213 wxPyEndBlockThreads(blocked); \
1215 PCLASS::CBNAME(a, b, c, d, e); \
1217 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1219 PCLASS::CBNAME(a, b, c, d, e); \
1222 //---------------------------------------------------------------------------
1224 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1225 void CBNAME(double a, double b, int c); \
1226 void base_##CBNAME(double a, double b, int c)
1229 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1230 void CLASS::CBNAME(double a, double b, int c) { \
1232 bool blocked = wxPyBeginBlockThreads(); \
1233 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1234 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1235 wxPyEndBlockThreads(blocked); \
1237 PCLASS::CBNAME(a, b, c); \
1239 void CLASS::base_##CBNAME(double a, double b, int c) { \
1240 PCLASS::CBNAME(a, b, c); \
1243 //---------------------------------------------------------------------------
1245 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1246 void CBNAME(bool a, double b, double c, int d); \
1247 void base_##CBNAME(bool a, double b, double c, int d)
1250 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1251 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1253 bool blocked = wxPyBeginBlockThreads(); \
1254 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1255 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1256 wxPyEndBlockThreads(blocked); \
1258 PCLASS::CBNAME(a, b, c, d); \
1260 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1261 PCLASS::CBNAME(a, b, c, d); \
1264 //---------------------------------------------------------------------------
1265 //---------------------------------------------------------------------------
1267 #define DEC_PYCALLBACK__STRING(CBNAME) \
1268 void CBNAME(const wxString& a); \
1269 void base_##CBNAME(const wxString& a)
1271 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1272 void CLASS::CBNAME(const wxString& a) { \
1274 bool blocked = wxPyBeginBlockThreads(); \
1275 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1276 PyObject* s = wx2PyString(a); \
1277 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1280 wxPyEndBlockThreads(blocked); \
1282 PCLASS::CBNAME(a); \
1284 void CLASS::base_##CBNAME(const wxString& a) { \
1285 PCLASS::CBNAME(a); \
1288 //---------------------------------------------------------------------------
1290 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1291 bool CBNAME(const wxString& a); \
1292 bool base_##CBNAME(const wxString& a)
1294 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1295 bool CLASS::CBNAME(const wxString& a) { \
1298 bool blocked = wxPyBeginBlockThreads(); \
1299 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1300 PyObject* s = wx2PyString(a); \
1301 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1304 wxPyEndBlockThreads(blocked); \
1306 rval = PCLASS::CBNAME(a); \
1309 bool CLASS::base_##CBNAME(const wxString& a) { \
1310 return PCLASS::CBNAME(a); \
1313 //---------------------------------------------------------------------------
1315 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1316 bool CBNAME(const wxString& a)
1318 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1319 bool CLASS::CBNAME(const wxString& a) { \
1321 bool blocked = wxPyBeginBlockThreads(); \
1322 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1323 PyObject* s = wx2PyString(a); \
1324 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1327 wxPyEndBlockThreads(blocked); \
1331 //---------------------------------------------------------------------------
1333 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1334 wxString CBNAME(const wxString& a)
1336 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1337 wxString CLASS::CBNAME(const wxString& a) { \
1339 bool blocked = wxPyBeginBlockThreads(); \
1340 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1342 PyObject* s = wx2PyString(a); \
1343 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1346 rval = Py2wxString(ro); \
1350 wxPyEndBlockThreads(blocked); \
1354 //---------------------------------------------------------------------------
1356 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1357 wxString CBNAME(const wxString& a); \
1358 wxString base_##CBNAME(const wxString& a)
1360 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1361 wxString CLASS::CBNAME(const wxString& a) { \
1364 bool blocked = wxPyBeginBlockThreads(); \
1365 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1367 PyObject* s = wx2PyString(a); \
1368 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1371 rval = Py2wxString(ro); \
1376 rval = PCLASS::CBNAME(a); \
1377 wxPyEndBlockThreads(blocked); \
1381 //---------------------------------------------------------------------------
1383 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1384 wxString CBNAME(const wxString& a,int b)
1386 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1387 wxString CLASS::CBNAME(const wxString& a,int b) { \
1389 bool blocked = wxPyBeginBlockThreads(); \
1390 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1392 PyObject* s = wx2PyString(a); \
1393 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1396 rval = Py2wxString(ro); \
1400 wxPyEndBlockThreads(blocked); \
1404 //---------------------------------------------------------------------------
1406 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1407 bool CBNAME(const wxString& a, const wxString& b); \
1408 bool base_##CBNAME(const wxString& a, const wxString& b)
1410 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1411 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1414 bool blocked = wxPyBeginBlockThreads(); \
1415 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1416 PyObject* s1 = wx2PyString(a); \
1417 PyObject* s2 = wx2PyString(b); \
1418 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1422 wxPyEndBlockThreads(blocked); \
1424 rval = PCLASS::CBNAME(a, b); \
1427 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1428 return PCLASS::CBNAME(a, b); \
1431 //---------------------------------------------------------------------------
1433 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1434 wxString CBNAME(); \
1435 wxString base_##CBNAME()
1437 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1438 wxString CLASS::CBNAME() { \
1441 bool blocked = wxPyBeginBlockThreads(); \
1442 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1444 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1446 rval = Py2wxString(ro); \
1450 wxPyEndBlockThreads(blocked); \
1452 rval = PCLASS::CBNAME(); \
1455 wxString CLASS::base_##CBNAME() { \
1456 return PCLASS::CBNAME(); \
1459 //---------------------------------------------------------------------------
1461 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1462 wxString CBNAME() const; \
1463 wxString base_##CBNAME() const;
1465 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1466 wxString CLASS::CBNAME() const { \
1469 bool blocked = wxPyBeginBlockThreads(); \
1470 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1472 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1474 rval = Py2wxString(ro); \
1478 wxPyEndBlockThreads(blocked); \
1480 rval = PCLASS::CBNAME(); \
1483 wxString CLASS::base_##CBNAME() const { \
1484 return PCLASS::CBNAME(); \
1487 //---------------------------------------------------------------------------
1489 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1492 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1493 wxString CLASS::CBNAME() { \
1495 bool blocked = wxPyBeginBlockThreads(); \
1496 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1498 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1500 rval = Py2wxString(ro); \
1504 wxPyEndBlockThreads(blocked); \
1508 //---------------------------------------------------------------------------
1510 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1511 wxString CBNAME() const;
1513 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1514 wxString CLASS::CBNAME() const { \
1516 bool blocked = wxPyBeginBlockThreads(); \
1517 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1519 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1521 rval = Py2wxString(ro); \
1525 wxPyEndBlockThreads(blocked); \
1529 //---------------------------------------------------------------------------
1531 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1532 bool CBNAME(const wxHtmlTag& a)
1535 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1536 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1538 bool blocked = wxPyBeginBlockThreads(); \
1539 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1540 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1541 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1544 wxPyEndBlockThreads(blocked); \
1548 //---------------------------------------------------------------------------
1550 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1551 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1552 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1554 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1555 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1557 bool blocked = wxPyBeginBlockThreads(); \
1558 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1559 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1560 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1563 wxPyEndBlockThreads(blocked); \
1565 PCLASS::CBNAME(cell, x, y); \
1567 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1568 PCLASS::CBNAME(cell, x, y); \
1571 //---------------------------------------------------------------------------
1573 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1574 void CBNAME(const wxColour& c); \
1575 void base_##CBNAME(const wxColour& c)
1577 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1578 void CLASS::CBNAME(const wxColour& c) { \
1580 bool blocked = wxPyBeginBlockThreads(); \
1581 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1582 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1583 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1586 wxPyEndBlockThreads(blocked); \
1588 PCLASS::CBNAME(c); \
1590 void CLASS::base_##CBNAME(const wxColour& c) { \
1591 PCLASS::CBNAME(c); \
1594 //---------------------------------------------------------------------------
1596 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1597 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1598 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1600 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1601 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1603 bool blocked = wxPyBeginBlockThreads(); \
1604 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1605 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1606 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1607 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1611 wxPyEndBlockThreads(blocked); \
1613 PCLASS::CBNAME(cell, x, y, e); \
1615 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1616 PCLASS::CBNAME(cell, x, y, e); \
1621 //---------------------------------------------------------------------------
1623 #define DEC_PYCALLBACK___pure(CBNAME) \
1627 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1628 void CLASS::CBNAME() { \
1629 bool blocked = wxPyBeginBlockThreads(); \
1630 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1631 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1632 wxPyEndBlockThreads(blocked); \
1635 //---------------------------------------------------------------------------
1637 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1641 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1642 wxSize CLASS::CBNAME() { \
1643 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1645 bool blocked = wxPyBeginBlockThreads(); \
1646 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1649 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1651 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1653 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1654 PyObject* o1 = PySequence_GetItem(ro, 0); \
1655 PyObject* o2 = PySequence_GetItem(ro, 1); \
1656 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1657 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1659 PyErr_SetString(PyExc_TypeError, errmsg); \
1664 PyErr_SetString(PyExc_TypeError, errmsg); \
1669 wxPyEndBlockThreads(blocked); \
1673 //---------------------------------------------------------------------------
1675 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1676 bool CBNAME(wxWindow* a); \
1677 bool base_##CBNAME(wxWindow* a)
1680 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1681 bool CLASS::CBNAME(wxWindow* a) { \
1684 bool blocked = wxPyBeginBlockThreads(); \
1685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1686 PyObject* obj = wxPyMake_wxObject(a,false); \
1687 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1690 wxPyEndBlockThreads(blocked); \
1692 rval = PCLASS::CBNAME(a); \
1695 bool CLASS::base_##CBNAME(wxWindow* a) { \
1696 return PCLASS::CBNAME(a); \
1699 //---------------------------------------------------------------------------
1701 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1702 bool CBNAME(wxWindow* a, wxDC& b); \
1703 bool base_##CBNAME(wxWindow* a, wxDC& b)
1706 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1707 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1710 bool blocked = wxPyBeginBlockThreads(); \
1711 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1712 PyObject* win = wxPyMake_wxObject(a,false); \
1713 PyObject* dc = wxPyMake_wxObject(&b,false); \
1714 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1718 wxPyEndBlockThreads(blocked); \
1720 rval = PCLASS::CBNAME(a, b); \
1723 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1724 return PCLASS::CBNAME(a, b); \
1727 //---------------------------------------------------------------------------
1729 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1730 void CBNAME(wxWindowBase* a); \
1731 void base_##CBNAME(wxWindowBase* a)
1734 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1735 void CLASS::CBNAME(wxWindowBase* a) { \
1737 bool blocked = wxPyBeginBlockThreads(); \
1738 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1739 PyObject* obj = wxPyMake_wxObject(a,false); \
1740 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1743 wxPyEndBlockThreads(blocked); \
1745 PCLASS::CBNAME(a); \
1747 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1748 PCLASS::CBNAME(a); \
1751 //---------------------------------------------------------------------------
1753 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1755 bool base_##CBNAME()
1758 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1759 bool CLASS::CBNAME() { \
1762 bool blocked = wxPyBeginBlockThreads(); \
1763 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1764 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1765 wxPyEndBlockThreads(blocked); \
1767 rval = PCLASS::CBNAME(); \
1770 bool CLASS::base_##CBNAME() { \
1771 return PCLASS::CBNAME(); \
1774 //---------------------------------------------------------------------------
1776 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1777 bool CBNAME() const; \
1778 bool base_##CBNAME() const
1781 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1782 bool CLASS::CBNAME() const { \
1785 bool blocked = wxPyBeginBlockThreads(); \
1786 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1787 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1788 wxPyEndBlockThreads(blocked); \
1790 rval = PCLASS::CBNAME(); \
1793 bool CLASS::base_##CBNAME() const { \
1794 return PCLASS::CBNAME(); \
1797 //---------------------------------------------------------------------------
1799 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1800 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1801 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1804 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1805 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1808 bool blocked = wxPyBeginBlockThreads(); \
1809 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1810 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1811 wxPyEndBlockThreads(blocked); \
1813 rval = PCLASS::CBNAME(a, b, c); \
1814 return (wxDragResult)rval; \
1816 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1817 return PCLASS::CBNAME(a, b, c); \
1820 //---------------------------------------------------------------------------
1822 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1823 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1825 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1826 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1827 bool blocked = wxPyBeginBlockThreads(); \
1829 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1831 PyObject* obj = wxPyMake_wxObject(&a,false); \
1832 PyObject* s = wx2PyString(b); \
1833 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1836 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1842 wxPyEndBlockThreads(blocked); \
1846 //---------------------------------------------------------------------------
1848 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1849 bool CBNAME(wxDragResult a); \
1850 bool base_##CBNAME(wxDragResult a)
1853 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1854 bool CLASS::CBNAME(wxDragResult a) { \
1857 bool blocked = wxPyBeginBlockThreads(); \
1858 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1859 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1860 wxPyEndBlockThreads(blocked); \
1862 rval = PCLASS::CBNAME(a); \
1865 bool CLASS::base_##CBNAME(wxDragResult a) { \
1866 return PCLASS::CBNAME(a); \
1869 //---------------------------------------------------------------------------
1871 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1872 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1875 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1876 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1877 bool blocked = wxPyBeginBlockThreads(); \
1879 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1880 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1881 wxPyEndBlockThreads(blocked); \
1882 return (wxDragResult)rval; \
1885 //---------------------------------------------------------------------------
1887 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1888 bool CBNAME(int a, int b, const wxString& c)
1890 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1891 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1893 bool blocked = wxPyBeginBlockThreads(); \
1894 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1895 PyObject* s = wx2PyString(c); \
1896 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1899 wxPyEndBlockThreads(blocked); \
1903 //---------------------------------------------------------------------------
1905 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1907 size_t base_##CBNAME()
1910 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1911 size_t CLASS::CBNAME() { \
1914 bool blocked = wxPyBeginBlockThreads(); \
1915 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1916 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1917 wxPyEndBlockThreads(blocked); \
1919 rval = PCLASS::CBNAME(); \
1922 size_t CLASS::base_##CBNAME() { \
1923 return PCLASS::CBNAME(); \
1926 //---------------------------------------------------------------------------
1928 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1929 size_t CBNAME() const; \
1930 size_t base_##CBNAME() const
1933 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1934 size_t CLASS::CBNAME() const { \
1937 bool blocked = wxPyBeginBlockThreads(); \
1938 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1939 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1940 wxPyEndBlockThreads(blocked); \
1942 rval = PCLASS::CBNAME(); \
1945 size_t CLASS::base_##CBNAME() const { \
1946 return PCLASS::CBNAME(); \
1949 //---------------------------------------------------------------------------
1951 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1952 wxDataFormat CBNAME(size_t a); \
1953 wxDataFormat base_##CBNAME(size_t a)
1956 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1957 wxDataFormat CLASS::CBNAME(size_t a) { \
1958 wxDataFormat rval=0; \
1960 bool blocked = wxPyBeginBlockThreads(); \
1961 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1963 wxDataFormat* ptr; \
1964 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1966 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1971 wxPyEndBlockThreads(blocked); \
1973 rval = PCLASS::CBNAME(a); \
1976 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1977 return PCLASS::CBNAME(a); \
1980 //---------------------------------------------------------------------------
1982 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1983 void CBNAME(const Type& a); \
1984 void base_##CBNAME(const Type& a)
1987 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1988 void CLASS::CBNAME(const Type& a) { \
1990 bool blocked = wxPyBeginBlockThreads(); \
1991 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1992 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1993 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1996 wxPyEndBlockThreads(blocked); \
1998 PCLASS::CBNAME(a); \
2000 void CLASS::base_##CBNAME(const Type& a) { \
2001 PCLASS::CBNAME(a); \
2005 //---------------------------------------------------------------------------
2007 #define DEC_PYCALLBACK__any(CBNAME, Type) \
2008 void CBNAME(Type& a); \
2009 void base_##CBNAME(Type& a)
2012 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2013 void CLASS::CBNAME(Type& a) { \
2015 bool blocked = wxPyBeginBlockThreads(); \
2016 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2017 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2018 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2021 wxPyEndBlockThreads(blocked); \
2023 PCLASS::CBNAME(a); \
2025 void CLASS::base_##CBNAME(Type& a) { \
2026 PCLASS::CBNAME(a); \
2029 //---------------------------------------------------------------------------
2031 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2032 bool CBNAME(Type& a); \
2033 bool base_##CBNAME(Type& a)
2036 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2037 bool CLASS::CBNAME(Type& a) { \
2040 bool blocked = wxPyBeginBlockThreads(); \
2041 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2042 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2043 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2046 wxPyEndBlockThreads(blocked); \
2048 rv = PCLASS::CBNAME(a); \
2051 bool CLASS::base_##CBNAME(Type& a) { \
2052 return PCLASS::CBNAME(a); \
2055 //---------------------------------------------------------------------------
2057 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2058 bool CBNAME(Type& a)
2061 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2062 bool CLASS::CBNAME(Type& a) { \
2064 bool blocked = wxPyBeginBlockThreads(); \
2065 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2066 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2067 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2070 wxPyEndBlockThreads(blocked); \
2074 //---------------------------------------------------------------------------
2076 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2077 wxString CBNAME(long a, long b) const; \
2078 wxString base_##CBNAME(long a, long b) const
2080 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2081 wxString CLASS::CBNAME(long a, long b) const { \
2084 bool blocked = wxPyBeginBlockThreads(); \
2085 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2087 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2089 rval = Py2wxString(ro); \
2093 wxPyEndBlockThreads(blocked); \
2095 rval = PCLASS::CBNAME(a,b); \
2098 wxString CLASS::base_##CBNAME(long a, long b) const { \
2099 return PCLASS::CBNAME(a,b); \
2102 //---------------------------------------------------------------------------
2104 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2105 int CBNAME(long a) const; \
2106 int base_##CBNAME(long a) const
2109 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2110 int CLASS::CBNAME(long a) const { \
2113 bool blocked = wxPyBeginBlockThreads(); \
2114 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2116 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2118 rval = PyInt_AsLong(ro); \
2122 wxPyEndBlockThreads(blocked); \
2124 rval = PCLASS::CBNAME(a); \
2127 int CLASS::base_##CBNAME(long a) const { \
2128 return PCLASS::CBNAME(a); \
2134 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2135 int CBNAME(long a) const;
2138 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2139 int CLASS::CBNAME(long a) const { \
2140 int rval=-1; /* this rval is important for OnGetItemImage */ \
2142 bool blocked = wxPyBeginBlockThreads(); \
2143 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2145 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2147 rval = PyInt_AsLong(ro); \
2151 wxPyEndBlockThreads(blocked); \
2156 //---------------------------------------------------------------------------
2158 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2159 wxListItemAttr* CBNAME(long a) const; \
2160 wxListItemAttr* base_##CBNAME(long a) const
2163 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2164 wxListItemAttr *CLASS::CBNAME(long a) const { \
2165 wxListItemAttr *rval = NULL; \
2167 bool blocked = wxPyBeginBlockThreads(); \
2168 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2170 wxListItemAttr* ptr; \
2171 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2173 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2178 wxPyEndBlockThreads(blocked); \
2180 rval = PCLASS::CBNAME(a); \
2183 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2184 return PCLASS::CBNAME(a); \
2187 //---------------------------------------------------------------------------
2189 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2190 bool CBNAME(wxMouseEvent& e); \
2191 bool base_##CBNAME(wxMouseEvent& e)
2193 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2194 bool CLASS::CBNAME(wxMouseEvent& e) { \
2197 bool blocked = wxPyBeginBlockThreads(); \
2198 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2200 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2201 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2203 rval = PyInt_AsLong(ro); \
2208 wxPyEndBlockThreads(blocked); \
2210 return PCLASS::CBNAME(e); \
2213 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2214 return PCLASS::CBNAME(e); \
2218 //---------------------------------------------------------------------------
2220 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2221 wxWizardPage* CBNAME() const
2223 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2224 wxWizardPage* CLASS::CBNAME() const { \
2225 wxWizardPage* rv = NULL; \
2226 bool blocked = wxPyBeginBlockThreads(); \
2227 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2229 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2231 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2235 wxPyEndBlockThreads(blocked); \
2239 //---------------------------------------------------------------------------
2241 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2242 wxBitmap CBNAME() const
2244 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2245 wxBitmap CLASS::CBNAME() const { \
2247 bool blocked = wxPyBeginBlockThreads(); \
2248 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2251 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2253 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2258 wxPyEndBlockThreads(blocked); \
2262 //---------------------------------------------------------------------------
2264 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2267 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2268 wxObject* CLASS::CBNAME() { \
2269 wxObject* rv = NULL; \
2270 bool blocked = wxPyBeginBlockThreads(); \
2271 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2273 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2275 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2279 wxPyEndBlockThreads(blocked); \
2283 //---------------------------------------------------------------------------
2285 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2286 wxObject* CBNAME(const wxString& a)
2288 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2289 wxObject* CLASS::CBNAME(const wxString& a) { \
2290 wxObject* rv = NULL; \
2291 bool blocked = wxPyBeginBlockThreads(); \
2292 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2293 PyObject* so = wx2PyString(a); \
2295 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2297 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2302 wxPyEndBlockThreads(blocked); \
2306 //---------------------------------------------------------------------------
2308 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2309 bool CBNAME(wxXmlNode* a)
2312 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2313 bool CLASS::CBNAME(wxXmlNode* a) { \
2315 bool blocked = wxPyBeginBlockThreads(); \
2316 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2317 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2318 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2321 wxPyEndBlockThreads(blocked); \
2325 //---------------------------------------------------------------------------
2327 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2328 wxCoord CBNAME(size_t a) const
2331 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2332 wxCoord CLASS::CBNAME(size_t a) const { \
2335 bool blocked = wxPyBeginBlockThreads(); \
2336 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2337 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2339 wxPyEndBlockThreads(blocked); \
2343 //---------------------------------------------------------------------------
2345 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2346 void CBNAME(size_t a, size_t b) const; \
2347 void base_##CBNAME(size_t a, size_t b) const
2350 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2351 void CLASS::CBNAME(size_t a, size_t b) const { \
2353 bool blocked = wxPyBeginBlockThreads(); \
2354 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2355 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2356 wxPyEndBlockThreads(blocked); \
2358 PCLASS::CBNAME(a,b); \
2360 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2361 PCLASS::CBNAME(a,b); \
2364 //---------------------------------------------------------------------------
2366 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2367 wxCoord CBNAME() const; \
2368 wxCoord base_##CBNAME() const
2371 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2372 wxCoord CLASS::CBNAME() const { \
2375 bool blocked = wxPyBeginBlockThreads(); \
2376 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2377 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2378 wxPyEndBlockThreads(blocked); \
2380 rval = PCLASS::CBNAME(); \
2383 wxCoord CLASS::base_##CBNAME() const { \
2384 return PCLASS::CBNAME(); \
2387 //---------------------------------------------------------------------------
2389 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2390 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2393 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2394 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2396 bool blocked = wxPyBeginBlockThreads(); \
2397 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2398 PyObject* obj = wxPyMake_wxObject(&a,false); \
2399 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2400 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2403 wxPyEndBlockThreads(blocked); \
2406 //---------------------------------------------------------------------------
2408 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2409 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2410 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2413 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2414 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2416 bool blocked = wxPyBeginBlockThreads(); \
2417 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2418 PyObject* obj = wxPyMake_wxObject(&a,false); \
2419 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2420 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2423 wxPyEndBlockThreads(blocked); \
2425 PCLASS::CBNAME(a,b,c); \
2427 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2428 PCLASS::CBNAME(a,b,c); \
2431 //---------------------------------------------------------------------------
2434 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2435 wxString CBNAME(size_t a) const; \
2436 wxString base_##CBNAME(size_t a) const
2438 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2439 wxString CLASS::CBNAME(size_t a) const { \
2442 bool blocked = wxPyBeginBlockThreads(); \
2443 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2445 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2447 rval = Py2wxString(ro); \
2451 wxPyEndBlockThreads(blocked); \
2453 rval = PCLASS::CBNAME(a); \
2456 wxString CLASS::base_##CBNAME(size_t a) const { \
2457 return PCLASS::CBNAME(a); \
2460 //---------------------------------------------------------------------------
2462 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2463 wxString CBNAME(size_t a) const
2465 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2466 wxString CLASS::CBNAME(size_t a) const { \
2469 bool blocked = wxPyBeginBlockThreads(); \
2470 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2472 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2474 rval = Py2wxString(ro); \
2478 wxPyEndBlockThreads(blocked); \
2482 //---------------------------------------------------------------------------
2484 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2485 wxVisualAttributes CBNAME() const; \
2486 wxVisualAttributes base_##CBNAME()
2489 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2490 wxVisualAttributes CLASS::CBNAME() const { \
2491 wxVisualAttributes rval; \
2493 bool blocked = wxPyBeginBlockThreads(); \
2494 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2496 wxVisualAttributes* ptr; \
2497 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2499 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2504 wxPyEndBlockThreads(blocked); \
2506 rval = PCLASS::CBNAME(); \
2509 wxVisualAttributes CLASS::base_##CBNAME() { \
2510 return PCLASS::CBNAME(); \
2513 //---------------------------------------------------------------------------