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>
85 # pragma warning(disable:4800)
86 # pragma warning(disable:4190)
89 #ifdef __WXMAC__ // avoid a bug in Carbon headers
93 //---------------------------------------------------------------------------
95 #ifndef wxHAS_POWER_EVENTS
96 class wxPowerEvent
: public wxEvent
99 wxPowerEvent(wxEventType evtType
) : wxEvent(wxID_NONE
, evtType
) {}
101 bool IsVetoed() const { return false; }
102 virtual wxEvent
*Clone() const { return new wxPowerEvent(*this); }
106 //---------------------------------------------------------------------------
107 typedef unsigned char byte
;
108 typedef unsigned char* buffer
;
110 typedef wxPoint2DDouble wxPoint2D
;
111 typedef wxRect2DDouble wxRect2D
;
113 #ifndef SWIG_TYPE_TABLE
114 #define SWIG_TYPE_TABLE wxPython_type_table
118 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP|wxFULL_REPAINT_ON_RESIZE
120 #define wxDEFAULT_STATUSBAR_STYLE wxST_SIZEGRIP
124 #ifndef wxPyUSE_EXPORTED_API
126 void __wxPyPreStart(PyObject
*);
127 void __wxPyCleanup();
128 PyObject
* __wxPySetDictionary(PyObject
*, PyObject
* args
);
130 void wxSetDefaultPyEncoding(const char* encoding
);
131 const char* wxGetDefaultPyEncoding();
134 void wxPyEventThunker(wxObject
*, wxEvent
& event
);
137 bool wxPyCheckSwigType(const wxChar
* className
);
138 PyObject
* wxPyConstructObject(void* ptr
,
139 const wxChar
* className
,
141 bool wxPyConvertSwigPtr(PyObject
* obj
, void **ptr
,
142 const wxChar
* className
);
143 PyObject
* wxPyMakeSwigPtr(void* ptr
, const wxChar
* classname
);
146 PyObject
* wx2PyString(const wxString
& src
);
147 wxString
Py2wxString(PyObject
* source
);
149 PyObject
* wxPyMake_wxObject(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
=true);
150 PyObject
* wxPyMake_wxSizer(wxSizer
* source
, bool setThisOwn
);
151 void wxPyPtrTypeMap_Add(const char* commonName
, const char* ptrName
);
153 PyObject
* wxPy_ConvertList(wxListBase
* list
);
154 long wxPyGetWinHandle(wxWindow
* win
);
156 void wxPy_ReinitStockObjects(int pass
);
158 bool wxPyInstance_Check(PyObject
* obj
);
159 bool wxPySwigInstance_Check(PyObject
* obj
);
162 #endif // wxPyUSE_EXPORTED_API
163 //---------------------------------------------------------------------------
165 // if we want to handle threads and Python threads are available...
166 #if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
167 #define WXP_WITH_THREAD
168 #else // no Python threads...
169 #undef WXP_WITH_THREAD
173 // In Python 2.3 and later there are the PyGILState_* APIs that we can use for
174 // blocking threads when calling back into Python. Using them instead of my
175 // home-grown hacks greatly simplifies wxPyBeginBlockThreads and
176 // wxPyEndBlockThreads.
178 // Unfortunatly there is a bug somewhere when using these new APIs on Python
179 // 2.3. It manifests in Boa Constructor's debugger where it is unable to stop
180 // at breakpoints located in event handlers. I think that the cause may be
181 // something like the original PyThreadState for the main thread is not being
182 // restored for the callbacks, but I can't see where that could be
183 // happening... So we'll only activate this new change for Python 2.4+ :-(
185 #if PY_VERSION_HEX < 0x02040000
186 #define wxPyUSE_GIL_STATE 0
187 typedef bool wxPyBlock_t
;
188 #define wxPyBlock_t_default false
190 #define wxPyUSE_GIL_STATE 1
191 typedef PyGILState_STATE wxPyBlock_t
;
192 #define wxPyBlock_t_default PyGILState_UNLOCKED
196 // Python 2.5 changes the type of some API parameter and return types. Using
197 // this typedef for versions < 2.5 will help with the transition...
198 #if PY_VERSION_HEX < 0x02050000
199 typedef int Py_ssize_t
;
203 #ifndef wxPyUSE_EXPORTED_API
205 // For Python --> C++
206 PyThreadState
* wxPyBeginAllowThreads();
207 void wxPyEndAllowThreads(PyThreadState
* state
);
209 // For C++ --> Python
210 wxPyBlock_t
wxPyBeginBlockThreads();
211 void wxPyEndBlockThreads(wxPyBlock_t blocked
);
213 #endif // wxPyUSE_EXPORTED_API
216 // A macro that will help to execute simple statments wrapped in
217 // StartBlock/EndBlockThreads calls
218 #define wxPyBLOCK_THREADS(stmt) \
219 { wxPyBlock_t blocked = wxPyBeginBlockThreads(); stmt; wxPyEndBlockThreads(blocked); }
221 // Raise the NotImplementedError exception (blocking threads)
222 #define wxPyRaiseNotImplemented() \
223 wxPyBLOCK_THREADS(PyErr_SetNone(PyExc_NotImplementedError))
225 // Raise any exception with a string value (blocking threads)
226 #define wxPyErr_SetString(err, str) \
227 wxPyBLOCK_THREADS(PyErr_SetString(err, str))
230 //---------------------------------------------------------------------------
231 // These are helpers used by the typemaps
233 #ifndef wxPyUSE_EXPORTED_API
235 wxString
* wxString_in_helper(PyObject
* source
);
237 byte
* byte_LIST_helper(PyObject
* source
);
238 int* int_LIST_helper(PyObject
* source
);
239 long* long_LIST_helper(PyObject
* source
);
240 char** string_LIST_helper(PyObject
* source
);
241 wxPoint
* wxPoint_LIST_helper(PyObject
* source
, int* npoints
);
242 wxPoint2D
* wxPoint2D_LIST_helper(PyObject
* source
, size_t* npoints
);
243 wxBitmap
** wxBitmap_LIST_helper(PyObject
* source
);
244 wxString
* wxString_LIST_helper(PyObject
* source
);
245 wxAcceleratorEntry
* wxAcceleratorEntry_LIST_helper(PyObject
* source
);
246 wxPen
** wxPen_LIST_helper(PyObject
* source
);
248 bool wxSize_helper(PyObject
* source
, wxSize
** obj
);
249 bool wxPoint_helper(PyObject
* source
, wxPoint
** obj
);
250 bool wxRealPoint_helper(PyObject
* source
, wxRealPoint
** obj
);
251 bool wxRect_helper(PyObject
* source
, wxRect
** obj
);
252 bool wxColour_helper(PyObject
* source
, wxColour
** obj
);
253 bool wxPoint2D_helper(PyObject
* source
, wxPoint2D
** obj
);
254 bool wxRect2D_helper(PyObject
* source
, wxRect2D
** obj
);
257 bool wxPySimple_typecheck(PyObject
* source
, const wxChar
* classname
, int seqLen
);
258 bool wxColour_typecheck(PyObject
* source
);
261 // Other helpful stuff
262 bool wxPyCheckForApp();
263 bool wxPyTestDisplayAvailable();
265 bool wxPy2int_seq_helper(PyObject
* source
, int* i1
, int* i2
);
266 bool wxPy4int_seq_helper(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
268 PyObject
* wxArrayString2PyList_helper(const wxArrayString
& arr
);
269 PyObject
* wxArrayInt2PyList_helper(const wxArrayInt
& arr
);
270 PyObject
* wxArrayDouble2PyList_helper(const wxArrayDouble
& arr
);
272 #endif // wxPyUSE_EXPORTED_API
274 //---------------------------------------------------------------------------
276 #if PYTHON_API_VERSION < 1009
277 #define PySequence_Fast_GET_ITEM(o, i) \
278 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
281 #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
282 #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
283 #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
285 //---------------------------------------------------------------------------
287 #ifndef wxPyUSE_EXPORTED_API
289 class wxPyCallback
: public wxObject
{
290 DECLARE_ABSTRACT_CLASS(wxPyCallback
)
292 wxPyCallback(PyObject
* func
);
293 wxPyCallback(const wxPyCallback
& other
);
296 void EventThunker(wxEvent
& event
);
301 #endif // wxPyUSE_EXPORTED_API
302 //---------------------------------------------------------------------------
303 //---------------------------------------------------------------------------
304 // These Event classes can be derived from in Python and passed through the
305 // event system without loosing anything. They do this by keeping a reference
306 // to themselves and some special case handling in wxPyCallback::EventThunker.
310 class wxPyEvtSelfRef
{
315 void SetSelf(PyObject
* self
, bool clone
=false);
316 PyObject
* GetSelf() const;
317 bool GetCloned() const { return m_cloned
; }
325 class wxPyEvent
: public wxEvent
, public wxPyEvtSelfRef
{
326 DECLARE_ABSTRACT_CLASS(wxPyEvent
)
328 wxPyEvent(int winid
=0, wxEventType commandType
= wxEVT_NULL
);
329 wxPyEvent(const wxPyEvent
& evt
);
332 virtual wxEvent
* Clone() const { return new wxPyEvent(*this); }
336 class wxPyCommandEvent
: public wxCommandEvent
, public wxPyEvtSelfRef
{
337 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent
)
339 wxPyCommandEvent(wxEventType commandType
= wxEVT_NULL
, int id
=0);
340 wxPyCommandEvent(const wxPyCommandEvent
& evt
);
343 virtual wxEvent
* Clone() const { return new wxPyCommandEvent(*this); }
348 //----------------------------------------------------------------------
349 // Forward decalre a few things used in the exported API
350 class wxPyClientData
;
352 class wxPyOORClientData
;
353 class wxPyCBInputStream
;
355 void wxPyClientData_dtor(wxPyClientData
* self
);
356 void wxPyUserData_dtor(wxPyUserData
* self
);
357 void wxPyOORClientData_dtor(wxPyOORClientData
* self
);
358 wxPyCBInputStream
* wxPyCBInputStream_create(PyObject
*py
, bool block
);
359 wxPyCBInputStream
* wxPyCBInputStream_copy(wxPyCBInputStream
* other
);
361 //---------------------------------------------------------------------------
362 // Export a C API in a struct. Other modules will be able to load this from
363 // the wx.core module and will then have safe access to these functions, even if
364 // in another shared library.
366 class wxPyCallbackHelper
;
370 bool (*p_wxPyCheckSwigType
)(const wxChar
* className
);
371 PyObject
* (*p_wxPyConstructObject
)(void* ptr
, const wxChar
* className
, int setThisOwn
);
372 bool (*p_wxPyConvertSwigPtr
)(PyObject
* obj
, void **ptr
, const wxChar
* className
);
373 PyObject
* (*p_wxPyMakeSwigPtr
)(void* ptr
, const wxChar
* className
);
375 PyThreadState
* (*p_wxPyBeginAllowThreads
)();
376 void (*p_wxPyEndAllowThreads
)(PyThreadState
* state
);
377 wxPyBlock_t (*p_wxPyBeginBlockThreads
)();
378 void (*p_wxPyEndBlockThreads
)(wxPyBlock_t blocked
);
380 PyObject
* (*p_wxPy_ConvertList
)(wxListBase
* list
);
382 wxString
* (*p_wxString_in_helper
)(PyObject
* source
);
383 wxString (*p_Py2wxString
)(PyObject
* source
);
384 PyObject
* (*p_wx2PyString
)(const wxString
& src
);
386 byte
* (*p_byte_LIST_helper
)(PyObject
* source
);
387 int* (*p_int_LIST_helper
)(PyObject
* source
);
388 long* (*p_long_LIST_helper
)(PyObject
* source
);
389 char** (*p_string_LIST_helper
)(PyObject
* source
);
390 wxPoint
* (*p_wxPoint_LIST_helper
)(PyObject
* source
, int* npoints
);
391 wxBitmap
** (*p_wxBitmap_LIST_helper
)(PyObject
* source
);
392 wxString
* (*p_wxString_LIST_helper
)(PyObject
* source
);
393 wxAcceleratorEntry
* (*p_wxAcceleratorEntry_LIST_helper
)(PyObject
* source
);
395 bool (*p_wxSize_helper
)(PyObject
* source
, wxSize
** obj
);
396 bool (*p_wxPoint_helper
)(PyObject
* source
, wxPoint
** obj
);
397 bool (*p_wxRealPoint_helper
)(PyObject
* source
, wxRealPoint
** obj
);
398 bool (*p_wxRect_helper
)(PyObject
* source
, wxRect
** obj
);
399 bool (*p_wxColour_helper
)(PyObject
* source
, wxColour
** obj
);
400 bool (*p_wxPoint2D_helper
)(PyObject
* source
, wxPoint2D
** obj
);
403 bool (*p_wxPySimple_typecheck
)(PyObject
* source
, const wxChar
* classname
, int seqLen
);
404 bool (*p_wxColour_typecheck
)(PyObject
* source
);
406 void (*p_wxPyCBH_setCallbackInfo
)(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
407 bool (*p_wxPyCBH_findCallback
)(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
);
408 int (*p_wxPyCBH_callCallback
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
409 PyObject
* (*p_wxPyCBH_callCallbackObj
)(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
410 void (*p_wxPyCBH_delete
)(wxPyCallbackHelper
* cbh
);
412 PyObject
* (*p_wxPyMake_wxObject
)(wxObject
* source
, bool setThisOwn
, bool checkEvtHandler
);
413 PyObject
* (*p_wxPyMake_wxSizer
)(wxSizer
* source
, bool setThisOwn
);
414 void (*p_wxPyPtrTypeMap_Add
)(const char* commonName
, const char* ptrName
);
415 bool (*p_wxPy2int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
);
416 bool (*p_wxPy4int_seq_helper
)(PyObject
* source
, int* i1
, int* i2
, int* i3
, int* i4
);
417 PyObject
* (*p_wxArrayString2PyList_helper
)(const wxArrayString
& arr
);
418 PyObject
* (*p_wxArrayInt2PyList_helper
)(const wxArrayInt
& arr
);
420 void (*p_wxPyClientData_dtor
)(wxPyClientData
*);
421 void (*p_wxPyUserData_dtor
)(wxPyUserData
*);
422 void (*p_wxPyOORClientData_dtor
)(wxPyOORClientData
*);
424 wxPyCBInputStream
* (*p_wxPyCBInputStream_create
)(PyObject
*py
, bool block
);
425 wxPyCBInputStream
* (*p_wxPyCBInputStream_copy
)(wxPyCBInputStream
* other
);
427 bool (*p_wxPyInstance_Check
)(PyObject
* obj
);
428 bool (*p_wxPySwigInstance_Check
)(PyObject
* obj
);
430 bool (*p_wxPyCheckForApp
)();
432 // Add all new items at the end...
433 PyObject
* (*p_wxArrayDoublePyList_helper
)(const wxArrayDouble
& arr
);
434 wxPoint2D
* (*p_wxPoint2D_LIST_helper
)(PyObject
* source
, size_t* npoints
);
435 bool (*p_wxRect2D_helper
)(PyObject
* source
, wxRect2D
** obj
);
440 #ifdef wxPyUSE_EXPORTED_API
441 // Notice that this is static, not extern. This is by design, each module
442 // needs one, but doesn't have to use it.
443 static wxPyCoreAPI
* wxPyCoreAPIPtr
= NULL
;
444 inline wxPyCoreAPI
* wxPyGetCoreAPIPtr();
445 #endif // wxPyUSE_EXPORTED_API
447 //---------------------------------------------------------------------------
449 // A wxObject that holds a reference to a Python object
450 class wxPyUserData
: public wxObject
{
452 wxPyUserData(PyObject
* obj
) {
458 #ifdef wxPyUSE_EXPORTED_API
459 wxPyGetCoreAPIPtr()->p_wxPyUserData_dtor(this);
461 wxPyUserData_dtor(this);
468 // A wxClientData that holds a refernece to a Python object
469 class wxPyClientData
: public wxClientData
{
471 wxPyClientData(PyObject
* obj
, bool incref
=true) {
479 #ifdef wxPyUSE_EXPORTED_API
480 wxPyGetCoreAPIPtr()->p_wxPyClientData_dtor(this);
482 wxPyClientData_dtor(this);
490 // Just like wxPyClientData, except when this object is destroyed it does some
491 // OOR magic on the Python Object.
492 class wxPyOORClientData
: public wxPyClientData
{
494 wxPyOORClientData(PyObject
* obj
, bool incref
=true)
495 : wxPyClientData(obj
, incref
) {}
496 ~wxPyOORClientData() {
498 #ifdef wxPyUSE_EXPORTED_API
499 wxPyGetCoreAPIPtr()->p_wxPyOORClientData_dtor(this);
501 wxPyOORClientData_dtor(this);
507 //---------------------------------------------------------------------------
508 // A wxImageHandler that can be derived from in Python.
511 class wxPyImageHandler
: public wxImageHandler
{
515 // used for interning method names as PyStrings
516 static PyObject
* m_DoCanRead_Name
;
517 static PyObject
* m_GetImageCount_Name
;
518 static PyObject
* m_LoadFile_Name
;
519 static PyObject
* m_SaveFile_Name
;
521 // converstion helpers
522 PyObject
* py_InputStream(wxInputStream
* stream
);
523 PyObject
* py_Image(wxImage
* image
);
524 PyObject
* py_OutputStream(wxOutputStream
* stream
);
529 void _SetSelf(PyObject
*self
);
531 virtual bool LoadFile(wxImage
* image
, wxInputStream
& stream
,
532 bool verbose
=true, int index
=-1 );
533 virtual bool SaveFile(wxImage
* image
, wxOutputStream
& stream
,
535 virtual int GetImageCount(wxInputStream
& stream
);
536 virtual bool DoCanRead(wxInputStream
&stream
);
540 //---------------------------------------------------------------------------
541 // This class holds an instance of a Python Shadow Class object and assists
542 // with looking up and invoking Python callback methods from C++ virtual
543 // method redirections. For all classes which have virtuals which should be
544 // overridable in wxPython, a new subclass is created that contains a
545 // wxPyCallbackHelper.
548 class wxPyCallbackHelper
{
550 wxPyCallbackHelper(const wxPyCallbackHelper
& other
);
552 wxPyCallbackHelper() {
559 ~wxPyCallbackHelper() {
560 #ifdef wxPyUSE_EXPORTED_API
561 wxPyGetCoreAPIPtr()->p_wxPyCBH_delete(this);
563 wxPyCBH_delete(this);
567 void setSelf(PyObject
* self
, PyObject
* klass
, int incref
=true);
568 bool findCallback(const char* name
, bool setGuard
=true) const;
569 int callCallback(PyObject
* argTuple
) const;
570 PyObject
* callCallbackObj(PyObject
* argTuple
) const;
571 PyObject
* GetLastFound() const { return m_lastFound
; }
573 void setRecursionGuard(PyObject
* method
) const;
574 void clearRecursionGuard(PyObject
* method
) const;
579 PyObject
* m_lastFound
;
582 friend void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
586 void wxPyCBH_setCallbackInfo(wxPyCallbackHelper
& cbh
, PyObject
* self
, PyObject
* klass
, int incref
);
587 bool wxPyCBH_findCallback(const wxPyCallbackHelper
& cbh
, const char* name
, bool setGuard
=true);
588 int wxPyCBH_callCallback(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
589 PyObject
* wxPyCBH_callCallbackObj(const wxPyCallbackHelper
& cbh
, PyObject
* argTuple
);
590 void wxPyCBH_delete(wxPyCallbackHelper
* cbh
);
595 //---------------------------------------------------------------------------
597 // This is used in C++ classes that need to be able to make callback to
598 // "overloaded" python methods
601 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
602 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
604 private: wxPyCallbackHelper m_myInst
607 //---------------------------------------------------------------------------
608 // The wxPythonApp class
611 wxPYAPP_ASSERT_SUPPRESS
= 1,
612 wxPYAPP_ASSERT_EXCEPTION
= 2,
613 wxPYAPP_ASSERT_DIALOG
= 4,
614 wxPYAPP_ASSERT_LOG
= 8
617 class wxPyApp
: public wxApp
619 DECLARE_ABSTRACT_CLASS(wxPyApp
)
627 int GetAssertMode() { return m_assertMode
; }
628 void SetAssertMode(int mode
) { m_assertMode
= mode
; }
630 virtual bool OnInitGui();
631 virtual int OnExit();
633 virtual void OnAssertFailure(const wxChar
*file
,
639 virtual void ExitMainLoop();
640 // virtual int FilterEvent(wxEvent& event); // This one too????
642 // For catching Apple Events
643 virtual void MacOpenFile(const wxString
&fileName
);
644 virtual void MacPrintFile(const wxString
&fileName
);
645 virtual void MacNewFile();
646 virtual void MacReopenApp();
648 static bool GetMacSupportPCMenuShortcuts();
649 static long GetMacAboutMenuItemId();
650 static long GetMacPreferencesMenuItemId();
651 static long GetMacExitMenuItemId();
652 static wxString
GetMacHelpMenuTitleName();
654 static void SetMacSupportPCMenuShortcuts(bool val
);
655 static void SetMacAboutMenuItemId(long val
);
656 static void SetMacPreferencesMenuItemId(long val
);
657 static void SetMacExitMenuItemId(long val
);
658 static void SetMacHelpMenuTitleName(const wxString
& val
);
661 void _BootstrapApp();
663 // implementation only
664 void SetStartupComplete(bool val
) { m_startupComplete
= val
; };
668 bool m_startupComplete
;
671 extern wxPyApp
*wxPythonApp
;
674 //----------------------------------------------------------------------
675 // These macros are used to implement the virtual methods that should
676 // redirect to a Python method if one exists. The names designate the
677 // return type, if any, as well as any parameter types.
678 //---------------------------------------------------------------------------
680 #define DEC_PYCALLBACK__(CBNAME) \
684 #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
685 void CLASS::CBNAME() { \
687 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
688 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
689 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
690 wxPyEndBlockThreads(blocked); \
695 #define DEC_PYCALLBACK_VOID_(CBNAME) \
696 DEC_PYCALLBACK__(CBNAME)
698 #define IMP_PYCALLBACK_VOID_(CLASS, PCLASS, CBNAME) \
699 IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME)
701 //---------------------------------------------------------------------------
703 #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
704 bool CBNAME(int a, int b)
707 #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
708 bool CLASS::CBNAME(int a, int b) { \
709 bool rval=false, found; \
710 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
711 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
712 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
713 wxPyEndBlockThreads(blocked); \
715 rval = PCLASS::CBNAME(a,b); \
719 //---------------------------------------------------------------------------
721 #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
722 void CBNAME(int a, int b)
725 #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
726 void CLASS::CBNAME(int a, int b) { \
728 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
730 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
731 wxPyEndBlockThreads(blocked); \
733 PCLASS::CBNAME(a,b); \
736 //---------------------------------------------------------------------------
738 #define DEC_PYCALLBACK_VOID_INT(CBNAME) \
742 #define IMP_PYCALLBACK_VOID_INT(CLASS, PCLASS, CBNAME) \
743 void CLASS::CBNAME(int a) { \
745 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
746 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
747 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
748 wxPyEndBlockThreads(blocked); \
753 //---------------------------------------------------------------------------
755 #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \
756 void CBNAME(int a, int b, int c, int d)
759 #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \
760 void CLASS::CBNAME(int a, int b, int c, int d) { \
762 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
763 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
764 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \
765 wxPyEndBlockThreads(blocked); \
767 PCLASS::CBNAME(a,b,c,d); \
770 //---------------------------------------------------------------------------
771 #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \
772 void CBNAME(int a, int b, int c, int d, int e)
775 #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \
776 void CLASS::CBNAME(int a, int b, int c, int d, int e) { \
778 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
779 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
780 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \
781 wxPyEndBlockThreads(blocked); \
783 PCLASS::CBNAME(a,b,c,d,e); \
786 //---------------------------------------------------------------------------
788 #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \
789 void CBNAME(int* a, int* b) const
792 #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \
793 void CLASS::CBNAME(int* a, int* b) const { \
794 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
796 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
797 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
799 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
801 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
802 PyObject* o1 = PySequence_GetItem(ro, 0); \
803 PyObject* o2 = PySequence_GetItem(ro, 1); \
804 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
805 *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \
808 PyErr_SetString(PyExc_TypeError, errmsg); \
813 PyErr_SetString(PyExc_TypeError, errmsg); \
818 wxPyEndBlockThreads(blocked); \
820 PCLASS::CBNAME(a,b); \
823 //---------------------------------------------------------------------------
825 #define DEC_PYCALLBACK_SIZE_const(CBNAME) \
826 wxSize CBNAME() const
829 #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \
830 wxSize CLASS::CBNAME() const { \
831 const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \
832 bool found; wxSize rval(0,0); \
833 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
834 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
836 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
838 if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
839 PyObject* o1 = PySequence_GetItem(ro, 0); \
840 PyObject* o2 = PySequence_GetItem(ro, 1); \
841 if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \
842 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
845 PyErr_SetString(PyExc_TypeError, errmsg); \
850 PyErr_SetString(PyExc_TypeError, errmsg); \
855 wxPyEndBlockThreads(blocked); \
857 return PCLASS::CBNAME(); \
862 //---------------------------------------------------------------------------
864 #define DEC_PYCALLBACK_BOOL_BOOL(CBNAME) \
868 #define IMP_PYCALLBACK_BOOL_BOOL(CLASS, PCLASS, CBNAME) \
869 bool CLASS::CBNAME(bool a) { \
870 bool rval=false, found; \
871 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
872 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
873 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
874 wxPyEndBlockThreads(blocked); \
876 rval = PCLASS::CBNAME(a); \
880 //---------------------------------------------------------------------------
882 #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
886 #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
887 bool CLASS::CBNAME(int a) { \
888 bool rval=false, found; \
889 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
890 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
891 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
892 wxPyEndBlockThreads(blocked); \
894 rval = PCLASS::CBNAME(a); \
898 //---------------------------------------------------------------------------
900 #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
904 #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
905 bool CLASS::CBNAME(int a) { \
907 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
908 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
909 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
911 wxPyEndBlockThreads(blocked); \
916 //---------------------------------------------------------------------------
918 #define DEC_PYCALLBACK_INT_WIN(CBNAME) \
919 int CBNAME(wxWindow* a)
922 #define IMP_PYCALLBACK_INT_WIN(CLASS, PCLASS, CBNAME) \
923 int CLASS::CBNAME(wxWindow* a) { \
926 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
927 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
928 PyObject* obj = wxPyMake_wxObject(a, false); \
929 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)",obj)); \
932 wxPyEndBlockThreads(blocked); \
934 rval = PCLASS::CBNAME(a); \
939 //---------------------------------------------------------------------------
941 #define DEC_PYCALLBACK__DC(CBNAME) \
945 #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
946 void CLASS::CBNAME(wxDC& a) { \
948 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
949 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
950 PyObject* obj = wxPyMake_wxObject(&a,false); \
951 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
954 wxPyEndBlockThreads(blocked); \
960 //---------------------------------------------------------------------------
962 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
963 void CBNAME(wxDC& a, bool b)
966 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
967 void CLASS::CBNAME(wxDC& a, bool b) { \
969 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
970 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
971 PyObject* obj = wxPyMake_wxObject(&a,false); \
972 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
975 wxPyEndBlockThreads(blocked); \
977 PCLASS::CBNAME(a, b); \
980 //---------------------------------------------------------------------------
982 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
983 void CBNAME(wxDC& a, bool b)
986 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
987 void CLASS::CBNAME(wxDC& a, bool b) { \
989 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
990 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
991 PyObject* obj = wxPyMake_wxObject(&a,false); \
992 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
995 wxPyEndBlockThreads(blocked); \
997 PCLASS::CBNAME(a, b); \
1000 //---------------------------------------------------------------------------
1002 #define DEC_PYCALLBACK__2DBL(CBNAME) \
1003 void CBNAME(double a, double b)
1006 #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
1007 void CLASS::CBNAME(double a, double b) { \
1009 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1010 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1011 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
1012 wxPyEndBlockThreads(blocked); \
1014 PCLASS::CBNAME(a, b); \
1017 //---------------------------------------------------------------------------
1019 #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
1020 void CBNAME(double a, double b, int c, int d)
1023 #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
1024 void CLASS::CBNAME(double a, double b, int c, int d) { \
1026 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1027 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1028 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
1030 wxPyEndBlockThreads(blocked); \
1032 PCLASS::CBNAME(a, b, c, d); \
1035 //---------------------------------------------------------------------------
1037 #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
1038 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1041 #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1042 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1044 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1045 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1046 PyObject* obj = wxPyMake_wxObject(&a,false); \
1047 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
1050 wxPyEndBlockThreads(blocked); \
1052 PCLASS::CBNAME(a, b, c, d, e, f); \
1055 //---------------------------------------------------------------------------
1057 #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
1058 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f)
1061 #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
1062 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
1064 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1066 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1067 PyObject* obj = wxPyMake_wxObject(&a,false); \
1068 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
1071 wxPyEndBlockThreads(blocked); \
1073 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
1077 //---------------------------------------------------------------------------
1079 #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
1080 void CBNAME(bool a, double b, double c, int d, int e)
1083 #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1084 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
1086 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1087 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1088 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
1090 wxPyEndBlockThreads(blocked); \
1092 PCLASS::CBNAME(a, b, c, d, e); \
1095 //---------------------------------------------------------------------------
1097 #define DEC_PYCALLBACK__DC4DBL(CBNAME) \
1098 void CBNAME(wxDC& a, double b, double c, double d, double e)
1101 #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
1102 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
1104 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1105 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1106 PyObject* obj = wxPyMake_wxObject(&a,false); \
1107 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
1110 wxPyEndBlockThreads(blocked); \
1112 PCLASS::CBNAME(a, b, c, d, e); \
1115 //---------------------------------------------------------------------------
1117 #define DEC_PYCALLBACK__DCBOOL(CBNAME) \
1118 void CBNAME(wxDC& a, bool b)
1121 #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
1122 void CLASS::CBNAME(wxDC& a, bool b) { \
1124 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1125 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1126 PyObject* obj = wxPyMake_wxObject(&a,false); \
1127 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
1130 wxPyEndBlockThreads(blocked); \
1132 PCLASS::CBNAME(a, b); \
1135 //---------------------------------------------------------------------------
1137 #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
1138 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f)
1141 #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
1142 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
1145 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1146 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1147 PyObject* obj = wxPyMake_wxObject(a,false); \
1148 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
1151 wxPyEndBlockThreads(blocked); \
1153 PCLASS::CBNAME(a, b, c, d, e, f); \
1156 //---------------------------------------------------------------------------
1158 #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
1159 void CBNAME(wxControlPoint* a, double b, double c, int d, int e)
1162 #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
1163 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
1165 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1166 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1167 PyObject* obj = wxPyMake_wxObject(a,false); \
1168 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
1171 wxPyEndBlockThreads(blocked); \
1173 PCLASS::CBNAME(a, b, c, d, e); \
1176 //---------------------------------------------------------------------------
1178 #define DEC_PYCALLBACK__2DBLINT(CBNAME) \
1179 void CBNAME(double a, double b, int c)
1182 #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
1183 void CLASS::CBNAME(double a, double b, int c) { \
1185 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1186 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1187 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
1188 wxPyEndBlockThreads(blocked); \
1190 PCLASS::CBNAME(a, b, c); \
1193 //---------------------------------------------------------------------------
1195 #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
1196 void CBNAME(bool a, double b, double c, int d)
1199 #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
1200 void CLASS::CBNAME(bool a, double b, double c, int d) { \
1202 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1203 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1204 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
1205 wxPyEndBlockThreads(blocked); \
1207 PCLASS::CBNAME(a, b, c, d); \
1210 //---------------------------------------------------------------------------
1211 //---------------------------------------------------------------------------
1213 #define DEC_PYCALLBACK__STRING(CBNAME) \
1214 void CBNAME(const wxString& a)
1216 #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
1217 void CLASS::CBNAME(const wxString& a) { \
1219 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1220 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1221 PyObject* s = wx2PyString(a); \
1222 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1225 wxPyEndBlockThreads(blocked); \
1227 PCLASS::CBNAME(a); \
1230 //---------------------------------------------------------------------------
1232 #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
1233 bool CBNAME(const wxString& a)
1235 #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
1236 bool CLASS::CBNAME(const wxString& a) { \
1239 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1240 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1241 PyObject* s = wx2PyString(a); \
1242 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1245 wxPyEndBlockThreads(blocked); \
1247 rval = PCLASS::CBNAME(a); \
1251 //---------------------------------------------------------------------------
1253 #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
1254 bool CBNAME(const wxString& a)
1256 #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
1257 bool CLASS::CBNAME(const wxString& a) { \
1259 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1260 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1261 PyObject* s = wx2PyString(a); \
1262 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \
1265 wxPyEndBlockThreads(blocked); \
1269 //---------------------------------------------------------------------------
1271 #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
1272 wxString CBNAME(const wxString& a)
1274 #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
1275 wxString CLASS::CBNAME(const wxString& a) { \
1277 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1278 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1280 PyObject* s = wx2PyString(a); \
1281 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1284 rval = Py2wxString(ro); \
1288 wxPyEndBlockThreads(blocked); \
1292 //---------------------------------------------------------------------------
1294 #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \
1295 wxString CBNAME(const wxString& a)
1297 #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \
1298 wxString CLASS::CBNAME(const wxString& a) { \
1301 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1302 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1304 PyObject* s = wx2PyString(a); \
1305 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \
1308 rval = Py2wxString(ro); \
1312 wxPyEndBlockThreads(blocked); \
1314 rval = PCLASS::CBNAME(a); \
1318 //---------------------------------------------------------------------------
1320 #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
1321 wxString CBNAME(const wxString& a,int b)
1323 #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
1324 wxString CLASS::CBNAME(const wxString& a,int b) { \
1326 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1327 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1329 PyObject* s = wx2PyString(a); \
1330 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \
1333 rval = Py2wxString(ro); \
1337 wxPyEndBlockThreads(blocked); \
1341 //---------------------------------------------------------------------------
1343 #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
1344 bool CBNAME(const wxString& a, const wxString& b)
1346 #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
1347 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
1350 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1351 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1352 PyObject* s1 = wx2PyString(a); \
1353 PyObject* s2 = wx2PyString(b); \
1354 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \
1358 wxPyEndBlockThreads(blocked); \
1360 rval = PCLASS::CBNAME(a, b); \
1364 //---------------------------------------------------------------------------
1366 #define DEC_PYCALLBACK_STRING_(CBNAME) \
1369 #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
1370 wxString CLASS::CBNAME() { \
1373 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1374 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1376 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1378 rval = Py2wxString(ro); \
1382 wxPyEndBlockThreads(blocked); \
1384 rval = PCLASS::CBNAME(); \
1388 //---------------------------------------------------------------------------
1390 #define DEC_PYCALLBACK_STRING__const(CBNAME) \
1391 wxString CBNAME() const
1393 #define IMP_PYCALLBACK_STRING__const(CLASS, PCLASS, CBNAME) \
1394 wxString CLASS::CBNAME() const { \
1397 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1398 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1400 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1402 rval = Py2wxString(ro); \
1406 wxPyEndBlockThreads(blocked); \
1408 rval = PCLASS::CBNAME(); \
1412 //---------------------------------------------------------------------------
1414 #define DEC_PYCALLBACK_STRING__pure(CBNAME) \
1417 #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
1418 wxString CLASS::CBNAME() { \
1420 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1421 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1423 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1425 rval = Py2wxString(ro); \
1429 wxPyEndBlockThreads(blocked); \
1433 //---------------------------------------------------------------------------
1435 #define DEC_PYCALLBACK_STRING__constpure(CBNAME) \
1436 wxString CBNAME() const;
1438 #define IMP_PYCALLBACK_STRING__constpure(CLASS, PCLASS, CBNAME) \
1439 wxString CLASS::CBNAME() const { \
1441 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1442 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1444 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
1446 rval = Py2wxString(ro); \
1450 wxPyEndBlockThreads(blocked); \
1454 //---------------------------------------------------------------------------
1456 #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1457 bool CBNAME(const wxHtmlTag& a)
1460 #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1461 bool CLASS::CBNAME(const wxHtmlTag& a) { \
1463 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1464 if (wxPyCBH_findCallback2(m_myInst, #CBNAME, false)) { \
1465 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxHtmlTag"), 0);\
1466 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1469 wxPyEndBlockThreads(blocked); \
1473 //---------------------------------------------------------------------------
1475 #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1476 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y)
1478 #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1479 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1481 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1482 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1483 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1484 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1487 wxPyEndBlockThreads(blocked); \
1489 PCLASS::CBNAME(cell, x, y); \
1492 //---------------------------------------------------------------------------
1494 #define DEC_PYCALLBACK__COLOUR(CBNAME) \
1495 void CBNAME(const wxColour& c);
1497 #define IMP_PYCALLBACK__COLOUR(CLASS, PCLASS, CBNAME) \
1498 void CLASS::CBNAME(const wxColour& c) { \
1500 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1501 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1502 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1503 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1506 wxPyEndBlockThreads(blocked); \
1508 PCLASS::CBNAME(c); \
1511 //---------------------------------------------------------------------------
1512 #define DEC_PYCALLBACK__INTCOLOUR(CBNAME) \
1513 void CBNAME(int a, const wxColour& c);
1515 #define IMP_PYCALLBACK__INTCOLOUR(CLASS, PCLASS, CBNAME) \
1516 void CLASS::CBNAME(int a, const wxColour& c) { \
1518 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1519 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1520 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxColour"), 0); \
1521 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1524 wxPyEndBlockThreads(blocked); \
1526 PCLASS::CBNAME(a, c); \
1529 //---------------------------------------------------------------------------
1531 #define DEC_PYCALLBACK__INTFONT(CBNAME) \
1532 void CBNAME(int a, const wxFont& c);
1534 #define IMP_PYCALLBACK__INTFONT(CLASS, PCLASS, CBNAME) \
1535 void CLASS::CBNAME(int a, const wxFont& c) { \
1537 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1538 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1539 PyObject* obj = wxPyConstructObject((void*)&c, wxT("wxFont"), 0); \
1540 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(iO)",a, obj)); \
1543 wxPyEndBlockThreads(blocked); \
1545 PCLASS::CBNAME(a, c); \
1548 //---------------------------------------------------------------------------
1550 #define DEC_PYCALLBACK__FONT(CBNAME) \
1551 void CBNAME(const wxFont& a);
1553 #define IMP_PYCALLBACK__FONT(CLASS, PCLASS, CBNAME) \
1554 void CLASS::CBNAME(const wxFont& a) { \
1556 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1557 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1558 PyObject* obj = wxPyConstructObject((void*)&a, wxT("wxFont"), 0); \
1559 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", obj)); \
1562 wxPyEndBlockThreads(blocked); \
1564 PCLASS::CBNAME(a); \
1567 //---------------------------------------------------------------------------
1569 #define DEC_PYCALLBACK_BOOL_CELLINTINTME(CBNAME) \
1570 bool CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e)
1572 #define IMP_PYCALLBACK_BOOL_CELLINTINTME(CLASS, PCLASS, CBNAME) \
1573 bool CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1574 bool rval=false, found; \
1575 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1576 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1577 PyObject* obj = wxPyMake_wxObject(cell, 0); \
1578 PyObject* o2 = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
1579 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1583 wxPyEndBlockThreads(blocked); \
1585 rval = 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 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1599 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1600 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1601 wxPyEndBlockThreads(blocked); \
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 wxPyBlock_t blocked = 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) { \
1624 PyObject* o1 = PySequence_GetItem(ro, 0); \
1625 PyObject* o2 = PySequence_GetItem(ro, 1); \
1626 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1627 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1629 PyErr_SetString(PyExc_TypeError, errmsg); \
1634 PyErr_SetString(PyExc_TypeError, errmsg); \
1639 wxPyEndBlockThreads(blocked); \
1643 //---------------------------------------------------------------------------
1645 #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1646 bool CBNAME(wxWindow* a)
1649 #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1650 bool CLASS::CBNAME(wxWindow* a) { \
1653 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1654 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1655 PyObject* obj = wxPyMake_wxObject(a,false); \
1656 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1659 wxPyEndBlockThreads(blocked); \
1661 rval = PCLASS::CBNAME(a); \
1667 #define DEC_PYCALLBACK_BOOL_WXWIN_pure(CBNAME) \
1668 bool CBNAME(wxWindow* a)
1670 #define IMP_PYCALLBACK_BOOL_WXWIN_pure(CLASS, PCLASS, CBNAME) \
1671 bool CLASS::CBNAME(wxWindow* a) { \
1674 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1675 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1676 PyObject* obj = wxPyMake_wxObject(a,false); \
1677 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1680 wxPyEndBlockThreads(blocked); \
1684 //---------------------------------------------------------------------------
1686 #define DEC_PYCALLBACK_BOOL_WXWINDC(CBNAME) \
1687 bool CBNAME(wxWindow* a, wxDC& b)
1690 #define IMP_PYCALLBACK_BOOL_WXWINDC(CLASS, PCLASS, CBNAME) \
1691 bool CLASS::CBNAME(wxWindow* a, wxDC& b) { \
1694 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1695 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1696 PyObject* win = wxPyMake_wxObject(a,false); \
1697 PyObject* dc = wxPyMake_wxObject(&b,false); \
1698 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", win, dc));\
1702 wxPyEndBlockThreads(blocked); \
1704 rval = PCLASS::CBNAME(a, b); \
1708 //---------------------------------------------------------------------------
1710 #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \
1711 void CBNAME(wxWindowBase* a)
1714 #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \
1715 void CLASS::CBNAME(wxWindowBase* a) { \
1717 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1718 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1719 PyObject* obj = wxPyMake_wxObject(a,false); \
1720 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1723 wxPyEndBlockThreads(blocked); \
1725 PCLASS::CBNAME(a); \
1728 //---------------------------------------------------------------------------
1730 #define DEC_PYCALLBACK_BOOL_(CBNAME) \
1734 #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1735 bool CLASS::CBNAME() { \
1738 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1739 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1740 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1741 wxPyEndBlockThreads(blocked); \
1743 rval = PCLASS::CBNAME(); \
1747 //---------------------------------------------------------------------------
1749 #define DEC_PYCALLBACK_BOOL_const(CBNAME) \
1753 #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \
1754 bool CLASS::CBNAME() const { \
1757 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1758 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1759 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1760 wxPyEndBlockThreads(blocked); \
1762 rval = PCLASS::CBNAME(); \
1766 //---------------------------------------------------------------------------
1768 #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1769 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1772 #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1773 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1776 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1777 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1778 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1779 wxPyEndBlockThreads(blocked); \
1781 rval = PCLASS::CBNAME(a, b, c); \
1782 return (wxDragResult)rval; \
1785 //---------------------------------------------------------------------------
1787 #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1788 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location)
1790 #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1791 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
1792 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1794 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1796 PyObject* obj = wxPyMake_wxObject(&a,false); \
1797 PyObject* s = wx2PyString(b); \
1798 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)", \
1801 wxPyConvertSwigPtr(ro, (void **)&rval, wxT("wxFSFile")); \
1802 /* release ownership of the C++ wx.FSFile object. */ \
1803 PyObject_SetAttrString(ro, "thisown", Py_False); \
1809 wxPyEndBlockThreads(blocked); \
1813 //---------------------------------------------------------------------------
1815 #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1816 bool CBNAME(wxDragResult a)
1819 #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1820 bool CLASS::CBNAME(wxDragResult a) { \
1823 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1824 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1825 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
1826 wxPyEndBlockThreads(blocked); \
1828 rval = PCLASS::CBNAME(a); \
1832 //---------------------------------------------------------------------------
1834 #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1835 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def)
1838 #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1839 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1840 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1842 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1843 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
1844 wxPyEndBlockThreads(blocked); \
1845 return (wxDragResult)rval; \
1848 //---------------------------------------------------------------------------
1850 #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1851 bool CBNAME(int a, int b, const wxString& c)
1853 #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1854 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
1856 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1857 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1858 PyObject* s = wx2PyString(c); \
1859 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\
1862 wxPyEndBlockThreads(blocked); \
1866 //---------------------------------------------------------------------------
1868 #define DEC_PYCALLBACK_SIZET_(CBNAME) \
1872 #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1873 size_t CLASS::CBNAME() { \
1876 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1877 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1878 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1879 wxPyEndBlockThreads(blocked); \
1881 rval = PCLASS::CBNAME(); \
1885 //---------------------------------------------------------------------------
1887 #define DEC_PYCALLBACK_SIZET__const(CBNAME) \
1888 size_t CBNAME() const
1891 #define IMP_PYCALLBACK_SIZET__const(CLASS, PCLASS, CBNAME) \
1892 size_t CLASS::CBNAME() const { \
1895 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1896 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1897 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
1898 wxPyEndBlockThreads(blocked); \
1900 rval = PCLASS::CBNAME(); \
1904 //---------------------------------------------------------------------------
1906 #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1907 wxDataFormat CBNAME(size_t a)
1910 #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1911 wxDataFormat CLASS::CBNAME(size_t a) { \
1912 wxDataFormat rval=0; \
1914 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1915 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1917 wxDataFormat* ptr; \
1918 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1920 if (wxPyCOnvertSwigPtr(ro, (void **)&ptr, wxT("wxDataFormat"))) \
1925 wxPyEndBlockThreads(blocked); \
1927 rval = PCLASS::CBNAME(a); \
1931 //---------------------------------------------------------------------------
1933 #define DEC_PYCALLBACK__constany(CBNAME, Type) \
1934 void CBNAME(const Type& a)
1937 #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1938 void CLASS::CBNAME(const Type& a) { \
1940 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1941 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1942 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1943 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1946 wxPyEndBlockThreads(blocked); \
1948 PCLASS::CBNAME(a); \
1952 //---------------------------------------------------------------------------
1954 #define DEC_PYCALLBACK__any(CBNAME, Type) \
1955 void CBNAME(Type& a)
1958 #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1959 void CLASS::CBNAME(Type& a) { \
1961 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1962 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1963 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1964 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1967 wxPyEndBlockThreads(blocked); \
1969 PCLASS::CBNAME(a); \
1972 //---------------------------------------------------------------------------
1974 #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1975 bool CBNAME(Type& a)
1978 #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1979 bool CLASS::CBNAME(Type& a) { \
1982 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
1983 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1984 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
1985 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1988 wxPyEndBlockThreads(blocked); \
1990 rv = PCLASS::CBNAME(a); \
1994 //---------------------------------------------------------------------------
1996 #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \
1997 bool CBNAME(Type& a)
2000 #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \
2001 bool CLASS::CBNAME(Type& a) { \
2003 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2004 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2005 PyObject* obj = wxPyConstructObject((void*)&a, wxT(#Type), 0); \
2006 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2009 wxPyEndBlockThreads(blocked); \
2013 //---------------------------------------------------------------------------
2015 #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
2016 wxString CBNAME(long a, long b) const
2018 #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
2019 wxString CLASS::CBNAME(long a, long b) const { \
2022 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2023 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2025 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2027 rval = Py2wxString(ro); \
2031 wxPyEndBlockThreads(blocked); \
2033 rval = PCLASS::CBNAME(a,b); \
2037 //---------------------------------------------------------------------------
2039 #define DEC_PYCALLBACK_INT_LONG(CBNAME) \
2040 int CBNAME(long a) const
2043 #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
2044 int CLASS::CBNAME(long a) const { \
2047 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2048 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2050 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2052 rval = PyInt_AsLong(ro); \
2056 wxPyEndBlockThreads(blocked); \
2058 rval = PCLASS::CBNAME(a); \
2063 #define DEC_PYCALLBACK_INT_LONG_virtual(CBNAME) \
2064 int CBNAME(long a) const;
2067 #define IMP_PYCALLBACK_INT_LONG_virtual(CLASS, PCLASS, CBNAME) \
2068 int CLASS::CBNAME(long a) const { \
2069 int rval=-1; /* this rval is important for OnGetItemImage */ \
2071 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2072 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2074 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2076 rval = PyInt_AsLong(ro); \
2080 wxPyEndBlockThreads(blocked); \
2085 //---------------------------------------------------------------------------
2087 #define DEC_PYCALLBACK_INT_INT(CBNAME) \
2091 #define IMP_PYCALLBACK_INT_INT(CLASS, PCLASS, CBNAME) \
2092 int CLASS::CBNAME(int a) { \
2095 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2096 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2098 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)",a)); \
2100 rval = PyInt_AsLong(ro); \
2104 wxPyEndBlockThreads(blocked); \
2106 rval = PCLASS::CBNAME(a); \
2110 //---------------------------------------------------------------------------
2112 #define DEC_PYCALLBACK_INT_LONGLONG(CBNAME) \
2113 int CBNAME(long a, long b) const
2116 #define IMP_PYCALLBACK_INT_LONGLONG(CLASS, PCLASS, CBNAME) \
2117 int CLASS::CBNAME(long a, long b) const { \
2120 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2121 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2123 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2125 rval = PyInt_AsLong(ro); \
2129 wxPyEndBlockThreads(blocked); \
2131 rval = PCLASS::CBNAME(a, b); \
2136 #define DEC_PYCALLBACK_INT_LONGLONG_virtual(CBNAME) \
2137 int CBNAME(long a, long b) const;
2140 #define IMP_PYCALLBACK_INT_LONGLONG_virtual(CLASS, PCLASS, CBNAME) \
2141 int CLASS::CBNAME(long a, long b) const { \
2142 int rval=-1; /* this rval is important for OnGetItemImage */ \
2144 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2145 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2147 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
2149 rval = PyInt_AsLong(ro); \
2153 wxPyEndBlockThreads(blocked); \
2158 //---------------------------------------------------------------------------
2160 #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
2161 wxListItemAttr* CBNAME(long a) const
2164 #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
2165 wxListItemAttr *CLASS::CBNAME(long a) const { \
2166 wxListItemAttr *rval = NULL; \
2168 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2169 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2171 wxListItemAttr* ptr; \
2172 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2174 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxListItemAttr")))\
2179 wxPyEndBlockThreads(blocked); \
2181 rval = PCLASS::CBNAME(a); \
2185 //---------------------------------------------------------------------------
2187 #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
2188 bool CBNAME(wxMouseEvent& e)
2190 #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
2191 bool CLASS::CBNAME(wxMouseEvent& e) { \
2194 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2195 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2197 PyObject* obj = wxPyConstructObject((void*)&e, wxT("wxMouseEvent"), 0); \
2198 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
2200 rval = PyInt_AsLong(ro); \
2205 wxPyEndBlockThreads(blocked); \
2207 return PCLASS::CBNAME(e); \
2211 //---------------------------------------------------------------------------
2213 #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \
2214 wxWizardPage* CBNAME() const
2216 #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \
2217 wxWizardPage* CLASS::CBNAME() const { \
2218 wxWizardPage* rv = NULL; \
2219 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2220 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2222 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2224 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxWizardPage")); \
2228 wxPyEndBlockThreads(blocked); \
2232 //---------------------------------------------------------------------------
2234 #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \
2235 wxBitmap CBNAME() const
2237 #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \
2238 wxBitmap CLASS::CBNAME() const { \
2240 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2241 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2244 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2246 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxBitmap"))) \
2251 wxPyEndBlockThreads(blocked); \
2255 //---------------------------------------------------------------------------
2257 #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \
2260 #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \
2261 wxObject* CLASS::CBNAME() { \
2262 wxObject* rv = NULL; \
2263 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2264 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2266 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2268 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2272 wxPyEndBlockThreads(blocked); \
2276 //---------------------------------------------------------------------------
2278 #define DEC_PYCALLBACK_OBJECT_STRING_pure(CBNAME) \
2279 wxObject* CBNAME(const wxString& a)
2281 #define IMP_PYCALLBACK_OBJECT_STRING_pure(CLASS, PCLASS, CBNAME) \
2282 wxObject* CLASS::CBNAME(const wxString& a) { \
2283 wxObject* rv = NULL; \
2284 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2285 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2286 PyObject* so = wx2PyString(a); \
2288 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", so)); \
2290 wxPyConvertSwigPtr(ro, (void **)&rv, wxT("wxObject")); \
2295 wxPyEndBlockThreads(blocked); \
2299 //---------------------------------------------------------------------------
2301 #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \
2302 bool CBNAME(wxXmlNode* a)
2305 #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \
2306 bool CLASS::CBNAME(wxXmlNode* a) { \
2308 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2309 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2310 PyObject* obj = wxPyConstructObject((void*)a, wxT("wxXmlNode"), 0); \
2311 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
2314 wxPyEndBlockThreads(blocked); \
2318 //---------------------------------------------------------------------------
2320 #define DEC_PYCALLBACK_COORD_SIZET_const(CBNAME) \
2321 wxCoord CBNAME(size_t a) const
2323 #define IMP_PYCALLBACK_COORD_SIZET_const(CLASS, PCLASS, CBNAME) \
2324 wxCoord CLASS::CBNAME(size_t a) const { \
2327 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2328 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2329 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2331 wxPyEndBlockThreads(blocked); \
2333 rval = PCLASS::CBNAME(a); \
2338 #define DEC_PYCALLBACK_COORD_SIZET_constpure(CBNAME) \
2339 wxCoord CBNAME(size_t a) const
2341 #define IMP_PYCALLBACK_COORD_SIZET_constpure(CLASS, PCLASS, CBNAME) \
2342 wxCoord CLASS::CBNAME(size_t a) const { \
2345 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2346 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2347 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a)); \
2349 wxPyEndBlockThreads(blocked); \
2353 //---------------------------------------------------------------------------
2355 #define DEC_PYCALLBACK_VOID_SIZETSIZET_const(CBNAME) \
2356 void CBNAME(size_t a, size_t b) const
2359 #define IMP_PYCALLBACK_VOID_SIZETSIZET_const(CLASS, PCLASS, CBNAME) \
2360 void CLASS::CBNAME(size_t a, size_t b) const { \
2362 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2363 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2364 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
2365 wxPyEndBlockThreads(blocked); \
2367 PCLASS::CBNAME(a,b); \
2369 //---------------------------------------------------------------------------
2371 #define DEC_PYCALLBACK_COORD_const(CBNAME) \
2372 wxCoord CBNAME() const
2375 #define IMP_PYCALLBACK_COORD_const(CLASS, PCLASS, CBNAME) \
2376 wxCoord CLASS::CBNAME() const { \
2379 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2380 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
2381 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
2382 wxPyEndBlockThreads(blocked); \
2384 rval = PCLASS::CBNAME(); \
2388 //---------------------------------------------------------------------------
2390 #define DEC_PYCALLBACK__DCRECTSIZET_constpure(CBNAME) \
2391 void CBNAME(wxDC& a, const wxRect& b, size_t c) const;
2393 #define IMP_PYCALLBACK__DCRECTSIZET_constpure(CLASS, PCLASS, CBNAME) \
2394 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2396 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2397 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2398 PyObject* obj = wxPyMake_wxObject(&a,false); \
2399 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2400 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2401 Py_DECREF(obj); Py_DECREF(ro); \
2403 wxPyEndBlockThreads(blocked); \
2408 #define DEC_PYCALLBACK__DCRECTSIZET_const(CBNAME) \
2409 void CBNAME(wxDC& a, const wxRect& b, size_t c) const
2411 #define IMP_PYCALLBACK__DCRECTSIZET_const(CLASS, PCLASS, CBNAME) \
2412 void CLASS::CBNAME(wxDC& a, const wxRect& b, size_t c) const { \
2414 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2415 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2416 PyObject* obj = wxPyMake_wxObject(&a,false); \
2417 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2418 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2419 Py_DECREF(obj); Py_DECREF(ro); \
2421 wxPyEndBlockThreads(blocked); \
2423 PCLASS::CBNAME(a,b,c); \
2427 //---------------------------------------------------------------------------
2428 // Same as the above set, but the wxRect is not const
2430 #define DEC_PYCALLBACK__DCRECTSIZET2_constpure(CBNAME) \
2431 void CBNAME(wxDC& a, wxRect& b, size_t c) const;
2433 #define IMP_PYCALLBACK__DCRECTSIZET2_constpure(CLASS, PCLASS, CBNAME) \
2434 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2436 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2437 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2438 PyObject* obj = wxPyMake_wxObject(&a,false); \
2439 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2440 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2441 Py_DECREF(obj); Py_DECREF(ro); \
2443 wxPyEndBlockThreads(blocked); \
2448 #define DEC_PYCALLBACK__DCRECTSIZET2_const(CBNAME) \
2449 void CBNAME(wxDC& a, wxRect& b, size_t c) const
2451 #define IMP_PYCALLBACK__DCRECTSIZET2_const(CLASS, PCLASS, CBNAME) \
2452 void CLASS::CBNAME(wxDC& a, wxRect& b, size_t c) const { \
2454 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2455 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2456 PyObject* obj = wxPyMake_wxObject(&a,false); \
2457 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2458 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOi)", obj, ro, (int)c)); \
2459 Py_DECREF(obj); Py_DECREF(ro); \
2461 wxPyEndBlockThreads(blocked); \
2463 PCLASS::CBNAME(a,b,c); \
2466 //---------------------------------------------------------------------------
2468 #define DEC_PYCALLBACK__DCRECTINTINT_const(CBNAME) \
2469 void CBNAME(wxDC& a, const wxRect& b, int c, int d) const
2471 #define IMP_PYCALLBACK__DCRECTINTINT_const(CLASS, PCLASS, CBNAME) \
2472 void CLASS::CBNAME(wxDC& a, const wxRect& b, int c, int d) const { \
2474 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2475 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2476 PyObject* obj = wxPyMake_wxObject(&a,false); \
2477 PyObject* ro = wxPyConstructObject((void*)&b, wxT("wxRect"), 0); \
2478 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OOii)", obj, ro, c, d)); \
2479 Py_DECREF(obj); Py_DECREF(ro); \
2481 wxPyEndBlockThreads(blocked); \
2483 PCLASS::CBNAME(a,b,c,d); \
2487 //---------------------------------------------------------------------------
2489 #define DEC_PYCALLBACK__RECTINT(CBNAME) \
2490 void CBNAME(const wxRect& a, int b)
2492 #define IMP_PYCALLBACK__RECTINT(CLASS, PCLASS, CBNAME) \
2493 void CLASS::CBNAME(const wxRect& a, int b) { \
2495 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2496 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2497 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2498 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b)); \
2501 wxPyEndBlockThreads(blocked); \
2503 PCLASS::CBNAME(a,b); \
2507 #define DEC_PYCALLBACK_BOOL_RECTINT(CBNAME) \
2508 bool CBNAME(const wxRect& a, int b)
2510 #define IMP_PYCALLBACK_BOOL_RECTINT(CLASS, PCLASS, CBNAME) \
2511 bool CLASS::CBNAME(const wxRect& a, int b) { \
2513 bool rval = false; \
2514 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2515 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2516 PyObject* ro = wxPyConstructObject((void*)&a, wxT("wxRect"), 0); \
2517 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", ro, b));\
2520 wxPyEndBlockThreads(blocked); \
2522 rval = PCLASS::CBNAME(a,b); \
2527 //---------------------------------------------------------------------------
2529 #define DEC_PYCALLBACK_STRING_SIZET(CBNAME) \
2530 wxString CBNAME(size_t a) const
2532 #define IMP_PYCALLBACK_STRING_SIZET(CLASS, PCLASS, CBNAME) \
2533 wxString CLASS::CBNAME(size_t a) const { \
2536 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2537 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2539 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2541 rval = Py2wxString(ro); \
2545 wxPyEndBlockThreads(blocked); \
2547 rval = PCLASS::CBNAME(a); \
2551 //---------------------------------------------------------------------------
2553 #define DEC_PYCALLBACK_STRING_SIZET_pure(CBNAME) \
2554 wxString CBNAME(size_t a) const
2556 #define IMP_PYCALLBACK_STRING_SIZET_pure(CLASS, PCLASS, CBNAME) \
2557 wxString CLASS::CBNAME(size_t a) const { \
2560 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2561 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2563 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
2565 rval = Py2wxString(ro); \
2569 wxPyEndBlockThreads(blocked); \
2573 //---------------------------------------------------------------------------
2575 #define DEC_PYCALLBACK_VIZATTR_(CBNAME) \
2576 wxVisualAttributes CBNAME() const
2579 #define IMP_PYCALLBACK_VIZATTR_(CLASS, PCLASS, CBNAME) \
2580 wxVisualAttributes CLASS::CBNAME() const { \
2581 wxVisualAttributes rval; \
2583 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2584 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
2586 wxVisualAttributes* ptr; \
2587 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
2589 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxVisualAttributes"))) \
2594 wxPyEndBlockThreads(blocked); \
2596 rval = PCLASS::CBNAME(); \
2600 //---------------------------------------------------------------------------
2602 #define DEC_PYCALLBACK_FONT_INT(CBNAME) \
2603 wxFont CBNAME(int a)
2605 #define IMP_PYCALLBACK_FONT_INT(CLASS, PCLASS, CBNAME) \
2606 wxFont CLASS::CBNAME(int a) { \
2609 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2610 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2613 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2615 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxFont"))) \
2620 wxPyEndBlockThreads(blocked); \
2622 rv = PCLASS::CBNAME(a); \
2626 //---------------------------------------------------------------------------
2628 #define DEC_PYCALLBACK_COLOUR_INT(CBNAME) \
2629 wxColour CBNAME(int a)
2631 #define IMP_PYCALLBACK_COLOUR_INT(CLASS, PCLASS, CBNAME) \
2632 wxColour CLASS::CBNAME(int a) { \
2635 wxPyBlock_t blocked = wxPyBeginBlockThreads(); \
2636 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2639 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
2641 if (wxPyConvertSwigPtr(ro, (void **)&ptr, wxT("wxColour"))) \
2646 wxPyEndBlockThreads(blocked); \
2648 rv = PCLASS::CBNAME(a); \
2652 //---------------------------------------------------------------------------