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/clipbrd.h> 
  24 #include <wx/colordlg.h> 
  25 #include <wx/config.h> 
  26 #include <wx/cshelp.h> 
  27 #include <wx/dcmirror.h> 
  29 #include <wx/dirctrl.h> 
  30 #include <wx/dirdlg.h> 
  32 #include <wx/docview.h> 
  33 #include <wx/encconv.h> 
  34 #include <wx/fdrepdlg.h> 
  35 #include <wx/fileconf.h> 
  36 #include <wx/filesys.h> 
  37 #include <wx/fontdlg.h> 
  38 #include <wx/fs_inet.h> 
  39 #include <wx/fs_mem.h> 
  40 #include <wx/fs_zip.h> 
  41 #include <wx/gbsizer.h> 
  42 #include <wx/geometry.h> 
  43 #include <wx/htmllbox.h> 
  45 #include <wx/imaglist.h> 
  47 #include <wx/laywin.h> 
  48 #include <wx/listbook.h> 
  49 #include <wx/minifram.h> 
  50 #include <wx/notebook.h> 
  52 #include <wx/printdlg.h> 
  53 #include <wx/process.h> 
  54 #include <wx/progdlg.h> 
  55 #include <wx/sashwin.h> 
  56 #include <wx/spinbutt.h> 
  57 #include <wx/spinctrl.h> 
  58 #include <wx/splash.h> 
  59 #include <wx/splitter.h> 
  60 #include <wx/statline.h> 
  61 #include <wx/stream.h> 
  62 #include <wx/sysopt.h> 
  63 #include <wx/taskbar.h> 
  64 #include <wx/tglbtn.h> 
  65 #include <wx/tipwin.h> 
  66 #include <wx/tooltip.h> 
  68 #include <wx/vscroll.h> 
  72 # pragma warning(disable:4800) 
  73 # pragma warning(disable:4190) 
  76 #ifdef __WXMAC__  // avoid a bug in Carbon headers 
  80 //--------------------------------------------------------------------------- 
  82 typedef unsigned char byte
; 
  83 typedef wxPoint2DDouble wxPoint2D
;     
  85 const bool True 
= true; 
  86 const bool False 
= false; 
  89 #ifndef wxPyUSE_EXPORTED_API 
  91 void      __wxPyPreStart(PyObject
*); 
  93 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
); 
  94 PyObject
* __wxPyFixStockObjects(PyObject
*, PyObject
* args
); 
  97 void wxPyEventThunker(wxObject
*, wxEvent
& event
); 
 100 bool wxPyCheckSwigType(const wxChar
* className
); 
 101 PyObject
* wxPyConstructObject(void* ptr
, 
 102                               const wxChar
* className
, 
 104 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
, 
 105                         const wxChar
* className
); 
 106 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
); 
 109 PyObject
* wx2PyString(const wxString
& src
); 
 110 wxString  
Py2wxString(PyObject
* source
); 
 112 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool checkEvtHandler
=True
); 
 113 PyObject
* wxPyMake_wxSizer(wxSizer
* source
); 
 114 void      wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
); 
 116 PyObject
* wxPy_ConvertList(wxListBase
* list
); 
 117 long      wxPyGetWinHandle(wxWindow
* win
); 
 119 void wxPy_ReinitStockObjects(int pass
); 
 121 bool wxPyInstance_Check(PyObject
* obj
); 
 122 bool wxPySwigInstance_Check(PyObject
* obj
); 
 125 #endif // wxPyUSE_EXPORTED_API 
 126 //--------------------------------------------------------------------------- 
 128 // if we want to handle threads and Python threads are available... 
 129 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD) 
 130 #define WXP_WITH_THREAD 
 131 #else  // no Python threads... 
 132 #undef WXP_WITH_THREAD 
 135 #ifndef wxPyUSE_EXPORTED_API 
 137 // For Python --> C++ 
 138 PyThreadState
* wxPyBeginAllowThreads(); 
 139 void           wxPyEndAllowThreads(PyThreadState
* state
); 
 141 // For C++ --> Python 
 142 void wxPyBeginBlockThreads(); 
 143 void wxPyEndBlockThreads(); 
 145 #endif // wxPyUSE_EXPORTED_API 
 148 // A macro that will help to execute simple statments wrapped in 
 149 // StartBlock/EndBlockThreads calls 
 150 #define wxPyBLOCK_THREADS(stmt) \ 
 151     { wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(); } 
 153 // Raise the NotImplementedError exception  (blocking threads) 
 154 #define wxPyRaiseNotImplemented() \ 
 155     wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError)) 
 157 // Raise any exception witha string value  (blocking threads) 
 158 #define wxPyErr_SetString(err, str) \ 
 159     wxPyBLOCK_THREADS(PyErr_SetString(err, str)) 
 162 //--------------------------------------------------------------------------- 
 163 // These are helpers used by the typemaps 
 165 #ifndef wxPyUSE_EXPORTED_API 
 167 wxString
* wxString_in_helper(PyObject
* source
); 
 169 byte
* byte_LIST_helper(PyObject
* source
); 
 170 int* int_LIST_helper(PyObject
* source
); 
 171 long* long_LIST_helper(PyObject
* source
); 
 172 char** string_LIST_helper(PyObject
* source
); 
 173 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
); 
 174 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
); 
 175 wxString
* wxString_LIST_helper(PyObject
* source
); 
 176 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
); 
 177 wxPen
** wxPen_LIST_helper(PyObject
* source
); 
 179 bool wxSize_helper(PyObject
* source
, wxSize
** obj
); 
 180 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
); 
 181 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
); 
 182 bool wxRect_helper(PyObject
* source
, wxRect
** obj
); 
 183 bool wxColour_helper(PyObject
* source
, wxColour
** obj
); 
 184 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
); 
 187 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
); 
 188 bool wxColour_typecheck(PyObject
* source
); 
 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 swig_type_info
* (*p_SWIG_Python_TypeQuery_t
)(const char *); 
 340 typedef void            (*p_SWIG_Python_TypeClientData_t
)(swig_type_info 
*, void *); 
 341 typedef PyObject
*       (*p_SWIG_Python_newvarlink_t
)(void); 
 342 typedef void            (*p_SWIG_Python_addvarlink_t
)(PyObject 
*, char *, PyObject 
*(*)(void), int (*)(PyObject 
*)); 
 343 typedef int             (*p_SWIG_Python_ConvertPtr_t
)(PyObject 
*, void **, swig_type_info 
*, int); 
 344 typedef int             (*p_SWIG_Python_ConvertPacked_t
)(PyObject 
*, void *, int sz
, swig_type_info 
*, int); 
 345 typedef char*           (*p_SWIG_Python_PackData_t
)(char *c
, void *, int); 
 346 typedef char*           (*p_SWIG_Python_UnpackData_t
)(char *c
, void *, int); 
 347 typedef PyObject
*       (*p_SWIG_Python_NewPointerObj_t
)(void *, swig_type_info 
*,int own
); 
 348 typedef PyObject
*       (*p_SWIG_Python_NewPackedObj_t
)(void *, int sz
, swig_type_info 
*); 
 349 typedef void            (*p_SWIG_Python_InstallConstants_t
)(PyObject 
*d
, swig_const_info constants
[]); 
 350 typedef void*           (*p_SWIG_Python_MustGetPtr_t
)(PyObject 
*, swig_type_info 
*, int, int); 
 355     p_SWIG_Python_TypeRegister_t       p_SWIG_Python_TypeRegister
; 
 356     p_SWIG_Python_TypeCheck_t          p_SWIG_Python_TypeCheck
; 
 357     p_SWIG_Python_TypeCast_t           p_SWIG_Python_TypeCast
; 
 358     p_SWIG_Python_TypeDynamicCast_t    p_SWIG_Python_TypeDynamicCast
; 
 359     p_SWIG_Python_TypeName_t           p_SWIG_Python_TypeName
; 
 360     p_SWIG_Python_TypeQuery_t          p_SWIG_Python_TypeQuery
; 
 361     p_SWIG_Python_TypeClientData_t     p_SWIG_Python_TypeClientData
; 
 362     p_SWIG_Python_newvarlink_t         p_SWIG_Python_newvarlink
; 
 363     p_SWIG_Python_addvarlink_t         p_SWIG_Python_addvarlink
; 
 364     p_SWIG_Python_ConvertPtr_t         p_SWIG_Python_ConvertPtr
; 
 365     p_SWIG_Python_ConvertPacked_t      p_SWIG_Python_ConvertPacked
; 
 366     p_SWIG_Python_PackData_t           p_SWIG_Python_PackData
; 
 367     p_SWIG_Python_UnpackData_t         p_SWIG_Python_UnpackData
; 
 368     p_SWIG_Python_NewPointerObj_t      p_SWIG_Python_NewPointerObj
; 
 369     p_SWIG_Python_NewPackedObj_t       p_SWIG_Python_NewPackedObj
; 
 370     p_SWIG_Python_InstallConstants_t   p_SWIG_Python_InstallConstants
; 
 371     p_SWIG_Python_MustGetPtr_t         p_SWIG_Python_MustGetPtr
; 
 373     bool                (*p_wxPyCheckSwigType
)(const wxChar
* className
); 
 374     PyObject
*           (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
); 
 375     bool                (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
); 
 376     PyObject
*           (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
); 
 378     PyThreadState
*      (*p_wxPyBeginAllowThreads
)(); 
 379     void                (*p_wxPyEndAllowThreads
)(PyThreadState
* state
); 
 380     void                (*p_wxPyBeginBlockThreads
)(); 
 381     void                (*p_wxPyEndBlockThreads
)(); 
 383     PyObject
*           (*p_wxPy_ConvertList
)(wxListBase
* list
); 
 385     wxString
*           (*p_wxString_in_helper
)(PyObject
* source
); 
 386     wxString            (*p_Py2wxString
)(PyObject
* source
); 
 387     PyObject
*           (*p_wx2PyString
)(const wxString
& src
); 
 389     byte
*               (*p_byte_LIST_helper
)(PyObject
* source
); 
 390     int*                (*p_int_LIST_helper
)(PyObject
* source
); 
 391     long*               (*p_long_LIST_helper
)(PyObject
* source
); 
 392     char**              (*p_string_LIST_helper
)(PyObject
* source
); 
 393     wxPoint
*            (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
); 
 394     wxBitmap
**          (*p_wxBitmap_LIST_helper
)(PyObject
* source
); 
 395     wxString
*           (*p_wxString_LIST_helper
)(PyObject
* source
); 
 396     wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
); 
 398     bool                (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
); 
 399     bool                (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
); 
 400     bool                (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
); 
 401     bool                (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
); 
 402     bool                (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
); 
 403     bool                (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2DDouble
** obj
); 
 406     bool                (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
); 
 407     bool                (*p_wxColour_typecheck
)(PyObject
* source
); 
 409     void                (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
); 
 410     bool                (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
); 
 411     int                 (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
); 
 412     PyObject
*           (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
); 
 413     void                (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
); 
 415     PyObject
*           (*p_wxPyMake_wxObject
)(wxObject
* source
, bool checkEvtHandler
); 
 416     PyObject
*           (*p_wxPyMake_wxSizer
)(wxSizer
* source
); 
 417     void                (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
); 
 418     bool                (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
); 
 419     bool                (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
); 
 420     PyObject
*           (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
); 
 421     PyObject
*           (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
); 
 423     void                (*p_wxPyClientData_dtor
)(wxPyClientData
*); 
 424     void                (*p_wxPyUserData_dtor
)(wxPyUserData
*); 
 425     void                (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*); 
 427     wxPyCBInputStream
*  (*p_wxPyCBInputStream_create
)(PyObject 
*py
, bool block
); 
 429     bool                (*p_wxPyInstance_Check
)(PyObject
* obj
); 
 430     bool                (*p_wxPySwigInstance_Check
)(PyObject
* obj
); 
 434 #ifdef wxPyUSE_EXPORTED_API 
 435 // Notice that this is static, not extern.  This is by design, each module 
 436 // needs one, but doesn't have to use it. 
 437 static wxPyCoreAPI
* wxPyCoreAPIPtr 
= NULL
; 
 438 #endif // wxPyUSE_EXPORTED_API 
 440 //--------------------------------------------------------------------------- 
 442 // A wxObject that holds a reference to a Python object 
 443 class wxPyUserData 
: public wxObject 
{ 
 445     wxPyUserData(PyObject
* obj
) { 
 451 #ifdef wxPyUSE_EXPORTED_API 
 452         wxPyCoreAPIPtr
->p_wxPyUserData_dtor(this); 
 454         wxPyUserData_dtor(this); 
 461 // A wxClientData that holds a refernece to a Python object 
 462 class wxPyClientData 
: public wxClientData 
{ 
 464     wxPyClientData(PyObject
* obj
) { 
 470 #ifdef wxPyUSE_EXPORTED_API 
 471         wxPyCoreAPIPtr
->p_wxPyClientData_dtor(this); 
 473         wxPyClientData_dtor(this); 
 480 // Just like wxPyClientData, except when this object is destroyed it does some 
 481 // OOR magic on the Python Object. 
 482 class wxPyOORClientData 
: public wxPyClientData 
{ 
 484     wxPyOORClientData(PyObject
* obj
) 
 485         : wxPyClientData(obj
) {} 
 487     ~wxPyOORClientData() { 
 488 #ifdef wxPyUSE_EXPORTED_API 
 489         wxPyCoreAPIPtr
->p_wxPyOORClientData_dtor(this); 
 491         wxPyOORClientData_dtor(this); 
 497 //--------------------------------------------------------------------------- 
 498 // This class holds an instance of a Python Shadow Class object and assists 
 499 // with looking up and invoking Python callback methods from C++ virtual 
 500 // method redirections.  For all classes which have virtuals which should be 
 501 // overridable in wxPython, a new subclass is created that contains a 
 502 // wxPyCallbackHelper. 
 505 class wxPyCallbackHelper 
{ 
 507     wxPyCallbackHelper(const wxPyCallbackHelper
& other
); 
 509     wxPyCallbackHelper() { 
 516     ~wxPyCallbackHelper() { 
 517 #ifdef wxPyUSE_EXPORTED_API 
 518         wxPyCoreAPIPtr
->p_wxPyCBH_delete(this); 
 520         wxPyCBH_delete(this); 
 524     void        setSelf(PyObject
* self
, PyObject
* klass
, int incref
=True
); 
 525     bool        findCallback(const char* name
) const; 
 526     int         callCallback(PyObject
* argTuple
) const; 
 527     PyObject
*   callCallbackObj(PyObject
* argTuple
) const; 
 528     PyObject
*   GetLastFound() const { return m_lastFound
; } 
 533     PyObject
*   m_lastFound
; 
 536     friend      void wxPyCBH_delete(wxPyCallbackHelper
* cbh
); 
 540 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
); 
 541 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
); 
 542 int  wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
); 
 543 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
); 
 544 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
); 
 549 //--------------------------------------------------------------------------- 
 551 // This is used in C++ classes that need to be able to make callback to 
 552 // "overloaded" python methods 
 555     void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) {     \ 
 556         wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref);                \ 
 558     private: wxPyCallbackHelper m_myInst 
 561 //--------------------------------------------------------------------------- 
 562 // The wxPythonApp class 
 565     wxPYAPP_ASSERT_SUPPRESS  
= 1, 
 566     wxPYAPP_ASSERT_EXCEPTION 
= 2, 
 567     wxPYAPP_ASSERT_DIALOG    
= 4, 
 568     wxPYAPP_ASSERT_LOG       
= 8 
 571 class wxPyApp
: public wxApp
 
 573     DECLARE_ABSTRACT_CLASS(wxPyApp
); 
 581     int  GetAssertMode() { return m_assertMode
; } 
 582     void SetAssertMode(int mode
) { m_assertMode 
= mode
; } 
 584     virtual bool OnInitGui(); 
 585     virtual int OnExit(); 
 587     virtual void OnAssert(const wxChar 
*file
, 
 592     // virtual int FilterEvent(wxEvent& event); // This one too???? 
 594     // For catching Apple Events 
 595     virtual void MacOpenFile(const wxString 
&fileName
); 
 596     virtual void MacPrintFile(const wxString 
&fileName
); 
 597     virtual void MacNewFile(); 
 598     virtual void MacReopenApp(); 
 600     static bool GetMacSupportPCMenuShortcuts(); 
 601     static long GetMacAboutMenuItemId(); 
 602     static long GetMacPreferencesMenuItemId(); 
 603     static long GetMacExitMenuItemId(); 
 604     static wxString 
GetMacHelpMenuTitleName(); 
 606     static void SetMacSupportPCMenuShortcuts(bool val
); 
 607     static void SetMacAboutMenuItemId(long val
); 
 608     static void SetMacPreferencesMenuItemId(long val
); 
 609     static void SetMacExitMenuItemId(long val
); 
 610     static void SetMacHelpMenuTitleName(const wxString
& val
); 
 613     void _BootstrapApp(); 
 615     // implementation only 
 616     void SetStartupComplete(bool val
) { m_startupComplete 
= val
; }; 
 620     bool m_startupComplete
; 
 623 extern wxPyApp 
*wxPythonApp
; 
 626 //---------------------------------------------------------------------- 
 627 // These macros are used to implement the virtual methods that should 
 628 // redirect to a Python method if one exists.  The names designate the 
 629 // return type, if any, as well as any parameter types. 
 630 //--------------------------------------------------------------------------- 
 632 #define DEC_PYCALLBACK__(CBNAME)                        \ 
 637 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)                         \ 
 638     void CLASS::CBNAME() {                                              \ 
 640         wxPyBeginBlockThreads();                                        \ 
 641         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 642             wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));        \ 
 643         wxPyEndBlockThreads();                                          \ 
 647     void CLASS::base_##CBNAME() {                                       \ 
 651 //--------------------------------------------------------------------------- 
 653 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME)                      \ 
 654     bool CBNAME(int a, int b);                                  \ 
 655     bool base_##CBNAME(int a, int b) 
 658 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME)               \ 
 659     bool CLASS::CBNAME(int a, int b) {                                  \ 
 660         bool rval=False, found;                                         \ 
 661         wxPyBeginBlockThreads();                    \ 
 662         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 663             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b));    \ 
 664         wxPyEndBlockThreads();                                     \ 
 666             rval = PCLASS::CBNAME(a,b);                                 \ 
 669     bool CLASS::base_##CBNAME(int a, int b) {                           \ 
 670         return PCLASS::CBNAME(a,b);                                     \ 
 673 //--------------------------------------------------------------------------- 
 675 #define DEC_PYCALLBACK_VOID_(CBNAME)                    \ 
 680 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME)                     \ 
 681     void CLASS::CBNAME() {                                              \ 
 683         wxPyBeginBlockThreads();                                        \ 
 684         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 685             wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));        \ 
 686         wxPyEndBlockThreads();                                          \ 
 690     void CLASS::base_##CBNAME() {                                       \ 
 694 //--------------------------------------------------------------------------- 
 696 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME)                      \ 
 697     void CBNAME(int a, int b);                                  \ 
 698     void base_##CBNAME(int a, int b) 
 701 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME)               \ 
 702     void CLASS::CBNAME(int a, int b) {                                  \ 
 704         wxPyBeginBlockThreads();                                        \ 
 705         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 706             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b));  \ 
 707         wxPyEndBlockThreads();                                          \ 
 709             PCLASS::CBNAME(a,b);                                        \ 
 711     void CLASS::base_##CBNAME(int a, int b) {                           \ 
 712         PCLASS::CBNAME(a,b);                                            \ 
 715 //--------------------------------------------------------------------------- 
 717 #define DEC_PYCALLBACK_VOID_INT(CBNAME)                         \ 
 718     void CBNAME(int a);                                         \ 
 719     void base_##CBNAME(int a) 
 722 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME)                  \ 
 723     void CLASS::CBNAME(int a) {                                         \ 
 725         wxPyBeginBlockThreads();                                        \ 
 726         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 727             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));     \ 
 728         wxPyEndBlockThreads();                                          \ 
 732     void CLASS::base_##CBNAME(int a) {                                  \ 
 736 //--------------------------------------------------------------------------- 
 738 #define DEC_PYCALLBACK_VOID_INT4(CBNAME)                                \ 
 739     void CBNAME(int a, int b, int c, int d);                            \ 
 740     void base_##CBNAME(int a, int b, int c, int d) 
 743 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME)                 \ 
 744     void CLASS::CBNAME(int a, int b, int c, int d) {                    \ 
 746         wxPyBeginBlockThreads();                                        \ 
 747         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 748             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d));  \ 
 749         wxPyEndBlockThreads();                                          \ 
 751             PCLASS::CBNAME(a,b,c,d);                                    \ 
 753     void CLASS::base_##CBNAME(int a, int b, int c, int d) {             \ 
 754         PCLASS::CBNAME(a,b,c,d);                                        \ 
 757 //--------------------------------------------------------------------------- 
 758 #define DEC_PYCALLBACK_VOID_INT5(CBNAME)                                \ 
 759     void CBNAME(int a, int b, int c, int d, int e);                     \ 
 760     void base_##CBNAME(int a, int b, int c, int d, int e) 
 763 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME)                 \ 
 764     void CLASS::CBNAME(int a, int b, int c, int d, int e) {             \ 
 766         wxPyBeginBlockThreads();                                        \ 
 767         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 768             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e));  \ 
 769         wxPyEndBlockThreads();                                          \ 
 771             PCLASS::CBNAME(a,b,c,d,e);                                  \ 
 773     void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) {      \ 
 774         PCLASS::CBNAME(a,b,c,d,e);                                      \ 
 777 //--------------------------------------------------------------------------- 
 779 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME)                              \ 
 780     void CBNAME(int* a, int* b) const;                                          \ 
 781     void base_##CBNAME(int* a, int* b) const 
 784 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME)               \ 
 785     void CLASS::CBNAME(int* a, int* b) const {                                  \ 
 786         const char* errmsg = #CBNAME " should return a 2-tuple of integers.";   \ 
 788         wxPyBeginBlockThreads();                                                \ 
 789         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
 791             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
 793                 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {         \ 
 794                     PyObject* o1 = PySequence_GetItem(ro, 0);                   \ 
 795                     PyObject* o2 = PySequence_GetItem(ro, 1);                   \ 
 796                     if (PyNumber_Check(o1) && PyNumber_Check(o2)) {             \ 
 797                         *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2);           \ 
 800                         PyErr_SetString(PyExc_TypeError, errmsg);               \ 
 805                     PyErr_SetString(PyExc_TypeError, errmsg);                   \ 
 810         wxPyEndBlockThreads();                                                  \ 
 812             PCLASS::CBNAME(a,b);                                                \ 
 814     void CLASS::base_##CBNAME(int* a, int* b) const {                           \ 
 815         PCLASS::CBNAME(a,b);                                                    \ 
 819 //--------------------------------------------------------------------------- 
 821 #define DEC_PYCALLBACK_SIZE_const(CBNAME)                                       \ 
 822     wxSize CBNAME() const;                                                      \ 
 823     wxSize base_##CBNAME() const 
 826 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME)                        \ 
 827     wxSize CLASS::CBNAME() const {                                              \ 
 828         const char* errmsg = #CBNAME " should return a 2-tuple of integers.";   \ 
 829         bool found; wxSize rval(0,0);                                           \ 
 830         wxPyBeginBlockThreads();                                                \ 
 831         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
 833             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
 835                 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {         \ 
 836                     PyObject* o1 = PySequence_GetItem(ro, 0);                   \ 
 837                     PyObject* o2 = PySequence_GetItem(ro, 1);                   \ 
 838                     if (PyNumber_Check(o1) && PyNumber_Check(o2)) {             \ 
 839                         rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));      \ 
 842                         PyErr_SetString(PyExc_TypeError, errmsg);               \ 
 847                     PyErr_SetString(PyExc_TypeError, errmsg);                   \ 
 852         wxPyEndBlockThreads();                                                  \ 
 854             return PCLASS::CBNAME();                                            \ 
 858     wxSize CLASS::base_##CBNAME() const {                                       \ 
 859         return PCLASS::CBNAME();                                                \ 
 863 //--------------------------------------------------------------------------- 
 865 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME)                         \ 
 866     bool CBNAME(bool a);                                         \ 
 867     bool base_##CBNAME(bool a) 
 870 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME)                 \ 
 871     bool CLASS::CBNAME(bool a) {                                        \ 
 872         bool rval=False, found;                                         \ 
 873         wxPyBeginBlockThreads();                                        \ 
 874         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 875             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ 
 876         wxPyEndBlockThreads();                                          \ 
 878             rval = PCLASS::CBNAME(a);                                   \ 
 881     bool CLASS::base_##CBNAME(bool a) {                                 \ 
 882         return PCLASS::CBNAME(a);                                       \ 
 885 //--------------------------------------------------------------------------- 
 887 #define DEC_PYCALLBACK_BOOL_INT(CBNAME)                         \ 
 888     bool CBNAME(int a);                                         \ 
 889     bool base_##CBNAME(int a) 
 892 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME)                  \ 
 893     bool CLASS::CBNAME(int a) {                                         \ 
 894         bool rval=False, found;                                         \ 
 895         wxPyBeginBlockThreads();                                        \ 
 896         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
 897             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ 
 898         wxPyEndBlockThreads();                                          \ 
 900             rval = PCLASS::CBNAME(a);                                   \ 
 903     bool CLASS::base_##CBNAME(int a) {                                  \ 
 904         return PCLASS::CBNAME(a);                                       \ 
 907 //--------------------------------------------------------------------------- 
 909 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME)            \ 
 913 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME)             \ 
 914     bool CLASS::CBNAME(int a) {                                         \ 
 916         wxPyBeginBlockThreads();                    \ 
 917         if (wxPyCBH_findCallback(m_myInst, #CBNAME))                    \ 
 918             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));       \ 
 920         wxPyEndBlockThreads();                                     \ 
 925 //--------------------------------------------------------------------------- 
 927 #define DEC_PYCALLBACK__DC(CBNAME)                      \ 
 928     void CBNAME(wxDC& a);                               \ 
 929     void base_##CBNAME(wxDC& a) 
 932 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME)                       \ 
 933     void CLASS::CBNAME(wxDC& a) {                                       \ 
 935         wxPyBeginBlockThreads();                                        \ 
 936         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {        \ 
 937             PyObject* obj = wxPyMake_wxObject(&a);                      \ 
 938             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));  \ 
 941         wxPyEndBlockThreads();                                          \ 
 945     void CLASS::base_##CBNAME(wxDC& a) {                                \ 
 951 //--------------------------------------------------------------------------- 
 953 #define DEC_PYCALLBACK__DCBOOL(CBNAME)                  \ 
 954     void CBNAME(wxDC& a, bool b);                       \ 
 955     void base_##CBNAME(wxDC& a, bool b) 
 958 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                   \ 
 959     void CLASS::CBNAME(wxDC& a, bool b) {                               \ 
 961         wxPyBeginBlockThreads();                    \ 
 962         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {        \ 
 963             PyObject* obj = wxPyMake_wxObject(&a);                      \ 
 964             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b));  \ 
 967         wxPyEndBlockThreads();                                     \ 
 969             PCLASS::CBNAME(a, b);                                       \ 
 971     void CLASS::base_##CBNAME(wxDC& a, bool b) {                        \ 
 972         PCLASS::CBNAME(a, b);                                           \ 
 975 //--------------------------------------------------------------------------- 
 977 #define DEC_PYCALLBACK__DCBOOL(CBNAME)                          \ 
 978     void CBNAME(wxDC& a, bool b);                               \ 
 979     void base_##CBNAME(wxDC& a, bool b) 
 982 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                   \ 
 983     void CLASS::CBNAME(wxDC& a, bool b) {                               \ 
 985         wxPyBeginBlockThreads();                    \ 
 986         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {        \ 
 987             PyObject* obj = wxPyMake_wxObject(&a);                      \ 
 988             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b));  \ 
 991         wxPyEndBlockThreads();                                     \ 
 993             PCLASS::CBNAME(a, b);                                       \ 
 995     void CLASS::base_##CBNAME(wxDC& a, bool b) {                        \ 
 996         PCLASS::CBNAME(a, b);                                           \ 
 999 //--------------------------------------------------------------------------- 
1001 #define DEC_PYCALLBACK__2DBL(CBNAME)                    \ 
1002     void CBNAME(double a, double b);                    \ 
1003     void base_##CBNAME(double a, double b) 
1006 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME)                     \ 
1007     void CLASS::CBNAME(double a, double b) {                            \ 
1009         wxPyBeginBlockThreads();                    \ 
1010         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
1011             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b));  \ 
1012         wxPyEndBlockThreads();                                     \ 
1014             PCLASS::CBNAME(a, b);                                       \ 
1016     void CLASS::base_##CBNAME(double a, double b) {                     \ 
1017         PCLASS::CBNAME(a, b);                                           \ 
1020 //--------------------------------------------------------------------------- 
1022 #define DEC_PYCALLBACK__2DBL2INT(CBNAME)                        \ 
1023     void CBNAME(double a, double b, int c, int d);              \ 
1024     void base_##CBNAME(double a, double b, int c, int d) 
1027 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME)                 \ 
1028     void CLASS::CBNAME(double a, double b, int c, int d) {              \ 
1030         wxPyBeginBlockThreads();                    \ 
1031         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
1032             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)",      \ 
1034         wxPyEndBlockThreads();                                     \ 
1036             PCLASS::CBNAME(a, b, c, d);                                 \ 
1038     void CLASS::base_##CBNAME(double a, double b, int c, int d) {       \ 
1039         PCLASS::CBNAME(a, b, c, d);                                     \ 
1042 //--------------------------------------------------------------------------- 
1044 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME)                                      \ 
1045     void CBNAME(wxDC& a, double b, double c, double d, double e, bool f);       \ 
1046     void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) 
1049 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME)                               \ 
1050     void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {       \ 
1052         wxPyBeginBlockThreads();                                    \ 
1053         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                        \ 
1054             PyObject* obj = wxPyMake_wxObject(&a);                                      \ 
1055             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));  \ 
1058         wxPyEndBlockThreads();                                                     \ 
1060             PCLASS::CBNAME(a, b, c, d, e, f);                                           \ 
1062     void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ 
1063         PCLASS::CBNAME(a, b, c, d, e, f);                                               \ 
1066 //--------------------------------------------------------------------------- 
1068 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME)                                  \ 
1069     bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f);       \ 
1070     bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) 
1073 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME)                           \ 
1074     bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {       \ 
1076         wxPyBeginBlockThreads();                                    \ 
1078         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                        \ 
1079             PyObject* obj = wxPyMake_wxObject(&a);                                      \ 
1080             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ 
1083         wxPyEndBlockThreads();                                                     \ 
1085             rval = PCLASS::CBNAME(a, b, c, d, e, f);                                    \ 
1088     bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ 
1089         return PCLASS::CBNAME(a, b, c, d, e, f);                                        \ 
1092 //--------------------------------------------------------------------------- 
1094 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME)                            \ 
1095     void CBNAME(bool a, double b, double c, int d, int e);              \ 
1096     void base_##CBNAME(bool a, double b, double c, int d, int e) 
1099 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME)                     \ 
1100     void CLASS::CBNAME(bool a, double b, double c, int d, int e) {              \ 
1102         wxPyBeginBlockThreads();                            \ 
1103         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1104             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)",             \ 
1106         wxPyEndBlockThreads();                                             \ 
1108             PCLASS::CBNAME(a, b, c, d, e);                                      \ 
1110     void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) {       \ 
1111         PCLASS::CBNAME(a, b, c, d, e);                                          \ 
1114 //--------------------------------------------------------------------------- 
1116 #define DEC_PYCALLBACK__DC4DBL(CBNAME)                                          \ 
1117     void CBNAME(wxDC& a, double b, double c, double d, double e);               \ 
1118     void base_##CBNAME(wxDC& a, double b, double c, double d, double e) 
1121 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME)                           \ 
1122     void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) {       \ 
1124         wxPyBeginBlockThreads();                            \ 
1125         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1126             PyObject* obj = wxPyMake_wxObject(&a);                              \ 
1127             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e));   \ 
1130         wxPyEndBlockThreads();                                             \ 
1132             PCLASS::CBNAME(a, b, c, d, e);                                      \ 
1134     void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\ 
1135         PCLASS::CBNAME(a, b, c, d, e);                                          \ 
1138 //--------------------------------------------------------------------------- 
1140 #define DEC_PYCALLBACK__DCBOOL(CBNAME)                  \ 
1141     void CBNAME(wxDC& a, bool b);                       \ 
1142     void base_##CBNAME(wxDC& a, bool b) 
1145 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME)                           \ 
1146     void CLASS::CBNAME(wxDC& a, bool b) {                                       \ 
1148         wxPyBeginBlockThreads();                            \ 
1149         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1150             PyObject* obj = wxPyMake_wxObject(&a);                              \ 
1151             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ 
1154         wxPyEndBlockThreads();                                             \ 
1156             PCLASS::CBNAME(a, b);                                               \ 
1158     void CLASS::base_##CBNAME(wxDC& a, bool b) {                                \ 
1159         PCLASS::CBNAME(a, b);                                                   \ 
1162 //--------------------------------------------------------------------------- 
1164 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME)                                \ 
1165     void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);   \ 
1166     void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f) 
1169 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME)                 \ 
1170     void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d,           \ 
1173         wxPyBeginBlockThreads();                            \ 
1174         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1175             PyObject* obj = wxPyMake_wxObject(a);                               \ 
1176             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ 
1179         wxPyEndBlockThreads();                                             \ 
1181             PCLASS::CBNAME(a, b, c, d, e, f);                                   \ 
1183     void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d,    \ 
1185         PCLASS::CBNAME(a, b, c, d, e, f);                                       \ 
1188 //--------------------------------------------------------------------------- 
1190 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME)                                    \ 
1191     void CBNAME(wxControlPoint* a, double b, double c, int d, int e);           \ 
1192     void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e) 
1195 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME)                     \ 
1196     void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) {   \ 
1198         wxPyBeginBlockThreads();                            \ 
1199         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1200             PyObject* obj = wxPyMake_wxObject(a);                               \ 
1201             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e));   \ 
1204         wxPyEndBlockThreads();                                             \ 
1206             PCLASS::CBNAME(a, b, c, d, e);                                      \ 
1208     void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c,            \ 
1210         PCLASS::CBNAME(a, b, c, d, e);                                          \ 
1213 //--------------------------------------------------------------------------- 
1215 #define DEC_PYCALLBACK__2DBLINT(CBNAME)                 \ 
1216     void CBNAME(double a, double b, int c);             \ 
1217     void base_##CBNAME(double a, double b, int c) 
1220 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME)                          \ 
1221     void CLASS::CBNAME(double a, double b, int c) {                             \ 
1223         wxPyBeginBlockThreads();                            \ 
1224         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1225             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c));      \ 
1226         wxPyEndBlockThreads();                                             \ 
1228             PCLASS::CBNAME(a, b, c);                                            \ 
1230     void CLASS::base_##CBNAME(double a, double b, int c) {                      \ 
1231         PCLASS::CBNAME(a, b, c);                                                \ 
1234 //--------------------------------------------------------------------------- 
1236 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME)                     \ 
1237     void CBNAME(bool a, double b, double c, int d);             \ 
1238     void base_##CBNAME(bool a, double b, double c, int d) 
1241 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME)                      \ 
1242     void CLASS::CBNAME(bool a, double b, double c, int d) {                     \ 
1244         wxPyBeginBlockThreads();                                                \ 
1245         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1246             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\ 
1247         wxPyEndBlockThreads();                                                  \ 
1249             PCLASS::CBNAME(a, b, c, d);                                         \ 
1251     void CLASS::base_##CBNAME(bool a, double b, double c, int d) {              \ 
1252         PCLASS::CBNAME(a, b, c, d);                                             \ 
1255 //--------------------------------------------------------------------------- 
1256 //--------------------------------------------------------------------------- 
1258 #define DEC_PYCALLBACK__STRING(CBNAME)                  \ 
1259     void CBNAME(const wxString& a);                     \ 
1260     void base_##CBNAME(const wxString& a) 
1262 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME)                           \ 
1263     void CLASS::CBNAME(const wxString& a)  {                                    \ 
1265         wxPyBeginBlockThreads();                                                \ 
1266         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1267             PyObject* s = wx2PyString(a);                                       \ 
1268             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));            \ 
1271         wxPyEndBlockThreads();                                                  \ 
1273             PCLASS::CBNAME(a);                                                  \ 
1275     void CLASS::base_##CBNAME(const wxString& a) {                              \ 
1276         PCLASS::CBNAME(a);                                                      \ 
1279 //--------------------------------------------------------------------------- 
1281 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME)              \ 
1282     bool CBNAME(const wxString& a);                     \ 
1283     bool base_##CBNAME(const wxString& a) 
1285 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME)                       \ 
1286     bool CLASS::CBNAME(const wxString& a)  {                                    \ 
1289         wxPyBeginBlockThreads();                                                \ 
1290         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1291             PyObject* s = wx2PyString(a);                                       \ 
1292             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));     \ 
1295         wxPyEndBlockThreads();                                                  \ 
1297             rval = PCLASS::CBNAME(a);                                           \ 
1300     bool CLASS::base_##CBNAME(const wxString& a) {                              \ 
1301         return PCLASS::CBNAME(a);                                               \ 
1304 //--------------------------------------------------------------------------- 
1306 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME)         \ 
1307     bool CBNAME(const wxString& a) 
1309 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME)                  \ 
1310     bool CLASS::CBNAME(const wxString& a)  {                                    \ 
1312         wxPyBeginBlockThreads();                                                \ 
1313         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1314             PyObject* s = wx2PyString(a);                                       \ 
1315             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s));     \ 
1318         wxPyEndBlockThreads();                                                  \ 
1322 //--------------------------------------------------------------------------- 
1324 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME)                               \ 
1325     wxString CBNAME(const wxString& a) 
1327 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME)                \ 
1328     wxString CLASS::CBNAME(const wxString& a)  {                                \ 
1330         wxPyBeginBlockThreads();                                                \ 
1331         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1333             PyObject* s = wx2PyString(a);                                       \ 
1334             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s));    \ 
1337                 rval = Py2wxString(ro);                                         \ 
1341         wxPyEndBlockThreads();                                                  \ 
1345 //--------------------------------------------------------------------------- 
1347 #define DEC_PYCALLBACK_STRING_STRING(CBNAME)                                    \ 
1348     wxString CBNAME(const wxString& a);                                         \ 
1349     wxString base_##CBNAME(const wxString& a) 
1351 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME)                     \ 
1352     wxString CLASS::CBNAME(const wxString& a)  {                                \ 
1355         wxPyBeginBlockThreads();                                                \ 
1356         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1358             PyObject* s = wx2PyString(a);                                       \ 
1359             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s));    \ 
1362                 rval = Py2wxString(ro);                                         \ 
1367             rval = PCLASS::CBNAME(a);                                           \ 
1368         wxPyEndBlockThreads();                                                  \ 
1372 //--------------------------------------------------------------------------- 
1374 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME)                            \ 
1375     wxString CBNAME(const wxString& a,int b) 
1377 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME)             \ 
1378     wxString CLASS::CBNAME(const wxString& a,int b)  {                          \ 
1380         wxPyBeginBlockThreads();                                                \ 
1381         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1383             PyObject* s = wx2PyString(a);                                       \ 
1384             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b));  \ 
1387                 rval = Py2wxString(ro);                                         \ 
1391         wxPyEndBlockThreads();                                                  \ 
1395 //--------------------------------------------------------------------------- 
1397 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME)              \ 
1398     bool CBNAME(const wxString& a, const wxString& b);        \ 
1399     bool base_##CBNAME(const wxString& a, const wxString& b) 
1401 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME)                 \ 
1402     bool CLASS::CBNAME(const wxString& a, const wxString& b) {                  \ 
1405         wxPyBeginBlockThreads();                                                \ 
1406         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1407             PyObject* s1 = wx2PyString(a);                                      \ 
1408             PyObject* s2 = wx2PyString(b);                                      \ 
1409             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \ 
1413         wxPyEndBlockThreads();                                                  \ 
1415             rval = PCLASS::CBNAME(a, b);                                        \ 
1418     bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) {           \ 
1419         return PCLASS::CBNAME(a, b);                                            \ 
1422 //--------------------------------------------------------------------------- 
1424 #define DEC_PYCALLBACK_STRING_(CBNAME)                  \ 
1425     wxString CBNAME();                                  \ 
1426     wxString base_##CBNAME() 
1428 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME)                           \ 
1429     wxString CLASS::CBNAME() {                                                  \ 
1432         wxPyBeginBlockThreads();                            \ 
1433         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1435             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
1437                 rval = Py2wxString(ro);                                         \ 
1441         wxPyEndBlockThreads();                                                  \ 
1443             rval = PCLASS::CBNAME();                                            \ 
1446     wxString CLASS::base_##CBNAME() {                                           \ 
1447         return PCLASS::CBNAME();                                                \ 
1450 //--------------------------------------------------------------------------- 
1452 #define DEC_PYCALLBACK_STRING__const(CBNAME)                  \ 
1453     wxString CBNAME() const;                                  \ 
1454     wxString base_##CBNAME() const; 
1456 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME)                     \ 
1457     wxString CLASS::CBNAME() const {                                            \ 
1460         wxPyBeginBlockThreads();                            \ 
1461         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1463             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
1465                 rval = Py2wxString(ro);                                         \ 
1469         wxPyEndBlockThreads();                                                  \ 
1471             rval = PCLASS::CBNAME();                                            \ 
1474     wxString CLASS::base_##CBNAME() const {                                     \ 
1475         return PCLASS::CBNAME();                                                \ 
1478 //--------------------------------------------------------------------------- 
1480 #define DEC_PYCALLBACK_STRING__pure(CBNAME)             \ 
1483 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME)                      \ 
1484     wxString CLASS::CBNAME() {                                                  \ 
1486         wxPyBeginBlockThreads();                            \ 
1487         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1489             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
1491                 rval = Py2wxString(ro);                                         \ 
1495         wxPyEndBlockThreads();                                                  \ 
1499 //--------------------------------------------------------------------------- 
1501 #define DEC_PYCALLBACK_STRING__constpure(CBNAME)             \ 
1502     wxString CBNAME() const; 
1504 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME)                 \ 
1505     wxString CLASS::CBNAME() const {                                            \ 
1507         wxPyBeginBlockThreads();                                                \ 
1508         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1510             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
1512                 rval = Py2wxString(ro);                                         \ 
1516         wxPyEndBlockThreads();                                                  \ 
1520 //--------------------------------------------------------------------------- 
1522 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME)                  \ 
1523     bool CBNAME(const wxHtmlTag& a) 
1526 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME)                     \ 
1527     bool CLASS::CBNAME(const wxHtmlTag& a)  {                                   \ 
1529         wxPyBeginBlockThreads();                                                \ 
1530         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1531             PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);     \ 
1532             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));   \ 
1535         wxPyEndBlockThreads();                                                  \ 
1539 //--------------------------------------------------------------------------- 
1541 #define DEC_PYCALLBACK__CELLINTINT(CBNAME)                                      \ 
1542     void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);                        \ 
1543     void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) 
1545 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME)                       \ 
1546     void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) {                \ 
1548         wxPyBeginBlockThreads();                                                \ 
1549         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1550             PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0);  \ 
1551             wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y));  \ 
1554         wxPyEndBlockThreads();                                                  \ 
1556             PCLASS::CBNAME(cell, x, y);                                         \ 
1558     void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) {         \ 
1559         PCLASS::CBNAME(cell, x, y);                                             \ 
1563 //--------------------------------------------------------------------------- 
1565 #define DEC_PYCALLBACK__CELLINTINTME(CBNAME)                                    \ 
1566     void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \ 
1567     void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) 
1569 #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME)                       \ 
1570     void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {                \ 
1572         wxPyBeginBlockThreads();                                                \ 
1573         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1574             PyObject* obj = wxPyConstructObject((void*)cell, wxT("wxHtmlCell"), 0);  \ 
1575             PyObject* o2  = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0);  \ 
1576             wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2));  \ 
1580         wxPyEndBlockThreads();                                                  \ 
1582             PCLASS::CBNAME(cell, x, y, e);                                      \ 
1584     void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) {         \ 
1585         PCLASS::CBNAME(cell, x, y, e);                                          \ 
1590 //--------------------------------------------------------------------------- 
1592 #define DEC_PYCALLBACK___pure(CBNAME)                         \ 
1596 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME)                            \ 
1597     void CLASS::CBNAME() {                                                      \ 
1598         wxPyBeginBlockThreads();                                                \ 
1599         if (wxPyCBH_findCallback(m_myInst, #CBNAME))                            \ 
1600             wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));                \ 
1601         wxPyEndBlockThreads();                                                  \ 
1604 //--------------------------------------------------------------------------- 
1606 #define DEC_PYCALLBACK_wxSize__pure(CBNAME)                         \ 
1610 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME)                      \ 
1611     wxSize CLASS::CBNAME() {                                                    \ 
1612         const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \ 
1614         wxPyBeginBlockThreads();                                                \ 
1615         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
1618             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
1620                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize")))       \ 
1622                 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) {    \ 
1623                     PyObject* o1 = PySequence_GetItem(ro, 0);                   \ 
1624                     PyObject* o2 = PySequence_GetItem(ro, 1);                   \ 
1625                     if (PyNumber_Check(o1) && PyNumber_Check(o2))               \ 
1626                         rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2));      \ 
1628                         PyErr_SetString(PyExc_TypeError, errmsg);               \ 
1633                     PyErr_SetString(PyExc_TypeError, errmsg);                   \ 
1638         wxPyEndBlockThreads();                                                  \ 
1642 //--------------------------------------------------------------------------- 
1644 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME)                      \ 
1645     bool CBNAME(wxWindow* a);                                  \ 
1646     bool base_##CBNAME(wxWindow* a) 
1649 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME)                        \ 
1650     bool CLASS::CBNAME(wxWindow* a) {                                           \ 
1653         wxPyBeginBlockThreads();                                                \ 
1654         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1655             PyObject* obj = wxPyMake_wxObject(a);                               \ 
1656             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));   \ 
1659         wxPyEndBlockThreads();                                                  \ 
1661             rval = PCLASS::CBNAME(a);                                           \ 
1664     bool CLASS::base_##CBNAME(wxWindow* a) {                                    \ 
1665         return PCLASS::CBNAME(a);                                               \ 
1668 //--------------------------------------------------------------------------- 
1670 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME)                             \ 
1671     bool CBNAME(wxWindow* a, wxDC& b);                                  \ 
1672     bool base_##CBNAME(wxWindow* a, wxDC& b) 
1675 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME)                        \ 
1676     bool CLASS::CBNAME(wxWindow* a, wxDC& b) {                                  \ 
1679         wxPyBeginBlockThreads();                                                \ 
1680         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1681             PyObject* win = wxPyMake_wxObject(a);                               \ 
1682             PyObject* dc  = wxPyMake_wxObject(&b);                              \ 
1683             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\ 
1687         wxPyEndBlockThreads();                                                  \ 
1689             rval = PCLASS::CBNAME(a, b);                                        \ 
1692     bool CLASS::base_##CBNAME(wxWindow* a, wxDC& b) {                           \ 
1693         return PCLASS::CBNAME(a, b);                                            \ 
1696 //--------------------------------------------------------------------------- 
1698 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME)                      \ 
1699     void CBNAME(wxWindowBase* a);                                  \ 
1700     void base_##CBNAME(wxWindowBase* a) 
1703 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME)                    \ 
1704     void CLASS::CBNAME(wxWindowBase* a) {                                       \ 
1706         wxPyBeginBlockThreads();                                                \ 
1707         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1708             PyObject* obj = wxPyMake_wxObject(a);                               \ 
1709             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));          \ 
1712         wxPyEndBlockThreads();                                                  \ 
1714             PCLASS::CBNAME(a);                                                  \ 
1716     void CLASS::base_##CBNAME(wxWindowBase* a) {                                \ 
1717         PCLASS::CBNAME(a);                                                      \ 
1720 //--------------------------------------------------------------------------- 
1722 #define DEC_PYCALLBACK_BOOL_(CBNAME)                      \ 
1724     bool base_##CBNAME() 
1727 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME)                             \ 
1728     bool CLASS::CBNAME() {                                                      \ 
1731         wxPyBeginBlockThreads();                                                \ 
1732         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1733             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));         \ 
1734         wxPyEndBlockThreads();                                                  \ 
1736             rval = PCLASS::CBNAME();                                            \ 
1739     bool CLASS::base_##CBNAME() {                                               \ 
1740         return PCLASS::CBNAME();                                                \ 
1743 //--------------------------------------------------------------------------- 
1745 #define DEC_PYCALLBACK_BOOL_const(CBNAME)                       \ 
1746     bool CBNAME() const;                                        \ 
1747     bool base_##CBNAME() const 
1750 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME)                        \ 
1751     bool CLASS::CBNAME() const {                                                \ 
1754         wxPyBeginBlockThreads();                                                \ 
1755         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1756             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));         \ 
1757         wxPyEndBlockThreads();                                                  \ 
1759             rval = PCLASS::CBNAME();                                            \ 
1762     bool CLASS::base_##CBNAME() const {                                         \ 
1763         return PCLASS::CBNAME();                                                \ 
1766 //--------------------------------------------------------------------------- 
1768 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME)                                \ 
1769     wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);        \ 
1770     wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def) 
1773 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME)                         \ 
1774     wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) {          \ 
1777         wxPyBeginBlockThreads();                                                \ 
1778         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1779             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ 
1780         wxPyEndBlockThreads();                                                  \ 
1782             rval = PCLASS::CBNAME(a, b, c);                                     \ 
1783         return (wxDragResult)rval;                                              \ 
1785     wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) {   \ 
1786         return PCLASS::CBNAME(a, b, c);                                         \ 
1789 //--------------------------------------------------------------------------- 
1791 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME)                        \ 
1792     wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location) 
1794 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME)         \ 
1795     wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) {        \ 
1796         wxPyBeginBlockThreads();                                        \ 
1798         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                  \ 
1800             PyObject* obj = wxPyMake_wxObject(&a);                      \ 
1801             PyObject* s = wx2PyString(b);                               \ 
1802             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\ 
1805                 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFILE"));\ 
1811         wxPyEndBlockThreads();                                          \ 
1815 //--------------------------------------------------------------------------- 
1817 #define DEC_PYCALLBACK_BOOL_DR(CBNAME)                  \ 
1818     bool CBNAME(wxDragResult a);                        \ 
1819     bool base_##CBNAME(wxDragResult a) 
1822 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME)                   \ 
1823     bool CLASS::CBNAME(wxDragResult a) {                                \ 
1826         wxPyBeginBlockThreads();                                        \ 
1827         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))          \ 
1828             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\ 
1829         wxPyEndBlockThreads();                                          \ 
1831             rval = PCLASS::CBNAME(a);                                   \ 
1834     bool CLASS::base_##CBNAME(wxDragResult a) {                         \ 
1835         return PCLASS::CBNAME(a);                                       \ 
1838 //--------------------------------------------------------------------------- 
1840 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME)   \ 
1841     wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def) 
1844 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME)            \ 
1845     wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) {  \ 
1846         wxPyBeginBlockThreads();                                        \ 
1848         if (wxPyCBH_findCallback(m_myInst, #CBNAME))                    \ 
1849             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ 
1850         wxPyEndBlockThreads();                                          \ 
1851         return (wxDragResult)rval;                                      \ 
1854 //--------------------------------------------------------------------------- 
1856 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME)                      \ 
1857     bool CBNAME(int a, int b, const wxString& c) 
1859 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME)       \ 
1860     bool CLASS::CBNAME(int a, int b, const wxString& c) {               \ 
1862         wxPyBeginBlockThreads();                                        \ 
1863         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                  \ 
1864             PyObject* s = wx2PyString(c);                               \ 
1865             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ 
1868         wxPyEndBlockThreads();                                          \ 
1872 //--------------------------------------------------------------------------- 
1874 #define DEC_PYCALLBACK_SIZET_(CBNAME)                  \ 
1876     size_t base_##CBNAME() 
1879 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME)                            \ 
1880     size_t CLASS::CBNAME() {                                                    \ 
1883         wxPyBeginBlockThreads();                                                \ 
1884         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1885             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));         \ 
1886         wxPyEndBlockThreads();                                                  \ 
1888             rval = PCLASS::CBNAME();                                            \ 
1891     size_t CLASS::base_##CBNAME() {                                             \ 
1892         return PCLASS::CBNAME();                                                \ 
1895 //--------------------------------------------------------------------------- 
1897 #define DEC_PYCALLBACK_SIZET__const(CBNAME)                  \ 
1898     size_t CBNAME() const;                                   \ 
1899     size_t base_##CBNAME() const 
1902 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME)                       \ 
1903     size_t CLASS::CBNAME() const {                                              \ 
1906         wxPyBeginBlockThreads();                                                \ 
1907         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
1908             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));         \ 
1909         wxPyEndBlockThreads();                                                  \ 
1911             rval = PCLASS::CBNAME();                                            \ 
1914     size_t CLASS::base_##CBNAME() const {                                       \ 
1915         return PCLASS::CBNAME();                                                \ 
1918 //--------------------------------------------------------------------------- 
1920 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME)                                    \ 
1921     wxDataFormat  CBNAME(size_t a);                                             \ 
1922     wxDataFormat  base_##CBNAME(size_t a) 
1925 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME)                     \ 
1926     wxDataFormat CLASS::CBNAME(size_t a) {                                      \ 
1927         wxDataFormat rval=0;                                                    \ 
1929         wxPyBeginBlockThreads();                                                \ 
1930         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1932             wxDataFormat* ptr;                                                  \ 
1933             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a));    \ 
1935                 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \ 
1940         wxPyEndBlockThreads();                                                  \ 
1942             rval = PCLASS::CBNAME(a);                                           \ 
1945     wxDataFormat  CLASS::base_##CBNAME(size_t a) {                              \ 
1946         return PCLASS::CBNAME(a);                                               \ 
1949 //--------------------------------------------------------------------------- 
1951 #define DEC_PYCALLBACK__constany(CBNAME, Type)          \ 
1952     void CBNAME(const Type& a);                         \ 
1953     void base_##CBNAME(const Type& a) 
1956 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type)                   \ 
1957     void CLASS::CBNAME(const Type& a) {                                         \ 
1959         wxPyBeginBlockThreads();                                                \ 
1960         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1961             PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0);           \ 
1962             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));          \ 
1965         wxPyEndBlockThreads();                                                  \ 
1967             PCLASS::CBNAME(a);                                                  \ 
1969     void CLASS::base_##CBNAME(const Type& a) {                                  \ 
1970         PCLASS::CBNAME(a);                                                      \ 
1974 //--------------------------------------------------------------------------- 
1976 #define DEC_PYCALLBACK__any(CBNAME, Type)          \ 
1977     void CBNAME(Type& a);                          \ 
1978     void base_##CBNAME(Type& a) 
1981 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type)                        \ 
1982     void CLASS::CBNAME(Type& a) {                                               \ 
1984         wxPyBeginBlockThreads();                                                \ 
1985         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
1986             PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0);           \ 
1987             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));          \ 
1990         wxPyEndBlockThreads();                                                  \ 
1992             PCLASS::CBNAME(a);                                                  \ 
1994     void CLASS::base_##CBNAME(Type& a) {                                        \ 
1995         PCLASS::CBNAME(a);                                                      \ 
1998 //--------------------------------------------------------------------------- 
2000 #define DEC_PYCALLBACK_bool_any(CBNAME, Type)           \ 
2001     bool CBNAME(Type& a);                               \ 
2002     bool base_##CBNAME(Type& a) 
2005 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type)                    \ 
2006     bool CLASS::CBNAME(Type& a) {                                               \ 
2009         wxPyBeginBlockThreads();                                                \ 
2010         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2011             PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0);           \ 
2012             rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));     \ 
2015         wxPyEndBlockThreads();                                                  \ 
2017             rv = PCLASS::CBNAME(a);                                             \ 
2020     bool CLASS::base_##CBNAME(Type& a) {                                        \ 
2021         return PCLASS::CBNAME(a);                                               \ 
2024 //--------------------------------------------------------------------------- 
2026 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type)                               \ 
2027     bool CBNAME(Type& a) 
2030 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type)                \ 
2031     bool CLASS::CBNAME(Type& a) {                                               \ 
2033         wxPyBeginBlockThreads();                                                \ 
2034         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2035             PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0);           \ 
2036             rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));     \ 
2039         wxPyEndBlockThreads();                                                  \ 
2043 //--------------------------------------------------------------------------- 
2045 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME)                                  \ 
2046     wxString CBNAME(long a, long b) const;                                      \ 
2047     wxString base_##CBNAME(long a, long b) const 
2049 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME)                   \ 
2050     wxString CLASS::CBNAME(long a, long b) const {                              \ 
2053         wxPyBeginBlockThreads();                                                \ 
2054         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2056             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b));  \ 
2058                 rval = Py2wxString(ro);                                         \ 
2062         wxPyEndBlockThreads();                                                  \ 
2064             rval = PCLASS::CBNAME(a,b);                                         \ 
2067     wxString CLASS::base_##CBNAME(long a, long b) const {                       \ 
2068         return PCLASS::CBNAME(a,b);                                             \ 
2071 //--------------------------------------------------------------------------- 
2073 #define DEC_PYCALLBACK_INT_LONG(CBNAME)                                         \ 
2074     int CBNAME(long a) const;                                                   \ 
2075     int base_##CBNAME(long a) const 
2078 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME)                          \ 
2079     int CLASS::CBNAME(long a) const {                                           \ 
2082         wxPyBeginBlockThreads();                                                \ 
2083         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2085             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a));     \ 
2087                 rval = PyInt_AsLong(ro);                                        \ 
2091         wxPyEndBlockThreads();                                                  \ 
2093             rval = PCLASS::CBNAME(a);                                           \ 
2096     int CLASS::base_##CBNAME(long a) const {                                    \ 
2097         return PCLASS::CBNAME(a);                                               \ 
2101 //--------------------------------------------------------------------------- 
2103 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME)                                    \ 
2104     wxListItemAttr*  CBNAME(long a) const;                                      \ 
2105     wxListItemAttr*  base_##CBNAME(long a) const 
2108 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME)                     \ 
2109     wxListItemAttr *CLASS::CBNAME(long a) const {                               \ 
2110         wxListItemAttr *rval = NULL;                                            \ 
2112         wxPyBeginBlockThreads();                                                \ 
2113         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2115             wxListItemAttr* ptr;                                                \ 
2116             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a));    \ 
2118                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\ 
2123         wxPyEndBlockThreads();                                                  \ 
2125             rval = PCLASS::CBNAME(a);                                           \ 
2128     wxListItemAttr *CLASS::base_##CBNAME(long a) const {                        \ 
2129         return PCLASS::CBNAME(a);                                               \ 
2132 //--------------------------------------------------------------------------- 
2134 #define DEC_PYCALLBACK_BOOL_ME(CBNAME)                                          \ 
2135     bool CBNAME(wxMouseEvent& e);                                               \ 
2136     bool base_##CBNAME(wxMouseEvent& e) 
2138 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME)                           \ 
2139     bool CLASS::CBNAME(wxMouseEvent& e) {                                       \ 
2142         wxPyBeginBlockThreads();                                                \ 
2143         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2145             PyObject* obj  = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \ 
2146             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj));   \ 
2148                 rval = PyInt_AsLong(ro);                                        \ 
2153         wxPyEndBlockThreads();                                                  \ 
2155             return PCLASS::CBNAME(e);                                           \ 
2158     bool CLASS::base_##CBNAME(wxMouseEvent& e) {                                \ 
2159         return PCLASS::CBNAME(e);                                               \ 
2163 //--------------------------------------------------------------------------- 
2165 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME)                                      \ 
2166     wxWizardPage* CBNAME() const 
2168 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME)                       \ 
2169     wxWizardPage* CLASS::CBNAME() const {                                       \ 
2170         wxWizardPage* rv = NULL;                                                \ 
2171         wxPyBeginBlockThreads();                                                \ 
2172         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2174             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
2176                 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage"));      \ 
2180         wxPyEndBlockThreads();                                                  \ 
2184 //--------------------------------------------------------------------------- 
2186 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME)                                     \ 
2187     wxBitmap CBNAME() const 
2189 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME)                      \ 
2190     wxBitmap CLASS::CBNAME() const {                                            \ 
2192         wxPyBeginBlockThreads();                                                \ 
2193         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2196             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
2198                 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap")))     \ 
2203         wxPyEndBlockThreads();                                                  \ 
2207 //--------------------------------------------------------------------------- 
2209 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME)                                     \ 
2212 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME)                      \ 
2213     wxObject* CLASS::CBNAME() {                                                 \ 
2214         wxObject* rv = NULL;                                                    \ 
2215         wxPyBeginBlockThreads();                                                \ 
2216         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2218             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()"));        \ 
2220                 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject"));          \ 
2224         wxPyEndBlockThreads();                                                  \ 
2228 //--------------------------------------------------------------------------- 
2230 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME)                               \ 
2231     wxObject* CBNAME(const wxString& a) 
2233 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME)                \ 
2234     wxObject* CLASS::CBNAME(const wxString& a) {                                \ 
2235         wxObject* rv = NULL;                                                    \ 
2236         wxPyBeginBlockThreads();                                                \ 
2237         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2238             PyObject* so = wx2PyString(a);                                      \ 
2240             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so));   \ 
2242                 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject"));          \ 
2247         wxPyEndBlockThreads();                                                  \ 
2251 //--------------------------------------------------------------------------- 
2253 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME)                                   \ 
2254     bool CBNAME(wxXmlNode* a) 
2257 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME)                    \ 
2258     bool CLASS::CBNAME(wxXmlNode* a) {                                          \ 
2260         wxPyBeginBlockThreads();                                                \ 
2261         if (wxPyCBH_findCallback(m_myInst, #CBNAME)) {                          \ 
2262             PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0);      \ 
2263             rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj));     \ 
2266         wxPyEndBlockThreads();                                                  \ 
2270 //--------------------------------------------------------------------------- 
2272 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME)                            \ 
2273     wxCoord CBNAME(size_t a) const 
2276 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME)             \ 
2277     wxCoord CLASS::CBNAME(size_t a) const {                                     \ 
2280         wxPyBeginBlockThreads();                                                \ 
2281         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2282             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));     \ 
2284         wxPyEndBlockThreads();                                                  \ 
2288 //--------------------------------------------------------------------------- 
2290 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME)                            \ 
2291     void CBNAME(size_t a, size_t b) const;                                      \ 
2292     void base_##CBNAME(size_t a, size_t b) const 
2295 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME)             \ 
2296     void CLASS::CBNAME(size_t a, size_t b) const {                              \ 
2298         wxPyBeginBlockThreads();                                                \ 
2299         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
2300             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b));          \ 
2301         wxPyEndBlockThreads();                                                  \ 
2303             PCLASS::CBNAME(a,b);                                                \ 
2305     void CLASS::base_##CBNAME(size_t a, size_t b) const {                       \ 
2306         PCLASS::CBNAME(a,b);                                                    \ 
2309 //--------------------------------------------------------------------------- 
2311 #define DEC_PYCALLBACK_COORD_const(CBNAME)                       \ 
2312     wxCoord CBNAME() const;                                      \ 
2313     wxCoord base_##CBNAME() const 
2316 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME)                       \ 
2317     wxCoord CLASS::CBNAME() const {                                             \ 
2320         wxPyBeginBlockThreads();                                                \ 
2321         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME)))                  \ 
2322             rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()"));         \ 
2323         wxPyEndBlockThreads();                                                  \ 
2325             rval = PCLASS::CBNAME();                                            \ 
2328     wxCoord CLASS::base_##CBNAME() const {                                      \ 
2329         return PCLASS::CBNAME();                                                \ 
2332 //--------------------------------------------------------------------------- 
2334 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME)                           \ 
2335     void CBNAME(wxDC& a, const wxRect& b, size_t c) const; 
2338 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME)            \ 
2339     void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const {              \ 
2341         wxPyBeginBlockThreads();                                                \ 
2342         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2343             PyObject* obj = wxPyMake_wxObject(&a);                              \ 
2344             PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0);    \ 
2345             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \ 
2348         wxPyEndBlockThreads();                                                  \ 
2351 //--------------------------------------------------------------------------- 
2353 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME)                               \ 
2354     void CBNAME(wxDC& a, const wxRect& b, size_t c) const;                      \ 
2355     void base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const 
2358 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME)                \ 
2359     void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const {              \ 
2361         wxPyBeginBlockThreads();                                                \ 
2362         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2363             PyObject* obj = wxPyMake_wxObject(&a);                              \ 
2364             PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0);    \ 
2365             wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \ 
2368         wxPyEndBlockThreads();                                                  \ 
2370             PCLASS::CBNAME(a,b,c);                                              \ 
2372     void CLASS::base_##CBNAME(wxDC& a, const wxRect& b, size_t c) const {       \ 
2373         PCLASS::CBNAME(a,b,c);                                                  \ 
2376 //--------------------------------------------------------------------------- 
2379 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME)                                     \ 
2380     wxString CBNAME(size_t a) const;                                            \ 
2381     wxString base_##CBNAME(size_t a) const 
2383 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME)                      \ 
2384     wxString CLASS::CBNAME(size_t a) const {                                    \ 
2387         wxPyBeginBlockThreads();                                                \ 
2388         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2390             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a));     \ 
2392                 rval = Py2wxString(ro);                                         \ 
2396         wxPyEndBlockThreads();                                                  \ 
2398             rval = PCLASS::CBNAME(a);                                           \ 
2401     wxString CLASS::base_##CBNAME(size_t a) const {                             \ 
2402         return PCLASS::CBNAME(a);                                               \ 
2405 //--------------------------------------------------------------------------- 
2407 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME)                                \ 
2408     wxString CBNAME(size_t a) const 
2410 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME)                 \ 
2411     wxString CLASS::CBNAME(size_t a) const {                                    \ 
2414         wxPyBeginBlockThreads();                                                \ 
2415         if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) {                \ 
2417             ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a));     \ 
2419                 rval = Py2wxString(ro);                                         \ 
2423         wxPyEndBlockThreads();                                                  \ 
2427 //---------------------------------------------------------------------------