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
);
95 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
98 bool wxPyCheckSwigType(const wxChar
* className
);
99 PyObject
* wxPyConstructObject(void* ptr
,
100 const wxChar
* className
,
102 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
103 const wxChar
* className
);
104 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
107 PyObject
* wx2PyString(const wxString
& src
);
108 wxString
Py2wxString(PyObject
* source
);
110 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
111 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
112 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
114 PyObject
* wxPy_ConvertList(wxListBase
* list
);
115 long wxPyGetWinHandle(wxWindow
* win
);
117 void wxPy_ReinitStockObjects(int pass
);
119 bool wxPyInstance_Check(PyObject
* obj
);
120 bool wxPySwigInstance_Check(PyObject
* obj
);
123 #endif // wxPyUSE_EXPORTED_API
124 //---------------------------------------------------------------------------
126 // if we want to handle threads and Python threads are available...
127 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
128 #define WXP_WITH_THREAD
129 #else // no Python threads...
130 #undef WXP_WITH_THREAD
133 #ifndef wxPyUSE_EXPORTED_API
135 // For Python --> C++
136 PyThreadState
* wxPyBeginAllowThreads();
137 void wxPyEndAllowThreads(PyThreadState
* state
);
139 // For C++ --> Python
140 bool wxPyBeginBlockThreads();
141 void wxPyEndBlockThreads(bool blocked
);
143 #endif // wxPyUSE_EXPORTED_API
146 // A macro that will help to execute simple statments wrapped in
147 // StartBlock/EndBlockThreads calls
148 #define wxPyBLOCK_THREADS(stmt) \
149 { bool blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
151 // Raise the NotImplementedError exception (blocking threads)
152 #define wxPyRaiseNotImplemented() \
153 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
155 // Raise any exception witha string value (blocking threads)
156 #define wxPyErr_SetString(err, str) \
157 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
160 //---------------------------------------------------------------------------
161 // These are helpers used by the typemaps
163 #ifndef wxPyUSE_EXPORTED_API
165 wxString
* wxString_in_helper(PyObject
* source
);
167 byte
* byte_LIST_helper(PyObject
* source
);
168 int* int_LIST_helper(PyObject
* source
);
169 long* long_LIST_helper(PyObject
* source
);
170 char** string_LIST_helper(PyObject
* source
);
171 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
172 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
173 wxString
* wxString_LIST_helper(PyObject
* source
);
174 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
175 wxPen
** wxPen_LIST_helper(PyObject
* source
);
177 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
178 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
179 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
180 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
181 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
182 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
185 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
186 bool wxColour_typecheck(PyObject
* source
);
188 bool wxPyCheckForApp();
192 bool wxPyTwoIntItem_helper(PyObject
* source
, T
** obj
, const wxChar
* name
)
194 // If source is an object instance then it may already be the right type
195 if (wxPySwigInstance_Check(source
)) {
197 if (! wxPyConvertSwigPtr(source
, (void **)&ptr
, name
))
202 // otherwise a 2-tuple of integers is expected
203 else if (PySequence_Check(source
) && PyObject_Length(source
) == 2) {
204 PyObject
* o1
= PySequence_GetItem(source
, 0);
205 PyObject
* o2
= PySequence_GetItem(source
, 1);
206 if (!PyNumber_Check(o1
) || !PyNumber_Check(o2
)) {
211 **obj
= T(PyInt_AsLong(o1
), PyInt_AsLong(o2
));
219 msg
.Printf(wxT("Expected a 2-tuple of integers or a %s object."), name
);
220 PyErr_SetString(PyExc_TypeError
, msg
.mb_str());
226 // Other helpful stuff
227 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
228 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
230 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
231 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
233 #endif // wxPyUSE_EXPORTED_API
235 //---------------------------------------------------------------------------
237 #if PYTHON_API_VERSION < 1009
238 #define PySequence_Fast_GET_ITEM(o, i) \
239 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
242 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
243 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
244 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
246 //---------------------------------------------------------------------------
248 #ifndef wxPyUSE_EXPORTED_API
250 class wxPyCallback
: public wxObject
{
251 DECLARE_ABSTRACT_CLASS(wxPyCallback
);
253 wxPyCallback(PyObject
* func
);
254 wxPyCallback(const wxPyCallback
& other
);
257 void EventThunker(wxEvent
& event
);
262 #endif // wxPyUSE_EXPORTED_API
263 //---------------------------------------------------------------------------
264 //---------------------------------------------------------------------------
265 // These Event classes can be derived from in Python and passed through the
266 // event system without loosing anything. They do this by keeping a reference
267 // to themselves and some special case handling in wxPyCallback::EventThunker.
271 class wxPyEvtSelfRef
{
276 void SetSelf(PyObject
* self
, bool clone
=false);
277 PyObject
* GetSelf() const;
278 bool GetCloned() const { return m_cloned
; }
286 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
287 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
289 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
290 wxPyEvent(const wxPyEvent
& evt
);
293 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
297 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
298 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
300 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
301 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
304 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
309 //----------------------------------------------------------------------
310 // Forward decalre a few things used in the exported API
311 class wxPyClientData
;
313 class wxPyOORClientData
;
314 class wxPyCBInputStream
;
316 void wxPyClientData_dtor(wxPyClientData
* self
);
317 void wxPyUserData_dtor(wxPyUserData
* self
);
318 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
319 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
322 //---------------------------------------------------------------------------
323 // Export a C API in a struct. Other modules will be able to load this from
324 // the wx.core module and will then have safe access to these functions, even if
325 // in another shared library.
327 class wxPyCallbackHelper
;
328 struct swig_type_info
;
329 struct swig_const_info
;
331 typedef double (*py_objasdbl_conv
)(PyObject
*obj
);
333 // Make SunCC happy and make typedef's for these that are extern "C"
334 typedef swig_type_info
* (*p_SWIG_Python_TypeRegister_t
)(swig_type_info
*);
335 typedef swig_type_info
* (*p_SWIG_Python_TypeCheck_t
)(char *c
, swig_type_info
*);
336 typedef void* (*p_SWIG_Python_TypeCast_t
)(swig_type_info
*, void *);
337 typedef swig_type_info
* (*p_SWIG_Python_TypeDynamicCast_t
)(swig_type_info
*, void **);
338 typedef const char* (*p_SWIG_Python_TypeName_t
)(const swig_type_info
*);
339 typedef const char * (*p_SWIG_Python_TypePrettyName_t
)(const swig_type_info
*);
340 typedef swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *);
341 typedef void (*p_SWIG_Python_TypeClientData_t
)(swig_type_info
*, void *);
342 typedef PyObject
* (*p_SWIG_Python_newvarlink_t
)(void);
343 typedef void (*p_SWIG_Python_addvarlink_t
)(PyObject
*, char *, PyObject
*(*)(void), int (*)(PyObject
*));
344 typedef int (*p_SWIG_Python_ConvertPtr_t
)(PyObject
*, void **, swig_type_info
*, int);
345 typedef int (*p_SWIG_Python_ConvertPacked_t
)(PyObject
*, void *, int sz
, swig_type_info
*, int);
346 typedef char* (*p_SWIG_Python_PackData_t
)(char *c
, void *, int);
347 typedef char* (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int);
348 typedef PyObject
* (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info
*,int own
);
349 typedef PyObject
* (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info
*);
350 typedef void (*p_SWIG_Python_InstallConstants_t
)(PyObject
*d
, swig_const_info constants
[]);
351 typedef void* (*p_SWIG_Python_MustGetPtr_t
)(PyObject
*, swig_type_info
*, int, int);
356 p_SWIG_Python_TypeRegister_t p_SWIG_Python_TypeRegister
;
357 p_SWIG_Python_TypeCheck_t p_SWIG_Python_TypeCheck
;
358 p_SWIG_Python_TypeCast_t p_SWIG_Python_TypeCast
;
359 p_SWIG_Python_TypeDynamicCast_t p_SWIG_Python_TypeDynamicCast
;
360 p_SWIG_Python_TypeName_t p_SWIG_Python_TypeName
;
361 p_SWIG_Python_TypePrettyName_t p_SWIG_Python_TypePrettyName
;
362 p_SWIG_Python_TypeQuery_t p_SWIG_Python_TypeQuery
;
363 p_SWIG_Python_TypeClientData_t p_SWIG_Python_TypeClientData
;
364 p_SWIG_Python_newvarlink_t p_SWIG_Python_newvarlink
;
365 p_SWIG_Python_addvarlink_t p_SWIG_Python_addvarlink
;
366 p_SWIG_Python_ConvertPtr_t p_SWIG_Python_ConvertPtr
;
367 p_SWIG_Python_ConvertPacked_t p_SWIG_Python_ConvertPacked
;
368 p_SWIG_Python_PackData_t p_SWIG_Python_PackData
;
369 p_SWIG_Python_UnpackData_t p_SWIG_Python_UnpackData
;
370 p_SWIG_Python_NewPointerObj_t p_SWIG_Python_NewPointerObj
;
371 p_SWIG_Python_NewPackedObj_t p_SWIG_Python_NewPackedObj
;
372 p_SWIG_Python_InstallConstants_t p_SWIG_Python_InstallConstants
;
373 p_SWIG_Python_MustGetPtr_t p_SWIG_Python_MustGetPtr
;
375 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
376 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
377 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
378 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
380 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
381 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
382 bool (*p_wxPyBeginBlockThreads
)();
383 void (*p_wxPyEndBlockThreads
)(bool blocked
);
385 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
387 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
388 wxString (*p_Py2wxString
)(PyObject
* source
);
389 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
391 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
392 int* (*p_int_LIST_helper
)(PyObject
* source
);
393 long* (*p_long_LIST_helper
)(PyObject
* source
);
394 char** (*p_string_LIST_helper
)(PyObject
* source
);
395 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
396 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
397 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
398 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
400 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
401 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
402 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
403 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
404 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
405 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
);
408 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
409 bool (*p_wxColour_typecheck
)(PyObject
* source
);
411 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
412 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
);
413 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
414 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
415 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
417 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
418 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
419 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
420 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
421 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
422 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
423 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
425 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
426 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
427 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
429 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
431 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
432 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
434 bool (*p_wxPyCheckForApp
)();
438 #ifdef wxPyUSE_EXPORTED_API
439 // Notice that this is static, not extern. This is by design, each module
440 // needs one, but doesn't have to use it.
441 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
442 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
443 #endif // wxPyUSE_EXPORTED_API
445 //---------------------------------------------------------------------------
447 // A wxObject that holds a reference to a Python object
448 class wxPyUserData
: public wxObject
{
450 wxPyUserData(PyObject
* obj
) {
456 #ifdef wxPyUSE_EXPORTED_API
457 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
459 wxPyUserData_dtor(this);
466 // A wxClientData that holds a refernece to a Python object
467 class wxPyClientData
: public wxClientData
{
469 wxPyClientData(PyObject
* obj
) {
475 #ifdef wxPyUSE_EXPORTED_API
476 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
478 wxPyClientData_dtor(this);
485 // Just like wxPyClientData, except when this object is destroyed it does some
486 // OOR magic on the Python Object.
487 class wxPyOORClientData
: public wxPyClientData
{
489 wxPyOORClientData(PyObject
* obj
)
490 : wxPyClientData(obj
) {}
492 ~wxPyOORClientData() {
493 #ifdef wxPyUSE_EXPORTED_API
494 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
496 wxPyOORClientData_dtor(this);
502 //---------------------------------------------------------------------------
503 // This class holds an instance of a Python Shadow Class object and assists
504 // with looking up and invoking Python callback methods from C++ virtual
505 // method redirections. For all classes which have virtuals which should be
506 // overridable in wxPython, a new subclass is created that contains a
507 // wxPyCallbackHelper.
510 class wxPyCallbackHelper
{
512 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
514 wxPyCallbackHelper() {
521 ~wxPyCallbackHelper() {
522 #ifdef wxPyUSE_EXPORTED_API
523 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
525 wxPyCBH_delete(this);
529 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
530 bool findCallback(const char* name
) const;
531 int callCallback(PyObject
* argTuple
) const;
532 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
533 PyObject
* GetLastFound() const { return m_lastFound
; }
538 PyObject
* m_lastFound
;
541 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
545 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
546 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
);
547 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
548 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
549 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
554 //---------------------------------------------------------------------------
556 // This is used in C++ classes that need to be able to make callback to
557 // "overloaded" python methods
560 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
561 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
563 private: wxPyCallbackHelper m_myInst
566 //---------------------------------------------------------------------------
567 // The wxPythonApp class
570 wxPYAPP_ASSERT_SUPPRESS
= 1,
571 wxPYAPP_ASSERT_EXCEPTION
= 2,
572 wxPYAPP_ASSERT_DIALOG
= 4,
573 wxPYAPP_ASSERT_LOG
= 8
576 class wxPyApp
: public wxApp
578 DECLARE_ABSTRACT_CLASS(wxPyApp
);
586 int GetAssertMode() { return m_assertMode
; }
587 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
589 virtual bool OnInitGui();
590 virtual int OnExit();
592 virtual void OnAssert(const wxChar
*file
,
597 // virtual int FilterEvent(wxEvent& event); // This one too????
599 // For catching Apple Events
600 virtual void MacOpenFile(const wxString
&fileName
);
601 virtual void MacPrintFile(const wxString
&fileName
);
602 virtual void MacNewFile();
603 virtual void MacReopenApp();
605 static bool GetMacSupportPCMenuShortcuts();
606 static long GetMacAboutMenuItemId();
607 static long GetMacPreferencesMenuItemId();
608 static long GetMacExitMenuItemId();
609 static wxString
GetMacHelpMenuTitleName();
611 static void SetMacSupportPCMenuShortcuts(bool val
);
612 static void SetMacAboutMenuItemId(long val
);
613 static void SetMacPreferencesMenuItemId(long val
);
614 static void SetMacExitMenuItemId(long val
);
615 static void SetMacHelpMenuTitleName(const wxString
& val
);
618 void _BootstrapApp();
620 // implementation only
621 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
625 bool m_startupComplete
;
628 extern wxPyApp
*wxPythonApp
;
631 //----------------------------------------------------------------------
632 // These macros are used to implement the virtual methods that should
633 // redirect to a Python method if one exists. The names designate the
634 // return type, if any, as well as any parameter types.
635 //---------------------------------------------------------------------------
637 #define DEC_PYCALLBACK__(CBNAME) \
642 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
643 void CLASS::CBNAME() { \
645 bool blocked = wxPyBeginBlockThreads(); \
646 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
647 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
648 wxPyEndBlockThreads(blocked); \
652 void CLASS::base_##CBNAME() { \
656 //---------------------------------------------------------------------------
658 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
659 bool CBNAME(int a, int b); \
660 bool base_##CBNAME(int a, int b)
663 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
664 bool CLASS::CBNAME(int a, int b) { \
665 bool rval=false, found; \
666 bool blocked = wxPyBeginBlockThreads(); \
667 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
668 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
669 wxPyEndBlockThreads(blocked); \
671 rval = PCLASS::CBNAME(a,b); \
674 bool CLASS::base_##CBNAME(int a, int b) { \
675 return PCLASS::CBNAME(a,b); \
678 //---------------------------------------------------------------------------
680 #define DEC_PYCALLBACK_VOID_(CBNAME) \
685 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
686 void CLASS::CBNAME() { \
688 bool blocked = wxPyBeginBlockThreads(); \
689 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
690 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
691 wxPyEndBlockThreads(blocked); \
695 void CLASS::base_##CBNAME() { \
699 //---------------------------------------------------------------------------
701 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
702 void CBNAME(int a, int b); \
703 void base_##CBNAME(int a, int b)
706 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
707 void CLASS::CBNAME(int a, int b) { \
709 bool blocked = wxPyBeginBlockThreads(); \
710 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
711 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
712 wxPyEndBlockThreads(blocked); \
714 PCLASS::CBNAME(a,b); \
716 void CLASS::base_##CBNAME(int a, int b) { \
717 PCLASS::CBNAME(a,b); \
720 //---------------------------------------------------------------------------
722 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
723 void CBNAME(int a); \
724 void base_##CBNAME(int a)
727 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
728 void CLASS::CBNAME(int a) { \
730 bool blocked = wxPyBeginBlockThreads(); \
731 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
732 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
733 wxPyEndBlockThreads(blocked); \
737 void CLASS::base_##CBNAME(int a) { \
741 //---------------------------------------------------------------------------
743 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
744 void CBNAME(int a, int b, int c, int d); \
745 void base_##CBNAME(int a, int b, int c, int d)
748 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
749 void CLASS::CBNAME(int a, int b, int c, int d) { \
751 bool blocked = wxPyBeginBlockThreads(); \
752 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
753 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
754 wxPyEndBlockThreads(blocked); \
756 PCLASS::CBNAME(a,b,c,d); \
758 void CLASS::base_##CBNAME(int a, int b, int c, int d) { \
759 PCLASS::CBNAME(a,b,c,d); \
762 //---------------------------------------------------------------------------
763 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
764 void CBNAME(int a, int b, int c, int d, int e); \
765 void base_##CBNAME(int a, int b, int c, int d, int e)
768 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
769 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
771 bool blocked = wxPyBeginBlockThreads(); \
772 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
773 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
774 wxPyEndBlockThreads(blocked); \
776 PCLASS::CBNAME(a,b,c,d,e); \
778 void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \
779 PCLASS::CBNAME(a,b,c,d,e); \
782 //---------------------------------------------------------------------------
784 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
785 void CBNAME(int* a, int* b) const; \
786 void base_##CBNAME(int* a, int* b) const
789 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
790 void CLASS::CBNAME(int* a, int* b) const { \
791 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
793 bool blocked = wxPyBeginBlockThreads(); \
794 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
796 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
798 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
799 PyObject* o1 = PySequence_GetItem(ro, 0); \
800 PyObject* o2 = PySequence_GetItem(ro, 1); \
801 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
802 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
805 PyErr_SetString(PyExc_TypeError, errmsg); \
810 PyErr_SetString(PyExc_TypeError, errmsg); \
815 wxPyEndBlockThreads(blocked); \
817 PCLASS::CBNAME(a,b); \
819 void CLASS::base_##CBNAME(int* a, int* b) const { \
820 PCLASS::CBNAME(a,b); \
824 //---------------------------------------------------------------------------
826 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
827 wxSize CBNAME() const; \
828 wxSize base_##CBNAME() const
831 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
832 wxSize CLASS::CBNAME() const { \
833 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
834 bool found; wxSize rval(0,0); \
835 bool blocked = wxPyBeginBlockThreads(); \
836 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
838 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
840 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
841 PyObject* o1 = PySequence_GetItem(ro, 0); \
842 PyObject* o2 = PySequence_GetItem(ro, 1); \
843 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
844 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
847 PyErr_SetString(PyExc_TypeError, errmsg); \
852 PyErr_SetString(PyExc_TypeError, errmsg); \
857 wxPyEndBlockThreads(blocked); \
859 return PCLASS::CBNAME(); \
863 wxSize CLASS::base_##CBNAME() const { \
864 return PCLASS::CBNAME(); \
868 //---------------------------------------------------------------------------
870 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
871 bool CBNAME(bool a); \
872 bool base_##CBNAME(bool a)
875 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
876 bool CLASS::CBNAME(bool a) { \
877 bool rval=false, found; \
878 bool blocked = wxPyBeginBlockThreads(); \
879 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
880 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
881 wxPyEndBlockThreads(blocked); \
883 rval = PCLASS::CBNAME(a); \
886 bool CLASS::base_##CBNAME(bool a) { \
887 return PCLASS::CBNAME(a); \
890 //---------------------------------------------------------------------------
892 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
893 bool CBNAME(int a); \
894 bool base_##CBNAME(int a)
897 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
898 bool CLASS::CBNAME(int a) { \
899 bool rval=false, found; \
900 bool blocked = wxPyBeginBlockThreads(); \
901 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
902 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
903 wxPyEndBlockThreads(blocked); \
905 rval = PCLASS::CBNAME(a); \
908 bool CLASS::base_##CBNAME(int a) { \
909 return PCLASS::CBNAME(a); \
912 //---------------------------------------------------------------------------
914 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
918 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
919 bool CLASS::CBNAME(int a) { \
921 bool blocked = wxPyBeginBlockThreads(); \
922 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
923 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
925 wxPyEndBlockThreads(blocked); \
930 //---------------------------------------------------------------------------
932 #define DEC_PYCALLBACK__DC(CBNAME) \
933 void CBNAME(wxDC& a); \
934 void base_##CBNAME(wxDC& a)
937 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
938 void CLASS::CBNAME(wxDC& a) { \
940 bool blocked = wxPyBeginBlockThreads(); \
941 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
942 PyObject* obj = wxPyMake_wxObject(&a,false); \
943 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
946 wxPyEndBlockThreads(blocked); \
950 void CLASS::base_##CBNAME(wxDC& a) { \
956 //---------------------------------------------------------------------------
958 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
959 void CBNAME(wxDC& a, bool b); \
960 void base_##CBNAME(wxDC& a, bool b)
963 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
964 void CLASS::CBNAME(wxDC& a, bool b) { \
966 bool blocked = wxPyBeginBlockThreads(); \
967 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
968 PyObject* obj = wxPyMake_wxObject(&a,false); \
969 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
972 wxPyEndBlockThreads(blocked); \
974 PCLASS::CBNAME(a, b); \
976 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
977 PCLASS::CBNAME(a, b); \
980 //---------------------------------------------------------------------------
982 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
983 void CBNAME(wxDC& a, bool b); \
984 void base_##CBNAME(wxDC& a, bool b)
987 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
988 void CLASS::CBNAME(wxDC& a, bool b) { \
990 bool blocked = wxPyBeginBlockThreads(); \
991 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
992 PyObject* obj = wxPyMake_wxObject(&a,false); \
993 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
996 wxPyEndBlockThreads(blocked); \
998 PCLASS::CBNAME(a, b); \
1000 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1001 PCLASS::CBNAME(a, b); \
1004 //---------------------------------------------------------------------------
1006 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1007 void CBNAME(double a, double b); \
1008 void base_##CBNAME(double a, double b)
1011 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1012 void CLASS::CBNAME(double a, double b) { \
1014 bool blocked = wxPyBeginBlockThreads(); \
1015 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1016 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1017 wxPyEndBlockThreads(blocked); \
1019 PCLASS::CBNAME(a, b); \
1021 void CLASS::base_##CBNAME(double a, double b) { \
1022 PCLASS::CBNAME(a, b); \
1025 //---------------------------------------------------------------------------
1027 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1028 void CBNAME(double a, double b, int c, int d); \
1029 void base_##CBNAME(double a, double b, int c, int d)
1032 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1033 void CLASS::CBNAME(double a, double b, int c, int d) { \
1035 bool blocked = wxPyBeginBlockThreads(); \
1036 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1037 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1039 wxPyEndBlockThreads(blocked); \
1041 PCLASS::CBNAME(a, b, c, d); \
1043 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
1044 PCLASS::CBNAME(a, b, c, d); \
1047 //---------------------------------------------------------------------------
1049 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1050 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1051 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1054 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1055 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1057 bool blocked = wxPyBeginBlockThreads(); \
1058 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1059 PyObject* obj = wxPyMake_wxObject(&a,false); \
1060 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1063 wxPyEndBlockThreads(blocked); \
1065 PCLASS::CBNAME(a, b, c, d, e, f); \
1067 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1068 PCLASS::CBNAME(a, b, c, d, e, f); \
1071 //---------------------------------------------------------------------------
1073 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1074 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
1075 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1078 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1079 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1081 bool blocked = wxPyBeginBlockThreads(); \
1083 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1084 PyObject* obj = wxPyMake_wxObject(&a,false); \
1085 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1088 wxPyEndBlockThreads(blocked); \
1090 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1093 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
1094 return PCLASS::CBNAME(a, b, c, d, e, f); \
1097 //---------------------------------------------------------------------------
1099 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1100 void CBNAME(bool a, double b, double c, int d, int e); \
1101 void base_##CBNAME(bool a, double b, double c, int d, int e)
1104 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1105 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1107 bool blocked = wxPyBeginBlockThreads(); \
1108 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1109 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1111 wxPyEndBlockThreads(blocked); \
1113 PCLASS::CBNAME(a, b, c, d, e); \
1115 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
1116 PCLASS::CBNAME(a, b, c, d, e); \
1119 //---------------------------------------------------------------------------
1121 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1122 void CBNAME(wxDC& a, double b, double c, double d, double e); \
1123 void base_##CBNAME(wxDC& a, double b, double c, double d, double e)
1126 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1127 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1129 bool blocked = wxPyBeginBlockThreads(); \
1130 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1131 PyObject* obj = wxPyMake_wxObject(&a,false); \
1132 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1135 wxPyEndBlockThreads(blocked); \
1137 PCLASS::CBNAME(a, b, c, d, e); \
1139 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
1140 PCLASS::CBNAME(a, b, c, d, e); \
1143 //---------------------------------------------------------------------------
1145 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1146 void CBNAME(wxDC& a, bool b); \
1147 void base_##CBNAME(wxDC& a, bool b)
1150 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1151 void CLASS::CBNAME(wxDC& a, bool b) { \
1153 bool blocked = wxPyBeginBlockThreads(); \
1154 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1155 PyObject* obj = wxPyMake_wxObject(&a,false); \
1156 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1159 wxPyEndBlockThreads(blocked); \
1161 PCLASS::CBNAME(a, b); \
1163 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
1164 PCLASS::CBNAME(a, b); \
1167 //---------------------------------------------------------------------------
1169 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1170 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
1171 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1174 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1175 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1178 bool blocked = wxPyBeginBlockThreads(); \
1179 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1180 PyObject* obj = wxPyMake_wxObject(a,false); \
1181 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1184 wxPyEndBlockThreads(blocked); \
1186 PCLASS::CBNAME(a, b, c, d, e, f); \
1188 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
1190 PCLASS::CBNAME(a, b, c, d, e, f); \
1193 //---------------------------------------------------------------------------
1195 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1196 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
1197 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1200 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1201 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1203 bool blocked = wxPyBeginBlockThreads(); \
1204 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1205 PyObject* obj = wxPyMake_wxObject(a,false); \
1206 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1209 wxPyEndBlockThreads(blocked); \
1211 PCLASS::CBNAME(a, b, c, d, e); \
1213 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
1215 PCLASS::CBNAME(a, b, c, d, e); \
1218 //---------------------------------------------------------------------------
1220 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1221 void CBNAME(double a, double b, int c); \
1222 void base_##CBNAME(double a, double b, int c)
1225 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1226 void CLASS::CBNAME(double a, double b, int c) { \
1228 bool blocked = wxPyBeginBlockThreads(); \
1229 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1230 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1231 wxPyEndBlockThreads(blocked); \
1233 PCLASS::CBNAME(a, b, c); \
1235 void CLASS::base_##CBNAME(double a, double b, int c) { \
1236 PCLASS::CBNAME(a, b, c); \
1239 //---------------------------------------------------------------------------
1241 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1242 void CBNAME(bool a, double b, double c, int d); \
1243 void base_##CBNAME(bool a, double b, double c, int d)
1246 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1247 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1249 bool blocked = wxPyBeginBlockThreads(); \
1250 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1251 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1252 wxPyEndBlockThreads(blocked); \
1254 PCLASS::CBNAME(a, b, c, d); \
1256 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
1257 PCLASS::CBNAME(a, b, c, d); \
1260 //---------------------------------------------------------------------------
1261 //---------------------------------------------------------------------------
1263 #define DEC_PYCALLBACK__STRING(CBNAME) \
1264 void CBNAME(const wxString& a); \
1265 void base_##CBNAME(const wxString& a)
1267 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1268 void CLASS::CBNAME(const wxString& a) { \
1270 bool blocked = wxPyBeginBlockThreads(); \
1271 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1272 PyObject* s = wx2PyString(a); \
1273 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1276 wxPyEndBlockThreads(blocked); \
1278 PCLASS::CBNAME(a); \
1280 void CLASS::base_##CBNAME(const wxString& a) { \
1281 PCLASS::CBNAME(a); \
1284 //---------------------------------------------------------------------------
1286 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1287 bool CBNAME(const wxString& a); \
1288 bool base_##CBNAME(const wxString& a)
1290 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1291 bool CLASS::CBNAME(const wxString& a) { \
1294 bool blocked = wxPyBeginBlockThreads(); \
1295 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1296 PyObject* s = wx2PyString(a); \
1297 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1300 wxPyEndBlockThreads(blocked); \
1302 rval = PCLASS::CBNAME(a); \
1305 bool CLASS::base_##CBNAME(const wxString& a) { \
1306 return PCLASS::CBNAME(a); \
1309 //---------------------------------------------------------------------------
1311 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1312 bool CBNAME(const wxString& a)
1314 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1315 bool CLASS::CBNAME(const wxString& a) { \
1317 bool blocked = wxPyBeginBlockThreads(); \
1318 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1319 PyObject* s = wx2PyString(a); \
1320 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1323 wxPyEndBlockThreads(blocked); \
1327 //---------------------------------------------------------------------------
1329 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1330 wxString CBNAME(const wxString& a)
1332 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1333 wxString CLASS::CBNAME(const wxString& a) { \
1335 bool blocked = wxPyBeginBlockThreads(); \
1336 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1338 PyObject* s = wx2PyString(a); \
1339 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1342 rval = Py2wxString(ro); \
1346 wxPyEndBlockThreads(blocked); \
1350 //---------------------------------------------------------------------------
1352 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1353 wxString CBNAME(const wxString& a); \
1354 wxString base_##CBNAME(const wxString& a)
1356 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1357 wxString CLASS::CBNAME(const wxString& a) { \
1360 bool blocked = wxPyBeginBlockThreads(); \
1361 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1363 PyObject* s = wx2PyString(a); \
1364 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1367 rval = Py2wxString(ro); \
1372 rval = PCLASS::CBNAME(a); \
1373 wxPyEndBlockThreads(blocked); \
1377 //---------------------------------------------------------------------------
1379 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1380 wxString CBNAME(const wxString& a,int b)
1382 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1383 wxString CLASS::CBNAME(const wxString& a,int b) { \
1385 bool blocked = wxPyBeginBlockThreads(); \
1386 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1388 PyObject* s = wx2PyString(a); \
1389 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1392 rval = Py2wxString(ro); \
1396 wxPyEndBlockThreads(blocked); \
1400 //---------------------------------------------------------------------------
1402 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1403 bool CBNAME(const wxString& a, const wxString& b); \
1404 bool base_##CBNAME(const wxString& a, const wxString& b)
1406 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1407 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1410 bool blocked = wxPyBeginBlockThreads(); \
1411 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1412 PyObject* s1 = wx2PyString(a); \
1413 PyObject* s2 = wx2PyString(b); \
1414 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1418 wxPyEndBlockThreads(blocked); \
1420 rval = PCLASS::CBNAME(a, b); \
1423 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
1424 return PCLASS::CBNAME(a, b); \
1427 //---------------------------------------------------------------------------
1429 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1430 wxString CBNAME(); \
1431 wxString base_##CBNAME()
1433 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1434 wxString CLASS::CBNAME() { \
1437 bool blocked = wxPyBeginBlockThreads(); \
1438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1440 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1442 rval = Py2wxString(ro); \
1446 wxPyEndBlockThreads(blocked); \
1448 rval = PCLASS::CBNAME(); \
1451 wxString CLASS::base_##CBNAME() { \
1452 return PCLASS::CBNAME(); \
1455 //---------------------------------------------------------------------------
1457 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1458 wxString CBNAME() const; \
1459 wxString base_##CBNAME() const;
1461 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1462 wxString CLASS::CBNAME() const { \
1465 bool blocked = wxPyBeginBlockThreads(); \
1466 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1468 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1470 rval = Py2wxString(ro); \
1474 wxPyEndBlockThreads(blocked); \
1476 rval = PCLASS::CBNAME(); \
1479 wxString CLASS::base_##CBNAME() const { \
1480 return PCLASS::CBNAME(); \
1483 //---------------------------------------------------------------------------
1485 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1488 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1489 wxString CLASS::CBNAME() { \
1491 bool blocked = wxPyBeginBlockThreads(); \
1492 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1494 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1496 rval = Py2wxString(ro); \
1500 wxPyEndBlockThreads(blocked); \
1504 //---------------------------------------------------------------------------
1506 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1507 wxString CBNAME() const;
1509 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1510 wxString CLASS::CBNAME() const { \
1512 bool blocked = wxPyBeginBlockThreads(); \
1513 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1515 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1517 rval = Py2wxString(ro); \
1521 wxPyEndBlockThreads(blocked); \
1525 //---------------------------------------------------------------------------
1527 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1528 bool CBNAME(const wxHtmlTag& a)
1531 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1532 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1534 bool blocked = wxPyBeginBlockThreads(); \
1535 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1536 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1537 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1540 wxPyEndBlockThreads(blocked); \
1544 //---------------------------------------------------------------------------
1546 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1547 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1548 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1550 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1551 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1553 bool blocked = wxPyBeginBlockThreads(); \
1554 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1555 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1556 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1559 wxPyEndBlockThreads(blocked); \
1561 PCLASS::CBNAME(cell, x, y); \
1563 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1564 PCLASS::CBNAME(cell, x, y); \
1567 //---------------------------------------------------------------------------
1569 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1570 void CBNAME(const wxColour& c); \
1571 void base_##CBNAME(const wxColour& c)
1573 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1574 void CLASS::CBNAME(const wxColour& c) { \
1576 bool blocked = wxPyBeginBlockThreads(); \
1577 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1578 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1579 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1582 wxPyEndBlockThreads(blocked); \
1584 PCLASS::CBNAME(c); \
1586 void CLASS::base_##CBNAME(const wxColour& c) { \
1587 PCLASS::CBNAME(c); \
1590 //---------------------------------------------------------------------------
1592 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1593 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1594 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1596 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1597 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1599 bool blocked = wxPyBeginBlockThreads(); \
1600 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1601 PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0); \
1602 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1603 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1607 wxPyEndBlockThreads(blocked); \
1609 PCLASS::CBNAME(cell, x, y, e); \
1611 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {\
1612 PCLASS::CBNAME(cell, x, y, e); \
1617 //---------------------------------------------------------------------------
1619 #define DEC_PYCALLBACK___pure(CBNAME) \
1623 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1624 void CLASS::CBNAME() { \
1625 bool blocked = wxPyBeginBlockThreads(); \
1626 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1627 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1628 wxPyEndBlockThreads(blocked); \
1631 //---------------------------------------------------------------------------
1633 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1637 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1638 wxSize CLASS::CBNAME() { \
1639 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1641 bool blocked = wxPyBeginBlockThreads(); \
1642 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1645 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1647 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1649 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1650 PyObject* o1 = PySequence_GetItem(ro, 0); \
1651 PyObject* o2 = PySequence_GetItem(ro, 1); \
1652 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1653 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1655 PyErr_SetString(PyExc_TypeError, errmsg); \
1660 PyErr_SetString(PyExc_TypeError, errmsg); \
1665 wxPyEndBlockThreads(blocked); \
1669 //---------------------------------------------------------------------------
1671 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1672 bool CBNAME(wxWindow* a); \
1673 bool base_##CBNAME(wxWindow* a)
1676 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1677 bool CLASS::CBNAME(wxWindow* a) { \
1680 bool blocked = wxPyBeginBlockThreads(); \
1681 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1682 PyObject* obj = wxPyMake_wxObject(a,false); \
1683 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1686 wxPyEndBlockThreads(blocked); \
1688 rval = PCLASS::CBNAME(a); \
1691 bool CLASS::base_##CBNAME(wxWindow* a) { \
1692 return PCLASS::CBNAME(a); \
1695 //---------------------------------------------------------------------------
1697 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1698 bool CBNAME(wxWindow* a, wxDC& b); \
1699 bool base_##CBNAME(wxWindow* a, wxDC& b)
1702 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1703 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1706 bool blocked = wxPyBeginBlockThreads(); \
1707 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1708 PyObject* win = wxPyMake_wxObject(a,false); \
1709 PyObject* dc = wxPyMake_wxObject(&b,false); \
1710 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1714 wxPyEndBlockThreads(blocked); \
1716 rval = PCLASS::CBNAME(a, b); \
1719 bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) { \
1720 return PCLASS::CBNAME(a, b); \
1723 //---------------------------------------------------------------------------
1725 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1726 void CBNAME(wxWindowBase* a); \
1727 void base_##CBNAME(wxWindowBase* a)
1730 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1731 void CLASS::CBNAME(wxWindowBase* a) { \
1733 bool blocked = wxPyBeginBlockThreads(); \
1734 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1735 PyObject* obj = wxPyMake_wxObject(a,false); \
1736 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1739 wxPyEndBlockThreads(blocked); \
1741 PCLASS::CBNAME(a); \
1743 void CLASS::base_##CBNAME(wxWindowBase* a) { \
1744 PCLASS::CBNAME(a); \
1747 //---------------------------------------------------------------------------
1749 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1751 bool base_##CBNAME()
1754 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1755 bool CLASS::CBNAME() { \
1758 bool blocked = wxPyBeginBlockThreads(); \
1759 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1760 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1761 wxPyEndBlockThreads(blocked); \
1763 rval = PCLASS::CBNAME(); \
1766 bool CLASS::base_##CBNAME() { \
1767 return PCLASS::CBNAME(); \
1770 //---------------------------------------------------------------------------
1772 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1773 bool CBNAME() const; \
1774 bool base_##CBNAME() const
1777 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1778 bool CLASS::CBNAME() const { \
1781 bool blocked = wxPyBeginBlockThreads(); \
1782 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1783 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1784 wxPyEndBlockThreads(blocked); \
1786 rval = PCLASS::CBNAME(); \
1789 bool CLASS::base_##CBNAME() const { \
1790 return PCLASS::CBNAME(); \
1793 //---------------------------------------------------------------------------
1795 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1796 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
1797 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1800 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1801 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1804 bool blocked = wxPyBeginBlockThreads(); \
1805 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1806 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1807 wxPyEndBlockThreads(blocked); \
1809 rval = PCLASS::CBNAME(a, b, c); \
1810 return (wxDragResult)rval; \
1812 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1813 return PCLASS::CBNAME(a, b, c); \
1816 //---------------------------------------------------------------------------
1818 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1819 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1821 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1822 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1823 bool blocked = wxPyBeginBlockThreads(); \
1825 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1827 PyObject* obj = wxPyMake_wxObject(&a,false); \
1828 PyObject* s = wx2PyString(b); \
1829 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1832 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1838 wxPyEndBlockThreads(blocked); \
1842 //---------------------------------------------------------------------------
1844 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1845 bool CBNAME(wxDragResult a); \
1846 bool base_##CBNAME(wxDragResult a)
1849 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1850 bool CLASS::CBNAME(wxDragResult a) { \
1853 bool blocked = wxPyBeginBlockThreads(); \
1854 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1855 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1856 wxPyEndBlockThreads(blocked); \
1858 rval = PCLASS::CBNAME(a); \
1861 bool CLASS::base_##CBNAME(wxDragResult a) { \
1862 return PCLASS::CBNAME(a); \
1865 //---------------------------------------------------------------------------
1867 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1868 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1871 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1872 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1873 bool blocked = wxPyBeginBlockThreads(); \
1875 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1876 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1877 wxPyEndBlockThreads(blocked); \
1878 return (wxDragResult)rval; \
1881 //---------------------------------------------------------------------------
1883 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1884 bool CBNAME(int a, int b, const wxString& c)
1886 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1887 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1889 bool blocked = wxPyBeginBlockThreads(); \
1890 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1891 PyObject* s = wx2PyString(c); \
1892 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1895 wxPyEndBlockThreads(blocked); \
1899 //---------------------------------------------------------------------------
1901 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1903 size_t base_##CBNAME()
1906 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1907 size_t CLASS::CBNAME() { \
1910 bool blocked = wxPyBeginBlockThreads(); \
1911 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1912 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1913 wxPyEndBlockThreads(blocked); \
1915 rval = PCLASS::CBNAME(); \
1918 size_t CLASS::base_##CBNAME() { \
1919 return PCLASS::CBNAME(); \
1922 //---------------------------------------------------------------------------
1924 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1925 size_t CBNAME() const; \
1926 size_t base_##CBNAME() const
1929 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1930 size_t CLASS::CBNAME() const { \
1933 bool blocked = wxPyBeginBlockThreads(); \
1934 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1935 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1936 wxPyEndBlockThreads(blocked); \
1938 rval = PCLASS::CBNAME(); \
1941 size_t CLASS::base_##CBNAME() const { \
1942 return PCLASS::CBNAME(); \
1945 //---------------------------------------------------------------------------
1947 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1948 wxDataFormat CBNAME(size_t a); \
1949 wxDataFormat base_##CBNAME(size_t a)
1952 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1953 wxDataFormat CLASS::CBNAME(size_t a) { \
1954 wxDataFormat rval=0; \
1956 bool blocked = wxPyBeginBlockThreads(); \
1957 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1959 wxDataFormat* ptr; \
1960 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1962 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1967 wxPyEndBlockThreads(blocked); \
1969 rval = PCLASS::CBNAME(a); \
1972 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1973 return PCLASS::CBNAME(a); \
1976 //---------------------------------------------------------------------------
1978 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1979 void CBNAME(const Type& a); \
1980 void base_##CBNAME(const Type& a)
1983 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1984 void CLASS::CBNAME(const Type& a) { \
1986 bool blocked = wxPyBeginBlockThreads(); \
1987 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1988 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1989 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1992 wxPyEndBlockThreads(blocked); \
1994 PCLASS::CBNAME(a); \
1996 void CLASS::base_##CBNAME(const Type& a) { \
1997 PCLASS::CBNAME(a); \
2001 //---------------------------------------------------------------------------
2003 #define DEC_PYCALLBACK__any(CBNAME, Type) \
2004 void CBNAME(Type& a); \
2005 void base_##CBNAME(Type& a)
2008 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
2009 void CLASS::CBNAME(Type& a) { \
2011 bool blocked = wxPyBeginBlockThreads(); \
2012 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2013 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2014 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2017 wxPyEndBlockThreads(blocked); \
2019 PCLASS::CBNAME(a); \
2021 void CLASS::base_##CBNAME(Type& a) { \
2022 PCLASS::CBNAME(a); \
2025 //---------------------------------------------------------------------------
2027 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
2028 bool CBNAME(Type& a); \
2029 bool base_##CBNAME(Type& a)
2032 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
2033 bool CLASS::CBNAME(Type& a) { \
2036 bool blocked = wxPyBeginBlockThreads(); \
2037 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2038 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2039 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2042 wxPyEndBlockThreads(blocked); \
2044 rv = PCLASS::CBNAME(a); \
2047 bool CLASS::base_##CBNAME(Type& a) { \
2048 return PCLASS::CBNAME(a); \
2051 //---------------------------------------------------------------------------
2053 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
2054 bool CBNAME(Type& a)
2057 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2058 bool CLASS::CBNAME(Type& a) { \
2060 bool blocked = wxPyBeginBlockThreads(); \
2061 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2062 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2063 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2066 wxPyEndBlockThreads(blocked); \
2070 //---------------------------------------------------------------------------
2072 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2073 wxString CBNAME(long a, long b) const; \
2074 wxString base_##CBNAME(long a, long b) const
2076 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2077 wxString CLASS::CBNAME(long a, long b) const { \
2080 bool blocked = wxPyBeginBlockThreads(); \
2081 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2083 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2085 rval = Py2wxString(ro); \
2089 wxPyEndBlockThreads(blocked); \
2091 rval = PCLASS::CBNAME(a,b); \
2094 wxString CLASS::base_##CBNAME(long a, long b) const { \
2095 return PCLASS::CBNAME(a,b); \
2098 //---------------------------------------------------------------------------
2100 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2101 int CBNAME(long a) const; \
2102 int base_##CBNAME(long a) const
2105 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2106 int CLASS::CBNAME(long a) const { \
2109 bool blocked = wxPyBeginBlockThreads(); \
2110 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2112 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2114 rval = PyInt_AsLong(ro); \
2118 wxPyEndBlockThreads(blocked); \
2120 rval = PCLASS::CBNAME(a); \
2123 int CLASS::base_##CBNAME(long a) const { \
2124 return PCLASS::CBNAME(a); \
2130 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2131 int CBNAME(long a) const;
2134 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2135 int CLASS::CBNAME(long a) const { \
2136 int rval=-1; /* this rval is important for OnGetItemImage */ \
2138 bool blocked = wxPyBeginBlockThreads(); \
2139 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2141 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2143 rval = PyInt_AsLong(ro); \
2147 wxPyEndBlockThreads(blocked); \
2152 //---------------------------------------------------------------------------
2154 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2155 wxListItemAttr* CBNAME(long a) const; \
2156 wxListItemAttr* base_##CBNAME(long a) const
2159 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2160 wxListItemAttr *CLASS::CBNAME(long a) const { \
2161 wxListItemAttr *rval = NULL; \
2163 bool blocked = wxPyBeginBlockThreads(); \
2164 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2166 wxListItemAttr* ptr; \
2167 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2169 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2174 wxPyEndBlockThreads(blocked); \
2176 rval = PCLASS::CBNAME(a); \
2179 wxListItemAttr *CLASS::base_##CBNAME(long a) const { \
2180 return PCLASS::CBNAME(a); \
2183 //---------------------------------------------------------------------------
2185 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2186 bool CBNAME(wxMouseEvent& e); \
2187 bool base_##CBNAME(wxMouseEvent& e)
2189 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2190 bool CLASS::CBNAME(wxMouseEvent& e) { \
2193 bool blocked = wxPyBeginBlockThreads(); \
2194 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2196 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2197 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2199 rval = PyInt_AsLong(ro); \
2204 wxPyEndBlockThreads(blocked); \
2206 return PCLASS::CBNAME(e); \
2209 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
2210 return PCLASS::CBNAME(e); \
2214 //---------------------------------------------------------------------------
2216 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2217 wxWizardPage* CBNAME() const
2219 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2220 wxWizardPage* CLASS::CBNAME() const { \
2221 wxWizardPage* rv = NULL; \
2222 bool blocked = wxPyBeginBlockThreads(); \
2223 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2225 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2227 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2231 wxPyEndBlockThreads(blocked); \
2235 //---------------------------------------------------------------------------
2237 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2238 wxBitmap CBNAME() const
2240 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2241 wxBitmap CLASS::CBNAME() const { \
2243 bool blocked = wxPyBeginBlockThreads(); \
2244 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2247 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2249 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2254 wxPyEndBlockThreads(blocked); \
2258 //---------------------------------------------------------------------------
2260 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2263 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2264 wxObject* CLASS::CBNAME() { \
2265 wxObject* rv = NULL; \
2266 bool blocked = wxPyBeginBlockThreads(); \
2267 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2269 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2271 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2275 wxPyEndBlockThreads(blocked); \
2279 //---------------------------------------------------------------------------
2281 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2282 wxObject* CBNAME(const wxString& a)
2284 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2285 wxObject* CLASS::CBNAME(const wxString& a) { \
2286 wxObject* rv = NULL; \
2287 bool blocked = wxPyBeginBlockThreads(); \
2288 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2289 PyObject* so = wx2PyString(a); \
2291 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2293 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2298 wxPyEndBlockThreads(blocked); \
2302 //---------------------------------------------------------------------------
2304 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2305 bool CBNAME(wxXmlNode* a)
2308 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2309 bool CLASS::CBNAME(wxXmlNode* a) { \
2311 bool blocked = wxPyBeginBlockThreads(); \
2312 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2313 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2314 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2317 wxPyEndBlockThreads(blocked); \
2321 //---------------------------------------------------------------------------
2323 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2324 wxCoord CBNAME(size_t a) const
2327 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2328 wxCoord CLASS::CBNAME(size_t a) const { \
2331 bool blocked = wxPyBeginBlockThreads(); \
2332 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2333 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2335 wxPyEndBlockThreads(blocked); \
2339 //---------------------------------------------------------------------------
2341 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2342 void CBNAME(size_t a, size_t b) const; \
2343 void base_##CBNAME(size_t a, size_t b) const
2346 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2347 void CLASS::CBNAME(size_t a, size_t b) const { \
2349 bool blocked = wxPyBeginBlockThreads(); \
2350 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2351 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2352 wxPyEndBlockThreads(blocked); \
2354 PCLASS::CBNAME(a,b); \
2356 void CLASS::base_##CBNAME(size_t a, size_t b) const { \
2357 PCLASS::CBNAME(a,b); \
2360 //---------------------------------------------------------------------------
2362 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2363 wxCoord CBNAME() const; \
2364 wxCoord base_##CBNAME() const
2367 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2368 wxCoord CLASS::CBNAME() const { \
2371 bool blocked = wxPyBeginBlockThreads(); \
2372 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2373 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2374 wxPyEndBlockThreads(blocked); \
2376 rval = PCLASS::CBNAME(); \
2379 wxCoord CLASS::base_##CBNAME() const { \
2380 return PCLASS::CBNAME(); \
2383 //---------------------------------------------------------------------------
2385 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2386 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2389 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2390 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2392 bool blocked = wxPyBeginBlockThreads(); \
2393 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2394 PyObject* obj = wxPyMake_wxObject(&a,false); \
2395 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2396 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2399 wxPyEndBlockThreads(blocked); \
2402 //---------------------------------------------------------------------------
2404 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2405 void CBNAME(wxDC& a, const wxRect& b, size_t c) const; \
2406 void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const
2409 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2410 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2412 bool blocked = wxPyBeginBlockThreads(); \
2413 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2414 PyObject* obj = wxPyMake_wxObject(&a,false); \
2415 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2416 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2419 wxPyEndBlockThreads(blocked); \
2421 PCLASS::CBNAME(a,b,c); \
2423 void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2424 PCLASS::CBNAME(a,b,c); \
2427 //---------------------------------------------------------------------------
2430 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2431 wxString CBNAME(size_t a) const; \
2432 wxString base_##CBNAME(size_t a) const
2434 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2435 wxString CLASS::CBNAME(size_t a) const { \
2438 bool blocked = wxPyBeginBlockThreads(); \
2439 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2441 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2443 rval = Py2wxString(ro); \
2447 wxPyEndBlockThreads(blocked); \
2449 rval = PCLASS::CBNAME(a); \
2452 wxString CLASS::base_##CBNAME(size_t a) const { \
2453 return PCLASS::CBNAME(a); \
2456 //---------------------------------------------------------------------------
2458 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2459 wxString CBNAME(size_t a) const
2461 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2462 wxString CLASS::CBNAME(size_t a) const { \
2465 bool blocked = wxPyBeginBlockThreads(); \
2466 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2468 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2470 rval = Py2wxString(ro); \
2474 wxPyEndBlockThreads(blocked); \
2478 //---------------------------------------------------------------------------
2480 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2481 wxVisualAttributes CBNAME() const; \
2482 wxVisualAttributes base_##CBNAME()
2485 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2486 wxVisualAttributes CLASS::CBNAME() const { \
2487 wxVisualAttributes rval; \
2489 bool blocked = wxPyBeginBlockThreads(); \
2490 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2492 wxVisualAttributes* ptr; \
2493 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2495 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2500 wxPyEndBlockThreads(blocked); \
2502 rval = PCLASS::CBNAME(); \
2505 wxVisualAttributes CLASS::base_##CBNAME() { \
2506 return PCLASS::CBNAME(); \
2509 //---------------------------------------------------------------------------