1 ////////////////////////////////////////////////////////////////////////////
2 // Name: wxPython_int.h (int == internal)
3 // Purpose: Helper functions/classes for the wxPython extension module
4 // This header should only be inclued directly by those source
5 // modules included in the wx._core module. All others should
6 // include wx/wxPython/wxPython.h instead.
10 // Created: 1-July-1997
12 // Copyright: (c) 1998 by Total Control Software
13 // Licence: wxWindows license
14 /////////////////////////////////////////////////////////////////////////////
16 #ifndef __wxp_helpers__
17 #define __wxp_helpers__
21 #include <wx/busyinfo.h>
23 #include <wx/choicebk.h>
24 #include <wx/clipbrd.h>
25 #include <wx/colordlg.h>
26 #include <wx/config.h>
27 #include <wx/cshelp.h>
28 #include <wx/dcmirror.h>
30 #include <wx/dirctrl.h>
31 #include <wx/dirdlg.h>
32 #include <wx/numdlg.h>
34 #include <wx/docview.h>
35 #include <wx/encconv.h>
36 #include <wx/fdrepdlg.h>
37 #include <wx/fileconf.h>
38 #include <wx/filesys.h>
39 #include <wx/fontdlg.h>
40 #include <wx/fs_inet.h>
41 #include <wx/fs_mem.h>
42 #include <wx/fs_zip.h>
43 #include <wx/gbsizer.h>
44 #include <wx/geometry.h>
45 #include <wx/htmllbox.h>
47 #include <wx/imaglist.h>
49 #include <wx/laywin.h>
50 #include <wx/listbook.h>
51 #include <wx/minifram.h>
52 #include <wx/notebook.h>
54 #include <wx/printdlg.h>
55 #include <wx/process.h>
56 #include <wx/progdlg.h>
57 #include <wx/sashwin.h>
58 #include <wx/spinbutt.h>
59 #include <wx/spinctrl.h>
60 #include <wx/splash.h>
61 #include <wx/splitter.h>
62 #include <wx/statline.h>
63 #include <wx/stream.h>
64 #include <wx/sysopt.h>
65 #include <wx/taskbar.h>
66 #include <wx/tglbtn.h>
67 #include <wx/tipwin.h>
68 #include <wx/toolbook.h>
69 #include <wx/tooltip.h>
70 #include <wx/treebook.h>
72 #include <wx/vscroll.h>
73 #include <wx/dateevt.h>
74 #include <wx/datectrl.h>
76 #include <wx/hyperlink.h>
77 #include <wx/pickerbase.h>
78 #include <wx/clrpicker.h>
79 #include <wx/filepicker.h>
80 #include <wx/fontpicker.h>
81 #include <wx/collpane.h>
82 #include <wx/srchctrl.h>
86 # pragma warning(disable:4800)
87 # pragma warning(disable:4190)
90 #ifdef __WXMAC__ // avoid a bug in Carbon headers
94 //---------------------------------------------------------------------------
96 #ifndef wxHAS_POWER_EVENTS
97 class wxPowerEvent
: public wxEvent
100 wxPowerEvent(wxEventType evtType
) : wxEvent(wxID_NONE
, evtType
) {}
102 bool IsVetoed() const { return false; }
103 virtual wxEvent
*Clone() const { return new wxPowerEvent(*this); }
107 //---------------------------------------------------------------------------
108 typedef unsigned char byte
;
109 typedef unsigned char* buffer
;
111 typedef wxPoint2DDouble wxPoint2D
;
112 typedef wxRect2DDouble wxRect2D
;
114 #ifndef SWIG_TYPE_TABLE
115 #define SWIG_TYPE_TABLE wxPython_type_table
119 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
121 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
125 #ifndef wxPyUSE_EXPORTED_API
127 void __wxPyPreStart(PyObject
*);
128 void __wxPyCleanup();
129 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
131 void wxSetDefaultPyEncoding(const char* encoding
);
132 const char* wxGetDefaultPyEncoding();
135 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
138 bool wxPyCheckSwigType(const wxChar
* className
);
139 PyObject
* wxPyConstructObject(void* ptr
,
140 const wxChar
* className
,
142 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
143 const wxChar
* className
);
144 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
147 PyObject
* wx2PyString(const wxString
& src
);
148 wxString
Py2wxString(PyObject
* source
);
150 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
151 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
152 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
154 PyObject
* wxPy_ConvertList(wxListBase
* list
);
155 long wxPyGetWinHandle(wxWindow
* win
);
157 void wxPy_ReinitStockObjects(int pass
);
159 bool wxPyInstance_Check(PyObject
* obj
);
160 bool wxPySwigInstance_Check(PyObject
* obj
);
163 #endif // wxPyUSE_EXPORTED_API
164 //---------------------------------------------------------------------------
166 // if we want to handle threads and Python threads are available...
167 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
168 #define WXP_WITH_THREAD
169 #else // no Python threads...
170 #undef WXP_WITH_THREAD
174 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
175 // blocking threads when calling back into Python. Using them instead of my
176 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
177 // wxPyEndBlockThreads.
179 // Unfortunatly there is a bug somewhere when using these new APIs on Python
180 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
181 // at breakpoints located in event handlers. I think that the cause may be
182 // something like the original PyThreadState for the main thread is not being
183 // restored for the callbacks, but I can't see where that could be
184 // happening... So we'll only activate this new change for Python 2.4+ :-(
186 #if PY_VERSION_HEX < 0x02040000
187 #define wxPyUSE_GIL_STATE 0
188 typedef bool wxPyBlock_t
;
189 #define wxPyBlock_t_default false
191 #define wxPyUSE_GIL_STATE 1
192 typedef PyGILState_STATE wxPyBlock_t
;
193 #define wxPyBlock_t_default PyGILState_UNLOCKED
197 // Python 2.5 changes the type of some API parameter and return types. Using
198 // this typedef for versions < 2.5 will help with the transition...
199 #if PY_VERSION_HEX < 0x02050000
200 typedef int Py_ssize_t
;
204 #ifndef wxPyUSE_EXPORTED_API
206 // For Python --> C++
207 PyThreadState
* wxPyBeginAllowThreads();
208 void wxPyEndAllowThreads(PyThreadState
* state
);
210 // For C++ --> Python
211 wxPyBlock_t
wxPyBeginBlockThreads();
212 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
214 #endif // wxPyUSE_EXPORTED_API
217 // A macro that will help to execute simple statments wrapped in
218 // StartBlock/EndBlockThreads calls
219 #define wxPyBLOCK_THREADS(stmt) \
220 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
222 // Raise the NotImplementedError exception (blocking threads)
223 #define wxPyRaiseNotImplemented() \
224 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
226 // Raise any exception with a string value (blocking threads)
227 #define wxPyErr_SetString(err, str) \
228 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
231 //---------------------------------------------------------------------------
232 // These are helpers used by the typemaps
234 #ifndef wxPyUSE_EXPORTED_API
236 wxString
* wxString_in_helper(PyObject
* source
);
238 byte
* byte_LIST_helper(PyObject
* source
);
239 int* int_LIST_helper(PyObject
* source
);
240 long* long_LIST_helper(PyObject
* source
);
241 char** string_LIST_helper(PyObject
* source
);
242 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
243 wxPoint2D
* wxPoint2D_LIST_helper(PyObject
* source
, size_t* npoints
);
244 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
245 wxString
* wxString_LIST_helper(PyObject
* source
);
246 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
247 wxPen
** wxPen_LIST_helper(PyObject
* source
);
249 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
250 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
251 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
252 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
253 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
254 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
255 bool wxRect2D_helper(PyObject
* source
, wxRect2D
** obj
);
258 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
259 bool wxColour_typecheck(PyObject
* source
);
262 // Other helpful stuff
263 bool wxPyCheckForApp();
264 bool wxPyTestDisplayAvailable();
266 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
267 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
269 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
270 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
271 PyObject
* wxArrayDouble2PyList_helper(const wxArrayDouble
& arr
);
273 #endif // wxPyUSE_EXPORTED_API
275 //---------------------------------------------------------------------------
277 #if PYTHON_API_VERSION < 1009
278 #define PySequence_Fast_GET_ITEM(o, i) \
279 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
282 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
283 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
284 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
286 //---------------------------------------------------------------------------
288 #ifndef wxPyUSE_EXPORTED_API
290 class wxPyCallback
: public wxObject
{
291 DECLARE_ABSTRACT_CLASS(wxPyCallback
)
293 wxPyCallback(PyObject
* func
);
294 wxPyCallback(const wxPyCallback
& other
);
297 void EventThunker(wxEvent
& event
);
302 #endif // wxPyUSE_EXPORTED_API
303 //---------------------------------------------------------------------------
304 //---------------------------------------------------------------------------
305 // These Event classes can be derived from in Python and passed through the
306 // event system without loosing anything. They do this by keeping a reference
307 // to themselves and some special case handling in wxPyCallback::EventThunker.
311 class wxPyEvtSelfRef
{
316 void SetSelf(PyObject
* self
, bool clone
=false);
317 PyObject
* GetSelf() const;
318 bool GetCloned() const { return m_cloned
; }
326 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
327 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
329 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
330 wxPyEvent(const wxPyEvent
& evt
);
333 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
337 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
338 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
340 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
341 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
344 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
349 //----------------------------------------------------------------------
350 // Forward decalre a few things used in the exported API
351 class wxPyClientData
;
353 class wxPyOORClientData
;
354 class wxPyCBInputStream
;
356 void wxPyClientData_dtor(wxPyClientData
* self
);
357 void wxPyUserData_dtor(wxPyUserData
* self
);
358 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
359 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
360 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
362 //---------------------------------------------------------------------------
363 // Export a C API in a struct. Other modules will be able to load this from
364 // the wx.core module and will then have safe access to these functions, even if
365 // in another shared library.
367 class wxPyCallbackHelper
;
371 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
372 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
373 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
374 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
376 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
377 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
378 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
379 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
381 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
383 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
384 wxString (*p_Py2wxString
)(PyObject
* source
);
385 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
387 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
388 int* (*p_int_LIST_helper
)(PyObject
* source
);
389 long* (*p_long_LIST_helper
)(PyObject
* source
);
390 char** (*p_string_LIST_helper
)(PyObject
* source
);
391 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
392 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
393 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
394 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
396 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
397 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
398 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
399 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
400 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
401 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2D
** obj
);
404 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
405 bool (*p_wxColour_typecheck
)(PyObject
* source
);
407 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
408 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
);
409 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
410 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
411 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
413 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
414 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
415 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
416 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
417 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
418 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
419 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
421 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
422 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
423 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
425 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
426 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
428 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
429 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
431 bool (*p_wxPyCheckForApp
)();
433 // Add all new items at the end...
434 PyObject
* (*p_wxArrayDoublePyList_helper
)(const wxArrayDouble
& arr
);
435 wxPoint2D
* (*p_wxPoint2D_LIST_helper
)(PyObject
* source
, size_t* npoints
);
436 bool (*p_wxRect2D_helper
)(PyObject
* source
, wxRect2D
** obj
);
441 #ifdef wxPyUSE_EXPORTED_API
442 // Notice that this is static, not extern. This is by design, each module
443 // needs one, but doesn't have to use it.
444 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
445 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
446 #endif // wxPyUSE_EXPORTED_API
448 //---------------------------------------------------------------------------
450 // A wxObject that holds a reference to a Python object
451 class wxPyUserData
: public wxObject
{
453 wxPyUserData(PyObject
* obj
) {
459 #ifdef wxPyUSE_EXPORTED_API
460 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
462 wxPyUserData_dtor(this);
469 // A wxClientData that holds a refernece to a Python object
470 class wxPyClientData
: public wxClientData
{
472 wxPyClientData(PyObject
* obj
, bool incref
=true) {
480 #ifdef wxPyUSE_EXPORTED_API
481 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
483 wxPyClientData_dtor(this);
491 // Just like wxPyClientData, except when this object is destroyed it does some
492 // OOR magic on the Python Object.
493 class wxPyOORClientData
: public wxPyClientData
{
495 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
496 : wxPyClientData(obj
, incref
) {}
497 ~wxPyOORClientData() {
499 #ifdef wxPyUSE_EXPORTED_API
500 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
502 wxPyOORClientData_dtor(this);
508 //---------------------------------------------------------------------------
509 // A wxImageHandler that can be derived from in Python.
512 class wxPyImageHandler
: public wxImageHandler
{
516 // used for interning method names as PyStrings
517 static PyObject
* m_DoCanRead_Name
;
518 static PyObject
* m_GetImageCount_Name
;
519 static PyObject
* m_LoadFile_Name
;
520 static PyObject
* m_SaveFile_Name
;
522 // converstion helpers
523 PyObject
* py_InputStream(wxInputStream
* stream
);
524 PyObject
* py_Image(wxImage
* image
);
525 PyObject
* py_OutputStream(wxOutputStream
* stream
);
530 void _SetSelf(PyObject
*self
);
532 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
533 bool verbose
=true, int index
=-1 );
534 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
536 virtual int GetImageCount(wxInputStream
& stream
);
537 virtual bool DoCanRead(wxInputStream
&stream
);
541 //---------------------------------------------------------------------------
542 // This class holds an instance of a Python Shadow Class object and assists
543 // with looking up and invoking Python callback methods from C++ virtual
544 // method redirections. For all classes which have virtuals which should be
545 // overridable in wxPython, a new subclass is created that contains a
546 // wxPyCallbackHelper.
549 class wxPyCallbackHelper
{
551 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
553 wxPyCallbackHelper() {
560 ~wxPyCallbackHelper() {
561 #ifdef wxPyUSE_EXPORTED_API
562 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
564 wxPyCBH_delete(this);
568 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
569 bool findCallback(const char* name
, bool setGuard
=true) const;
570 int callCallback(PyObject
* argTuple
) const;
571 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
572 PyObject
* GetLastFound() const { return m_lastFound
; }
574 void setRecursionGuard(PyObject
* method
) const;
575 void clearRecursionGuard(PyObject
* method
) const;
580 PyObject
* m_lastFound
;
583 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
587 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
588 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
=true);
589 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
590 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
591 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
596 //---------------------------------------------------------------------------
598 // This is used in C++ classes that need to be able to make callback to
599 // "overloaded" python methods
602 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
603 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
605 private: wxPyCallbackHelper m_myInst
608 //---------------------------------------------------------------------------
609 // The wxPythonApp class
612 wxPYAPP_ASSERT_SUPPRESS
= 1,
613 wxPYAPP_ASSERT_EXCEPTION
= 2,
614 wxPYAPP_ASSERT_DIALOG
= 4,
615 wxPYAPP_ASSERT_LOG
= 8
618 class wxPyApp
: public wxApp
620 DECLARE_ABSTRACT_CLASS(wxPyApp
)
628 int GetAssertMode() { return m_assertMode
; }
629 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
631 virtual bool OnInitGui();
632 virtual int OnExit();
634 virtual void OnAssertFailure(const wxChar
*file
,
640 virtual void ExitMainLoop();
641 // virtual int FilterEvent(wxEvent& event); // This one too????
643 // For catching Apple Events
644 virtual void MacOpenFile(const wxString
&fileName
);
645 virtual void MacPrintFile(const wxString
&fileName
);
646 virtual void MacNewFile();
647 virtual void MacReopenApp();
649 static bool GetMacSupportPCMenuShortcuts();
650 static long GetMacAboutMenuItemId();
651 static long GetMacPreferencesMenuItemId();
652 static long GetMacExitMenuItemId();
653 static wxString
GetMacHelpMenuTitleName();
655 static void SetMacSupportPCMenuShortcuts(bool val
);
656 static void SetMacAboutMenuItemId(long val
);
657 static void SetMacPreferencesMenuItemId(long val
);
658 static void SetMacExitMenuItemId(long val
);
659 static void SetMacHelpMenuTitleName(const wxString
& val
);
662 void _BootstrapApp();
664 // implementation only
665 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
669 bool m_startupComplete
;
672 extern wxPyApp
*wxPythonApp
;
675 //----------------------------------------------------------------------
676 // These macros are used to implement the virtual methods that should
677 // redirect to a Python method if one exists. The names designate the
678 // return type, if any, as well as any parameter types.
679 //---------------------------------------------------------------------------
681 #define DEC_PYCALLBACK__(CBNAME) \
685 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
686 void CLASS::CBNAME() { \
688 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
689 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
690 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
691 wxPyEndBlockThreads(blocked); \
696 #define DEC_PYCALLBACK_VOID_(CBNAME) \
697 DEC_PYCALLBACK__(CBNAME)
699 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
700 IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)
702 //---------------------------------------------------------------------------
704 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
705 bool CBNAME(int a, int b)
708 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
709 bool CLASS::CBNAME(int a, int b) { \
710 bool rval=false, found; \
711 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
712 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
713 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
714 wxPyEndBlockThreads(blocked); \
716 rval = PCLASS::CBNAME(a,b); \
720 //---------------------------------------------------------------------------
722 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
723 void CBNAME(int a, int b)
726 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
727 void CLASS::CBNAME(int a, int b) { \
729 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
730 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
731 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
732 wxPyEndBlockThreads(blocked); \
734 PCLASS::CBNAME(a,b); \
737 //---------------------------------------------------------------------------
739 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
743 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
744 void CLASS::CBNAME(int a) { \
746 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
747 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
748 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
749 wxPyEndBlockThreads(blocked); \
754 //---------------------------------------------------------------------------
756 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
757 void CBNAME(int a, int b, int c, int d)
760 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
761 void CLASS::CBNAME(int a, int b, int c, int d) { \
763 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
764 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
765 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
766 wxPyEndBlockThreads(blocked); \
768 PCLASS::CBNAME(a,b,c,d); \
771 //---------------------------------------------------------------------------
772 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
773 void CBNAME(int a, int b, int c, int d, int e)
776 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
777 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
779 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
780 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
781 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
782 wxPyEndBlockThreads(blocked); \
784 PCLASS::CBNAME(a,b,c,d,e); \
787 //---------------------------------------------------------------------------
789 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
790 void CBNAME(int* a, int* b) const
793 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
794 void CLASS::CBNAME(int* a, int* b) const { \
795 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
797 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
798 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
800 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
802 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
803 PyObject* o1 = PySequence_GetItem(ro, 0); \
804 PyObject* o2 = PySequence_GetItem(ro, 1); \
805 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
806 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
809 PyErr_SetString(PyExc_TypeError, errmsg); \
814 PyErr_SetString(PyExc_TypeError, errmsg); \
819 wxPyEndBlockThreads(blocked); \
821 PCLASS::CBNAME(a,b); \
824 //---------------------------------------------------------------------------
826 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
827 wxSize CBNAME() const
830 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
831 wxSize CLASS::CBNAME() const { \
832 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
833 bool found; wxSize rval(0,0); \
834 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
835 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
837 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
839 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
840 PyObject* o1 = PySequence_GetItem(ro, 0); \
841 PyObject* o2 = PySequence_GetItem(ro, 1); \
842 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
843 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
846 PyErr_SetString(PyExc_TypeError, errmsg); \
851 PyErr_SetString(PyExc_TypeError, errmsg); \
856 wxPyEndBlockThreads(blocked); \
858 return PCLASS::CBNAME(); \
863 //---------------------------------------------------------------------------
865 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
869 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
870 bool CLASS::CBNAME(bool a) { \
871 bool rval=false, found; \
872 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
873 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
874 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
875 wxPyEndBlockThreads(blocked); \
877 rval = PCLASS::CBNAME(a); \
881 //---------------------------------------------------------------------------
883 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
887 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
888 bool CLASS::CBNAME(int a) { \
889 bool rval=false, found; \
890 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
891 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
892 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
893 wxPyEndBlockThreads(blocked); \
895 rval = PCLASS::CBNAME(a); \
899 //---------------------------------------------------------------------------
901 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
905 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
906 bool CLASS::CBNAME(int a) { \
908 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
909 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
910 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
912 wxPyEndBlockThreads(blocked); \
917 //---------------------------------------------------------------------------
919 #define DEC_PYCALLBACK_INT_WIN(CBNAME) \
920 int CBNAME(wxWindow* a)
923 #define IMP_PYCALLBACK_INT_WIN(CLASS, PCLASS, CBNAME) \
924 int CLASS::CBNAME(wxWindow* a) { \
927 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
928 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
929 PyObject* obj = wxPyMake_wxObject(a, false); \
930 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)",obj)); \
933 wxPyEndBlockThreads(blocked); \
935 rval = PCLASS::CBNAME(a); \
940 //---------------------------------------------------------------------------
942 #define DEC_PYCALLBACK__DC(CBNAME) \
946 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
947 void CLASS::CBNAME(wxDC& a) { \
949 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
950 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
951 PyObject* obj = wxPyMake_wxObject(&a,false); \
952 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
955 wxPyEndBlockThreads(blocked); \
961 //---------------------------------------------------------------------------
963 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
964 void CBNAME(wxDC& a, bool b)
967 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
968 void CLASS::CBNAME(wxDC& a, bool b) { \
970 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
971 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
972 PyObject* obj = wxPyMake_wxObject(&a,false); \
973 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
976 wxPyEndBlockThreads(blocked); \
978 PCLASS::CBNAME(a, b); \
981 //---------------------------------------------------------------------------
983 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
984 void CBNAME(wxDC& a, bool b)
987 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
988 void CLASS::CBNAME(wxDC& a, bool b) { \
990 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
991 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
992 PyObject* obj = wxPyMake_wxObject(&a,false); \
993 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
996 wxPyEndBlockThreads(blocked); \
998 PCLASS::CBNAME(a, b); \
1001 //---------------------------------------------------------------------------
1003 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1004 void CBNAME(double a, double b)
1007 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1008 void CLASS::CBNAME(double a, double b) { \
1010 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1011 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1012 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1013 wxPyEndBlockThreads(blocked); \
1015 PCLASS::CBNAME(a, b); \
1018 //---------------------------------------------------------------------------
1020 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1021 void CBNAME(double a, double b, int c, int d)
1024 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1025 void CLASS::CBNAME(double a, double b, int c, int d) { \
1027 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1028 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1029 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1031 wxPyEndBlockThreads(blocked); \
1033 PCLASS::CBNAME(a, b, c, d); \
1036 //---------------------------------------------------------------------------
1038 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1039 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1042 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1043 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1045 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1046 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1047 PyObject* obj = wxPyMake_wxObject(&a,false); \
1048 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1051 wxPyEndBlockThreads(blocked); \
1053 PCLASS::CBNAME(a, b, c, d, e, f); \
1056 //---------------------------------------------------------------------------
1058 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1059 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1062 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1063 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1065 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1067 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1068 PyObject* obj = wxPyMake_wxObject(&a,false); \
1069 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1072 wxPyEndBlockThreads(blocked); \
1074 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1078 //---------------------------------------------------------------------------
1080 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1081 void CBNAME(bool a, double b, double c, int d, int e)
1084 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1085 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1087 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1088 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1089 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1091 wxPyEndBlockThreads(blocked); \
1093 PCLASS::CBNAME(a, b, c, d, e); \
1096 //---------------------------------------------------------------------------
1098 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1099 void CBNAME(wxDC& a, double b, double c, double d, double e)
1102 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1103 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1105 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1106 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1107 PyObject* obj = wxPyMake_wxObject(&a,false); \
1108 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1111 wxPyEndBlockThreads(blocked); \
1113 PCLASS::CBNAME(a, b, c, d, e); \
1116 //---------------------------------------------------------------------------
1118 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1119 void CBNAME(wxDC& a, bool b)
1122 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1123 void CLASS::CBNAME(wxDC& a, bool b) { \
1125 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1126 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1127 PyObject* obj = wxPyMake_wxObject(&a,false); \
1128 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1131 wxPyEndBlockThreads(blocked); \
1133 PCLASS::CBNAME(a, b); \
1136 //---------------------------------------------------------------------------
1138 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1139 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1142 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1143 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1146 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1147 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1148 PyObject* obj = wxPyMake_wxObject(a,false); \
1149 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1152 wxPyEndBlockThreads(blocked); \
1154 PCLASS::CBNAME(a, b, c, d, e, f); \
1157 //---------------------------------------------------------------------------
1159 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1160 void CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1163 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1164 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1166 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1167 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1168 PyObject* obj = wxPyMake_wxObject(a,false); \
1169 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1172 wxPyEndBlockThreads(blocked); \
1174 PCLASS::CBNAME(a, b, c, d, e); \
1177 //---------------------------------------------------------------------------
1179 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1180 void CBNAME(double a, double b, int c)
1183 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1184 void CLASS::CBNAME(double a, double b, int c) { \
1186 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1187 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1188 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1189 wxPyEndBlockThreads(blocked); \
1191 PCLASS::CBNAME(a, b, c); \
1194 //---------------------------------------------------------------------------
1196 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1197 void CBNAME(bool a, double b, double c, int d)
1200 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1201 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1203 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1204 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1205 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1206 wxPyEndBlockThreads(blocked); \
1208 PCLASS::CBNAME(a, b, c, d); \
1211 //---------------------------------------------------------------------------
1212 //---------------------------------------------------------------------------
1214 #define DEC_PYCALLBACK__STRING(CBNAME) \
1215 void CBNAME(const wxString& a)
1217 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1218 void CLASS::CBNAME(const wxString& a) { \
1220 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1221 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1222 PyObject* s = wx2PyString(a); \
1223 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1226 wxPyEndBlockThreads(blocked); \
1228 PCLASS::CBNAME(a); \
1231 //---------------------------------------------------------------------------
1233 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1234 bool CBNAME(const wxString& a)
1236 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1237 bool CLASS::CBNAME(const wxString& a) { \
1240 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1241 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1242 PyObject* s = wx2PyString(a); \
1243 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1246 wxPyEndBlockThreads(blocked); \
1248 rval = PCLASS::CBNAME(a); \
1252 //---------------------------------------------------------------------------
1254 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1255 bool CBNAME(const wxString& a)
1257 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1258 bool CLASS::CBNAME(const wxString& a) { \
1260 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1261 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1262 PyObject* s = wx2PyString(a); \
1263 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1266 wxPyEndBlockThreads(blocked); \
1270 //---------------------------------------------------------------------------
1272 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1273 wxString CBNAME(const wxString& a)
1275 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1276 wxString CLASS::CBNAME(const wxString& a) { \
1278 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1279 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1281 PyObject* s = wx2PyString(a); \
1282 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1285 rval = Py2wxString(ro); \
1289 wxPyEndBlockThreads(blocked); \
1293 //---------------------------------------------------------------------------
1295 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1296 wxString CBNAME(const wxString& a)
1298 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1299 wxString CLASS::CBNAME(const wxString& a) { \
1302 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1303 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1305 PyObject* s = wx2PyString(a); \
1306 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1309 rval = Py2wxString(ro); \
1313 wxPyEndBlockThreads(blocked); \
1315 rval = PCLASS::CBNAME(a); \
1319 //---------------------------------------------------------------------------
1321 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1322 wxString CBNAME(const wxString& a,int b)
1324 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1325 wxString CLASS::CBNAME(const wxString& a,int b) { \
1327 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1328 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1330 PyObject* s = wx2PyString(a); \
1331 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1334 rval = Py2wxString(ro); \
1338 wxPyEndBlockThreads(blocked); \
1342 //---------------------------------------------------------------------------
1344 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1345 bool CBNAME(const wxString& a, const wxString& b)
1347 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1348 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1351 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1352 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1353 PyObject* s1 = wx2PyString(a); \
1354 PyObject* s2 = wx2PyString(b); \
1355 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1359 wxPyEndBlockThreads(blocked); \
1361 rval = PCLASS::CBNAME(a, b); \
1365 //---------------------------------------------------------------------------
1367 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1370 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1371 wxString CLASS::CBNAME() { \
1374 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1375 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1377 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1379 rval = Py2wxString(ro); \
1383 wxPyEndBlockThreads(blocked); \
1385 rval = PCLASS::CBNAME(); \
1389 //---------------------------------------------------------------------------
1391 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1392 wxString CBNAME() const
1394 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1395 wxString CLASS::CBNAME() const { \
1398 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1399 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1401 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1403 rval = Py2wxString(ro); \
1407 wxPyEndBlockThreads(blocked); \
1409 rval = PCLASS::CBNAME(); \
1413 //---------------------------------------------------------------------------
1415 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1418 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1419 wxString CLASS::CBNAME() { \
1421 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1422 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1424 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1426 rval = Py2wxString(ro); \
1430 wxPyEndBlockThreads(blocked); \
1434 //---------------------------------------------------------------------------
1436 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1437 wxString CBNAME() const;
1439 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1440 wxString CLASS::CBNAME() const { \
1442 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1443 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1445 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1447 rval = Py2wxString(ro); \
1451 wxPyEndBlockThreads(blocked); \
1455 //---------------------------------------------------------------------------
1457 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1458 bool CBNAME(const wxHtmlTag& a)
1461 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1462 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1464 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1465 if (wxPyCBH_findCallback2(m_myInst, #CBNAME, false)) { \
1466 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1467 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1470 wxPyEndBlockThreads(blocked); \
1474 //---------------------------------------------------------------------------
1476 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1477 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1479 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1480 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1482 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1483 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1484 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1485 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1488 wxPyEndBlockThreads(blocked); \
1490 PCLASS::CBNAME(cell, x, y); \
1493 //---------------------------------------------------------------------------
1495 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1496 void CBNAME(const wxColour& c);
1498 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1499 void CLASS::CBNAME(const wxColour& c) { \
1501 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1502 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1503 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1504 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1507 wxPyEndBlockThreads(blocked); \
1509 PCLASS::CBNAME(c); \
1512 //---------------------------------------------------------------------------
1513 #define DEC_PYCALLBACK__INTCOLOUR(CBNAME) \
1514 void CBNAME(int a, const wxColour& c);
1516 #define IMP_PYCALLBACK__INTCOLOUR(CLASS, PCLASS, CBNAME) \
1517 void CLASS::CBNAME(int a, const wxColour& c) { \
1519 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1520 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1521 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1522 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1525 wxPyEndBlockThreads(blocked); \
1527 PCLASS::CBNAME(a, c); \
1530 //---------------------------------------------------------------------------
1532 #define DEC_PYCALLBACK__INTFONT(CBNAME) \
1533 void CBNAME(int a, const wxFont& c);
1535 #define IMP_PYCALLBACK__INTFONT(CLASS, PCLASS, CBNAME) \
1536 void CLASS::CBNAME(int a, const wxFont& c) { \
1538 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1539 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1540 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxFont"), 0); \
1541 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1544 wxPyEndBlockThreads(blocked); \
1546 PCLASS::CBNAME(a, c); \
1549 //---------------------------------------------------------------------------
1551 #define DEC_PYCALLBACK__FONT(CBNAME) \
1552 void CBNAME(const wxFont& a);
1554 #define IMP_PYCALLBACK__FONT(CLASS, PCLASS, CBNAME) \
1555 void CLASS::CBNAME(const wxFont& a) { \
1557 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1558 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1559 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxFont"), 0); \
1560 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); \
1563 wxPyEndBlockThreads(blocked); \
1565 PCLASS::CBNAME(a); \
1568 //---------------------------------------------------------------------------
1570 #define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
1571 bool CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1573 #define IMP_PYCALLBACK_BOOL_CELLINTINTME(CLASS, PCLASS, CBNAME) \
1574 bool CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1575 bool rval=false, found; \
1576 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1577 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1578 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1579 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1580 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1584 wxPyEndBlockThreads(blocked); \
1586 rval = PCLASS::CBNAME(cell, x, y, e); \
1591 //---------------------------------------------------------------------------
1593 #define DEC_PYCALLBACK___pure(CBNAME) \
1597 #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1598 void CLASS::CBNAME() { \
1599 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1600 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1601 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1602 wxPyEndBlockThreads(blocked); \
1605 //---------------------------------------------------------------------------
1607 #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1611 #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1612 wxSize CLASS::CBNAME() { \
1613 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
1615 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1616 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1619 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1621 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxSize"))) \
1623 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1625 PyObject* o1 = PySequence_GetItem(ro, 0); \
1626 PyObject* o2 = PySequence_GetItem(ro, 1); \
1627 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1628 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1630 PyErr_SetString(PyExc_TypeError, errmsg); \
1635 PyErr_SetString(PyExc_TypeError, errmsg); \
1640 wxPyEndBlockThreads(blocked); \
1644 //---------------------------------------------------------------------------
1646 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1647 bool CBNAME(wxWindow* a)
1650 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1651 bool CLASS::CBNAME(wxWindow* a) { \
1654 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1655 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1656 PyObject* obj = wxPyMake_wxObject(a,false); \
1657 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1660 wxPyEndBlockThreads(blocked); \
1662 rval = PCLASS::CBNAME(a); \
1668 #define DEC_PYCALLBACK_BOOL_WXWIN_pure(CBNAME) \
1669 bool CBNAME(wxWindow* a)
1671 #define IMP_PYCALLBACK_BOOL_WXWIN_pure(CLASS, PCLASS, CBNAME) \
1672 bool CLASS::CBNAME(wxWindow* a) { \
1675 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1676 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1677 PyObject* obj = wxPyMake_wxObject(a,false); \
1678 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1681 wxPyEndBlockThreads(blocked); \
1685 //---------------------------------------------------------------------------
1687 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1688 bool CBNAME(wxWindow* a, wxDC& b)
1691 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1692 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1695 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1696 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1697 PyObject* win = wxPyMake_wxObject(a,false); \
1698 PyObject* dc = wxPyMake_wxObject(&b,false); \
1699 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1703 wxPyEndBlockThreads(blocked); \
1705 rval = PCLASS::CBNAME(a, b); \
1709 //---------------------------------------------------------------------------
1711 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1712 void CBNAME(wxWindowBase* a)
1715 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1716 void CLASS::CBNAME(wxWindowBase* a) { \
1718 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1719 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1720 PyObject* obj = wxPyMake_wxObject(a,false); \
1721 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1724 wxPyEndBlockThreads(blocked); \
1726 PCLASS::CBNAME(a); \
1729 //---------------------------------------------------------------------------
1731 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1735 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1736 bool CLASS::CBNAME() { \
1739 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1740 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1741 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1742 wxPyEndBlockThreads(blocked); \
1744 rval = PCLASS::CBNAME(); \
1748 //---------------------------------------------------------------------------
1750 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1754 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1755 bool CLASS::CBNAME() const { \
1758 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1759 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1760 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1761 wxPyEndBlockThreads(blocked); \
1763 rval = PCLASS::CBNAME(); \
1767 //---------------------------------------------------------------------------
1769 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1770 wxDragResult 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 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1778 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1779 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1780 wxPyEndBlockThreads(blocked); \
1782 rval = PCLASS::CBNAME(a, b, c); \
1783 return (wxDragResult)rval; \
1786 //---------------------------------------------------------------------------
1788 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1789 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1791 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1792 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1793 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1795 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1797 PyObject* obj = wxPyMake_wxObject(&a,false); \
1798 PyObject* s = wx2PyString(b); \
1799 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1802 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1803 /* release ownership of the C++ wx.FSFile object. */ \
1804 PyObject_SetAttrString(ro, "thisown", Py_False); \
1810 wxPyEndBlockThreads(blocked); \
1814 //---------------------------------------------------------------------------
1816 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1817 bool CBNAME(wxDragResult a)
1820 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1821 bool CLASS::CBNAME(wxDragResult a) { \
1824 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1825 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1826 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1827 wxPyEndBlockThreads(blocked); \
1829 rval = PCLASS::CBNAME(a); \
1833 //---------------------------------------------------------------------------
1835 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1836 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1839 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1840 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1841 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1843 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1844 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1845 wxPyEndBlockThreads(blocked); \
1846 return (wxDragResult)rval; \
1849 //---------------------------------------------------------------------------
1851 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1852 bool CBNAME(int a, int b, const wxString& c)
1854 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1855 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1857 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1858 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1859 PyObject* s = wx2PyString(c); \
1860 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1863 wxPyEndBlockThreads(blocked); \
1867 //---------------------------------------------------------------------------
1869 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1873 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1874 size_t CLASS::CBNAME() { \
1877 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1878 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1879 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1880 wxPyEndBlockThreads(blocked); \
1882 rval = PCLASS::CBNAME(); \
1886 //---------------------------------------------------------------------------
1888 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1889 size_t CBNAME() const
1892 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1893 size_t CLASS::CBNAME() const { \
1896 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1897 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1898 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1899 wxPyEndBlockThreads(blocked); \
1901 rval = PCLASS::CBNAME(); \
1905 //---------------------------------------------------------------------------
1907 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1908 wxDataFormat CBNAME(size_t a)
1911 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1912 wxDataFormat CLASS::CBNAME(size_t a) { \
1913 wxDataFormat rval=0; \
1915 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1916 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1918 wxDataFormat* ptr; \
1919 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1921 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1926 wxPyEndBlockThreads(blocked); \
1928 rval = PCLASS::CBNAME(a); \
1932 //---------------------------------------------------------------------------
1934 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1935 void CBNAME(const Type& a)
1938 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1939 void CLASS::CBNAME(const Type& a) { \
1941 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1942 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1943 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1944 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1947 wxPyEndBlockThreads(blocked); \
1949 PCLASS::CBNAME(a); \
1953 //---------------------------------------------------------------------------
1955 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1956 void CBNAME(Type& a)
1959 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1960 void CLASS::CBNAME(Type& a) { \
1962 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1963 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1964 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1965 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1968 wxPyEndBlockThreads(blocked); \
1970 PCLASS::CBNAME(a); \
1973 //---------------------------------------------------------------------------
1975 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1976 bool CBNAME(Type& a)
1979 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1980 bool CLASS::CBNAME(Type& a) { \
1983 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1984 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1985 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1986 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1989 wxPyEndBlockThreads(blocked); \
1991 rv = PCLASS::CBNAME(a); \
1995 //---------------------------------------------------------------------------
1997 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1998 bool CBNAME(Type& a)
2001 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2002 bool CLASS::CBNAME(Type& a) { \
2004 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2005 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2006 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2007 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2010 wxPyEndBlockThreads(blocked); \
2014 //---------------------------------------------------------------------------
2016 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2017 wxString CBNAME(long a, long b) const
2019 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2020 wxString CLASS::CBNAME(long a, long b) const { \
2023 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2024 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2026 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2028 rval = Py2wxString(ro); \
2032 wxPyEndBlockThreads(blocked); \
2034 rval = PCLASS::CBNAME(a,b); \
2038 //---------------------------------------------------------------------------
2040 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2041 int CBNAME(long a) const
2044 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2045 int CLASS::CBNAME(long a) const { \
2048 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2049 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2051 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2053 rval = PyInt_AsLong(ro); \
2057 wxPyEndBlockThreads(blocked); \
2059 rval = PCLASS::CBNAME(a); \
2064 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2065 int CBNAME(long a) const;
2068 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2069 int CLASS::CBNAME(long a) const { \
2070 int rval=-1; /* this rval is important for OnGetItemImage */ \
2072 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2073 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2075 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2077 rval = PyInt_AsLong(ro); \
2081 wxPyEndBlockThreads(blocked); \
2086 //---------------------------------------------------------------------------
2088 #define DEC_PYCALLBACK_INT_INT(CBNAME) \
2092 #define IMP_PYCALLBACK_INT_INT(CLASS, PCLASS, CBNAME) \
2093 int CLASS::CBNAME(int a) { \
2096 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2097 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2099 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
2101 rval = PyInt_AsLong(ro); \
2105 wxPyEndBlockThreads(blocked); \
2107 rval = PCLASS::CBNAME(a); \
2111 //---------------------------------------------------------------------------
2113 #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
2114 int CBNAME(long a, long b) const
2117 #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \
2118 int CLASS::CBNAME(long a, long b) const { \
2121 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2122 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2124 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2126 rval = PyInt_AsLong(ro); \
2130 wxPyEndBlockThreads(blocked); \
2132 rval = PCLASS::CBNAME(a, b); \
2137 #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \
2138 int CBNAME(long a, long b) const;
2141 #define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME) \
2142 int CLASS::CBNAME(long a, long b) const { \
2143 int rval=-1; /* this rval is important for OnGetItemImage */ \
2145 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2146 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2148 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2150 rval = PyInt_AsLong(ro); \
2154 wxPyEndBlockThreads(blocked); \
2159 //---------------------------------------------------------------------------
2161 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2162 wxListItemAttr* CBNAME(long a) const
2165 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2166 wxListItemAttr *CLASS::CBNAME(long a) const { \
2167 wxListItemAttr *rval = NULL; \
2169 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2170 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2172 wxListItemAttr* ptr; \
2173 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2175 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2180 wxPyEndBlockThreads(blocked); \
2182 rval = PCLASS::CBNAME(a); \
2186 //---------------------------------------------------------------------------
2188 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2189 bool CBNAME(wxMouseEvent& e)
2191 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2192 bool CLASS::CBNAME(wxMouseEvent& e) { \
2195 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2196 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2198 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2199 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2201 rval = PyInt_AsLong(ro); \
2206 wxPyEndBlockThreads(blocked); \
2208 return PCLASS::CBNAME(e); \
2212 //---------------------------------------------------------------------------
2214 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2215 wxWizardPage* CBNAME() const
2217 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2218 wxWizardPage* CLASS::CBNAME() const { \
2219 wxWizardPage* rv = NULL; \
2220 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2221 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2223 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2225 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2229 wxPyEndBlockThreads(blocked); \
2233 //---------------------------------------------------------------------------
2235 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2236 wxBitmap CBNAME() const
2238 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2239 wxBitmap CLASS::CBNAME() const { \
2241 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2242 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2245 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2247 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2252 wxPyEndBlockThreads(blocked); \
2256 //---------------------------------------------------------------------------
2258 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2261 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2262 wxObject* CLASS::CBNAME() { \
2263 wxObject* rv = NULL; \
2264 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2265 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2267 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2269 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2273 wxPyEndBlockThreads(blocked); \
2277 //---------------------------------------------------------------------------
2279 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2280 wxObject* CBNAME(const wxString& a)
2282 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2283 wxObject* CLASS::CBNAME(const wxString& a) { \
2284 wxObject* rv = NULL; \
2285 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2286 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2287 PyObject* so = wx2PyString(a); \
2289 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2291 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2296 wxPyEndBlockThreads(blocked); \
2300 //---------------------------------------------------------------------------
2302 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2303 bool CBNAME(wxXmlNode* a)
2306 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2307 bool CLASS::CBNAME(wxXmlNode* a) { \
2309 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2310 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2311 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2312 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2315 wxPyEndBlockThreads(blocked); \
2319 //---------------------------------------------------------------------------
2321 #define DEC_PYCALLBACK_COORD_SIZET_const(CBNAME) \
2322 wxCoord CBNAME(size_t a) const
2324 #define IMP_PYCALLBACK_COORD_SIZET_const(CLASS, PCLASS, CBNAME) \
2325 wxCoord CLASS::CBNAME(size_t a) const { \
2328 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2329 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2330 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2332 wxPyEndBlockThreads(blocked); \
2334 rval = PCLASS::CBNAME(a); \
2339 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2340 wxCoord CBNAME(size_t a) const
2342 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2343 wxCoord CLASS::CBNAME(size_t a) const { \
2346 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2347 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2348 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2350 wxPyEndBlockThreads(blocked); \
2354 //---------------------------------------------------------------------------
2356 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2357 void CBNAME(size_t a, size_t b) const
2360 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2361 void CLASS::CBNAME(size_t a, size_t b) const { \
2363 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2364 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2365 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2366 wxPyEndBlockThreads(blocked); \
2368 PCLASS::CBNAME(a,b); \
2370 //---------------------------------------------------------------------------
2372 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2373 wxCoord CBNAME() const
2376 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2377 wxCoord CLASS::CBNAME() const { \
2380 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2381 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2382 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2383 wxPyEndBlockThreads(blocked); \
2385 rval = PCLASS::CBNAME(); \
2389 //---------------------------------------------------------------------------
2391 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2392 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2394 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2395 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2397 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2398 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2399 PyObject* obj = wxPyMake_wxObject(&a,false); \
2400 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2401 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2402 Py_DECREF(obj); Py_DECREF(ro); \
2404 wxPyEndBlockThreads(blocked); \
2409 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2410 void CBNAME(wxDC& a, const wxRect& b, size_t c) const
2412 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2413 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2415 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2416 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2417 PyObject* obj = wxPyMake_wxObject(&a,false); \
2418 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2419 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2420 Py_DECREF(obj); Py_DECREF(ro); \
2422 wxPyEndBlockThreads(blocked); \
2424 PCLASS::CBNAME(a,b,c); \
2428 //---------------------------------------------------------------------------
2429 // Same as the above set, but the wxRect is not const
2431 #define DEC_PYCALLBACK__DCRECTSIZET2_constpure(CBNAME) \
2432 void CBNAME(wxDC& a, wxRect& b, size_t c) const;
2434 #define IMP_PYCALLBACK__DCRECTSIZET2_constpure(CLASS, PCLASS, CBNAME) \
2435 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2437 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2438 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2439 PyObject* obj = wxPyMake_wxObject(&a,false); \
2440 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2441 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2442 Py_DECREF(obj); Py_DECREF(ro); \
2444 wxPyEndBlockThreads(blocked); \
2449 #define DEC_PYCALLBACK__DCRECTSIZET2_const(CBNAME) \
2450 void CBNAME(wxDC& a, wxRect& b, size_t c) const
2452 #define IMP_PYCALLBACK__DCRECTSIZET2_const(CLASS, PCLASS, CBNAME) \
2453 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2455 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2456 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2457 PyObject* obj = wxPyMake_wxObject(&a,false); \
2458 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2459 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2460 Py_DECREF(obj); Py_DECREF(ro); \
2462 wxPyEndBlockThreads(blocked); \
2464 PCLASS::CBNAME(a,b,c); \
2467 //---------------------------------------------------------------------------
2469 #define DEC_PYCALLBACK__DCRECTINTINT_const(CBNAME) \
2470 void CBNAME(wxDC& a, const wxRect& b, int c, int d) const
2472 #define IMP_PYCALLBACK__DCRECTINTINT_const(CLASS, PCLASS, CBNAME) \
2473 void CLASS::CBNAME(wxDC& a, const wxRect& b, int c, int d) const { \
2475 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2476 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2477 PyObject* obj = wxPyMake_wxObject(&a,false); \
2478 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2479 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOii)", obj, ro, c, d)); \
2480 Py_DECREF(obj); Py_DECREF(ro); \
2482 wxPyEndBlockThreads(blocked); \
2484 PCLASS::CBNAME(a,b,c,d); \
2488 //---------------------------------------------------------------------------
2490 #define DEC_PYCALLBACK__RECTINT(CBNAME) \
2491 void CBNAME(const wxRect& a, int b)
2493 #define IMP_PYCALLBACK__RECTINT(CLASS, PCLASS, CBNAME) \
2494 void CLASS::CBNAME(const wxRect& a, int b) { \
2496 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2497 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2498 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2499 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b)); \
2502 wxPyEndBlockThreads(blocked); \
2504 PCLASS::CBNAME(a,b); \
2508 #define DEC_PYCALLBACK_BOOL_RECTINT(CBNAME) \
2509 bool CBNAME(const wxRect& a, int b)
2511 #define IMP_PYCALLBACK_BOOL_RECTINT(CLASS, PCLASS, CBNAME) \
2512 bool CLASS::CBNAME(const wxRect& a, int b) { \
2514 bool rval = false; \
2515 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2516 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2517 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2518 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b));\
2521 wxPyEndBlockThreads(blocked); \
2523 rval = PCLASS::CBNAME(a,b); \
2528 //---------------------------------------------------------------------------
2530 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2531 wxString CBNAME(size_t a) const
2533 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2534 wxString CLASS::CBNAME(size_t a) const { \
2537 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2538 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2540 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2542 rval = Py2wxString(ro); \
2546 wxPyEndBlockThreads(blocked); \
2548 rval = PCLASS::CBNAME(a); \
2552 //---------------------------------------------------------------------------
2554 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2555 wxString CBNAME(size_t a) const
2557 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2558 wxString CLASS::CBNAME(size_t a) const { \
2561 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2562 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2564 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2566 rval = Py2wxString(ro); \
2570 wxPyEndBlockThreads(blocked); \
2574 //---------------------------------------------------------------------------
2576 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2577 wxVisualAttributes CBNAME() const
2580 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2581 wxVisualAttributes CLASS::CBNAME() const { \
2582 wxVisualAttributes rval; \
2584 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2585 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2587 wxVisualAttributes* ptr; \
2588 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2590 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2595 wxPyEndBlockThreads(blocked); \
2597 rval = PCLASS::CBNAME(); \
2601 //---------------------------------------------------------------------------
2603 #define DEC_PYCALLBACK_FONT_INT(CBNAME) \
2604 wxFont CBNAME(int a)
2606 #define IMP_PYCALLBACK_FONT_INT(CLASS, PCLASS, CBNAME) \
2607 wxFont CLASS::CBNAME(int a) { \
2610 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2611 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2614 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2616 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxFont"))) \
2621 wxPyEndBlockThreads(blocked); \
2623 rv = PCLASS::CBNAME(a); \
2627 //---------------------------------------------------------------------------
2629 #define DEC_PYCALLBACK_COLOUR_INT(CBNAME) \
2630 wxColour CBNAME(int a)
2632 #define IMP_PYCALLBACK_COLOUR_INT(CLASS, PCLASS, CBNAME) \
2633 wxColour CLASS::CBNAME(int a) { \
2636 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2637 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2640 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2642 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxColour"))) \
2647 wxPyEndBlockThreads(blocked); \
2649 rv = PCLASS::CBNAME(a); \
2653 //---------------------------------------------------------------------------