]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/helpers.h
wxUniversal fixes:
[wxWidgets.git] / wxPython / src / helpers.h
CommitLineData
b1462dfa 1////////////////////////////////////////////////////////////////////////////
7bf85405
RD
2// Name: helpers.h
3// Purpose: Helper functions/classes for the wxPython extenaion module
4//
5// Author: Robin Dunn
6//
7// Created: 7/1/97
8// RCS-ID: $Id$
9// Copyright: (c) 1998 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef __wxp_helpers__
14#define __wxp_helpers__
15
16#include <wx/wx.h>
17
cf694132 18
efc5f224
RD
19//---------------------------------------------------------------------------
20
2f90df85
RD
21typedef unsigned char byte;
22
7bf85405
RD
23
24class wxPyApp: public wxApp
25{
26public:
cf694132
RD
27 wxPyApp();
28 ~wxPyApp();
4268f798
RD
29 bool OnInit();
30 int MainLoop();
7bf85405 31};
4268f798 32
7bf85405
RD
33extern wxPyApp *wxPythonApp;
34
35//----------------------------------------------------------------------
36
0d6f9504 37void __wxPreStart();
7bf85405 38PyObject* __wxStart(PyObject*, PyObject* args);
7ff49f0c 39void __wxCleanup();
7bf85405 40
9416aa89 41//extern PyObject* wxPython_dict;
7bf85405
RD
42PyObject* __wxSetDictionary(PyObject*, PyObject* args);
43
7bf85405 44void wxPyEventThunker(wxObject*, wxEvent& event);
efc5f224 45
1e7ecb7b 46PyObject* wxPyConstructObject(void* ptr,
a541c325 47 const wxString& className,
1e7ecb7b 48 int setThisOwn=0);
9416aa89 49PyObject* wxPyConstructObject(void* ptr,
a541c325 50 const wxString& className,
9416aa89
RD
51 PyObject* klass,
52 int setThisOwn=0);
a541c325
RD
53
54PyObject* wx2PyString(const wxString& src);
55wxString Py2wxString(PyObject* source);
56
57PyObject* wxPyClassExists(const wxString& className);
58PyObject* wxPyMake_wxObject(wxObject* source, bool checkEvtHandler=TRUE);
59PyObject* wxPyMake_wxSizer(wxSizer* source);
60void wxPyPtrTypeMap_Add(const char* commonName, const char* ptrName);
9416aa89 61
1e7ecb7b 62PyObject* wxPy_ConvertList(wxListBase* list, const char* className);
a541c325 63long wxPyGetWinHandle(wxWindow* win);
9b3d3bc4 64
19a97bd6
RD
65//----------------------------------------------------------------------
66
4268f798
RD
67// if we want to handle threads and Python threads are available...
68#if defined(WXP_USE_THREAD) && defined(WITH_THREAD)
69#define WXP_WITH_THREAD
70#else // no Python threads...
71#undef WXP_WITH_THREAD
72#endif
19a97bd6
RD
73
74
4268f798
RD
75// For Python --> C++
76PyThreadState* wxPyBeginAllowThreads();
77void wxPyEndAllowThreads(PyThreadState* state);
9b3d3bc4 78
4268f798
RD
79// For C++ --> Python
80void wxPyBeginBlockThreads();
81void wxPyEndBlockThreads();
9b3d3bc4 82
7bf85405 83//----------------------------------------------------------------------
2f90df85
RD
84// These are helpers used by the typemaps
85
c8bc7bb8
RD
86wxString* wxString_in_helper(PyObject* source);
87
1e7ecb7b
RD
88byte* byte_LIST_helper(PyObject* source);
89int* int_LIST_helper(PyObject* source);
90long* long_LIST_helper(PyObject* source);
91char** string_LIST_helper(PyObject* source);
e0672e2f 92wxPoint* wxPoint_LIST_helper(PyObject* source, int* npoints);
1e7ecb7b
RD
93wxBitmap** wxBitmap_LIST_helper(PyObject* source);
94wxString* wxString_LIST_helper(PyObject* source);
95wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source);
9d37f964 96wxPen** wxPen_LIST_helper(PyObject* source);
1e7ecb7b
RD
97
98bool wxSize_helper(PyObject* source, wxSize** obj);
99bool wxPoint_helper(PyObject* source, wxPoint** obj);
100bool wxRealPoint_helper(PyObject* source, wxRealPoint** obj);
101bool wxRect_helper(PyObject* source, wxRect** obj);
102bool wxColour_helper(PyObject* source, wxColour** obj);
7bf85405 103
4acff284
RD
104//----------------------------------------------------------------------
105// Other helpful stuff
106
9d37f964
RD
107#if PYTHON_API_VERSION < 1009
108#define PySequence_Fast_GET_ITEM(o, i) \
109 (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i))
110#endif
111
112bool _2int_seq_helper(PyObject* source, int* i1, int* i2);
113bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4);
114
115
7b7ac0ab 116PyObject* wxArrayString2PyList_helper(const wxArrayString& arr);
293a0a86 117PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr);
b37c7e1d 118
4acff284
RD
119#define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; }
120#define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name)
121#define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val)
b37c7e1d 122
2f90df85 123//----------------------------------------------------------------------
7bf85405
RD
124
125#ifndef SWIGCODE
126extern "C" void SWIG_MakePtr(char *, void *, char *);
127extern "C" char *SWIG_GetPtr(char *, void **, char *);
d559219f 128extern "C" char *SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type);
7bf85405
RD
129#endif
130
131
132#ifdef _MSC_VER
133# pragma warning(disable:4800)
f6bcfd97 134# pragma warning(disable:4190)
7bf85405
RD
135#endif
136
7bf85405
RD
137//----------------------------------------------------------------------
138
139class wxPyCallback : public wxObject {
2f90df85 140 DECLARE_ABSTRACT_CLASS(wxPyCallback);
7bf85405 141public:
cf694132 142 wxPyCallback(PyObject* func);
2f90df85 143 wxPyCallback(const wxPyCallback& other);
cf694132 144 ~wxPyCallback();
7bf85405
RD
145
146 void EventThunker(wxEvent& event);
147
148 PyObject* m_func;
149};
150
7bf85405
RD
151//---------------------------------------------------------------------------
152
153class wxPyTimer : public wxTimer {
154public:
155 wxPyTimer(PyObject* callback);
156 ~wxPyTimer();
157
158 void Notify();
159
160private:
161 PyObject* func;
162};
163
cf694132 164//---------------------------------------------------------------------------
65dd82cb 165//---------------------------------------------------------------------------
9b3d3bc4
RD
166// These Event classes can be derived from in Python and passed through the
167// event system without loosing anything. They do this by keeping a reference
168// to themselves and some special case handling in wxPyCallback::EventThunker.
65dd82cb
RD
169
170
e19b7164 171class wxPyEvtSelfRef {
65dd82cb 172public:
e19b7164
RD
173 wxPyEvtSelfRef();
174 ~wxPyEvtSelfRef();
65dd82cb
RD
175
176 void SetSelf(PyObject* self, bool clone=FALSE);
177 PyObject* GetSelf() const;
178
179protected:
180 PyObject* m_self;
181 bool m_cloned;
182};
183
184
e19b7164 185class wxPyEvent : public wxEvent, public wxPyEvtSelfRef {
07b2e1cd 186 DECLARE_ABSTRACT_CLASS(wxPyEvent)
65dd82cb
RD
187public:
188 wxPyEvent(int id=0);
07b2e1cd 189 wxPyEvent(const wxPyEvent& evt);
65dd82cb
RD
190 ~wxPyEvent();
191
07b2e1cd 192 virtual wxEvent* Clone() const { return new wxPyEvent(*this); }
65dd82cb
RD
193};
194
195
e19b7164 196class wxPyCommandEvent : public wxCommandEvent, public wxPyEvtSelfRef {
07b2e1cd 197 DECLARE_ABSTRACT_CLASS(wxPyCommandEvent)
65dd82cb
RD
198public:
199 wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
07b2e1cd 200 wxPyCommandEvent(const wxPyCommandEvent& evt);
65dd82cb
RD
201 ~wxPyCommandEvent();
202
07b2e1cd 203 virtual wxEvent* Clone() const { return new wxPyCommandEvent(*this); }
65dd82cb
RD
204};
205
bb0054cd 206
4acff284
RD
207
208//----------------------------------------------------------------------
209// Forward decalre a few things used in the exported API
210class wxPyClientData;
211class wxPyUserData;
212class wxPyOORClientData;
213
214void wxPyClientData_dtor(wxPyClientData* self);
215void wxPyUserData_dtor(wxPyUserData* self);
216void wxPyOORClientData_dtor(wxPyOORClientData* self);
217
218
1e7ecb7b
RD
219//---------------------------------------------------------------------------
220// Export a C API in a struct. Other modules will be able to load this from
221// the wxc module and will then have safe access to these functions, even if
222// in another shared library.
223
224class wxPyCallbackHelper;
225
226struct wxPyCoreAPI {
227
228 void (*p_SWIG_MakePtr)(char*, void*, char*);
229 char* (*p_SWIG_GetPtr)(char*, void**, char*);
230 char* (*p_SWIG_GetPtrObj)(PyObject*, void**, char*);
231 void (*p_SWIG_RegisterMapping)(char*, char*, void *(*cast)(void *));
232 void (*p_SWIG_addvarlink)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p));
233 PyObject* (*p_SWIG_newvarlink)(void);
234
4268f798
RD
235 PyThreadState* (*p_wxPyBeginAllowThreads)();
236 void (*p_wxPyEndAllowThreads)(PyThreadState* state);
237 void (*p_wxPyBeginBlockThreads)();
238 void (*p_wxPyEndBlockThreads)();
19a97bd6 239
a541c325 240 PyObject* (*p_wxPyConstructObject)(void *, const wxString&, int);
1e7ecb7b
RD
241 PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className);
242
c8bc7bb8 243 wxString* (*p_wxString_in_helper)(PyObject* source);
a541c325
RD
244 wxString (*p_Py2wxString)(PyObject* source);
245 PyObject* (*p_wx2PyString)(const wxString& src);
c8bc7bb8 246
1e7ecb7b
RD
247 byte* (*p_byte_LIST_helper)(PyObject* source);
248 int* (*p_int_LIST_helper)(PyObject* source);
249 long* (*p_long_LIST_helper)(PyObject* source);
250 char** (*p_string_LIST_helper)(PyObject* source);
e0672e2f 251 wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source, int* npoints);
1e7ecb7b
RD
252 wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source);
253 wxString* (*p_wxString_LIST_helper)(PyObject* source);
254 wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source);
255
256 bool (*p_wxSize_helper)(PyObject* source, wxSize** obj);
257 bool (*p_wxPoint_helper)(PyObject* source, wxPoint** obj);
258 bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj);
259 bool (*p_wxRect_helper)(PyObject* source, wxRect** obj);
260 bool (*p_wxColour_helper)(PyObject* source, wxColour** obj);
261
0122b7e3 262 void (*p_wxPyCBH_setCallbackInfo)(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref);
1e7ecb7b
RD
263 bool (*p_wxPyCBH_findCallback)(const wxPyCallbackHelper& cbh, const char* name);
264 int (*p_wxPyCBH_callCallback)(const wxPyCallbackHelper& cbh, PyObject* argTuple);
265 PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple);
266 void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh);
267
a541c325 268 PyObject* (*p_wxPyClassExists)(const wxString& className);
2f4e9287
RD
269 PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler);
270 PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source);
9416aa89 271 void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName);
7b7ac0ab 272 PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr);
293a0a86 273 PyObject* (*p_wxArrayInt2PyList_helper)(const wxArrayInt& arr);
4acff284
RD
274
275 void (*p_wxPyClientData_dtor)(wxPyClientData*);
276 void (*p_wxPyUserData_dtor)(wxPyUserData*);
277 void (*p_wxPyOORClientData_dtor)(wxPyOORClientData*);
278};
279
280#ifdef wxPyUSE_EXPORT
281static wxPyCoreAPI* wxPyCoreAPIPtr = NULL; // Each module needs one, but doesn't have to use it.
282#endif
283
284
285//---------------------------------------------------------------------------
286
287
288class wxPyUserData : public wxObject {
289public:
290 wxPyUserData(PyObject* obj) {
291 m_obj = obj;
292 Py_INCREF(m_obj);
293 }
294
295 ~wxPyUserData() {
296#ifdef wxPyUSE_EXPORT
297 wxPyCoreAPIPtr->p_wxPyUserData_dtor(this);
298#else
299 wxPyUserData_dtor(this);
300#endif
301 }
302 PyObject* m_obj;
303};
304
305
306class wxPyClientData : public wxClientData {
307public:
308 wxPyClientData(PyObject* obj) {
309 m_obj = obj;
310 Py_INCREF(m_obj);
311 }
312
313 ~wxPyClientData() {
314#ifdef wxPyUSE_EXPORT
315 wxPyCoreAPIPtr->p_wxPyClientData_dtor(this);
316#else
317 wxPyClientData_dtor(this);
318#endif
319 }
320 PyObject* m_obj;
1e7ecb7b
RD
321};
322
4acff284
RD
323
324class wxPyOORClientData : public wxPyClientData {
325public:
326 wxPyOORClientData(PyObject* obj)
327 : wxPyClientData(obj) {}
328
329 ~wxPyOORClientData() {
1e7ecb7b 330#ifdef wxPyUSE_EXPORT
4acff284
RD
331 wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(this);
332#else
333 wxPyOORClientData_dtor(this);
1e7ecb7b 334#endif
4acff284
RD
335 }
336};
1e7ecb7b
RD
337
338//---------------------------------------------------------------------------
339// This class holds an instance of a Python Shadow Class object and assists
340// with looking up and invoking Python callback methods from C++ virtual
341// method redirections. For all classes which have virtuals which should be
342// overridable in wxPython, a new subclass is created that contains a
343// wxPyCallbackHelper.
344//
345
346class wxPyCallbackHelper {
347public:
348 wxPyCallbackHelper(const wxPyCallbackHelper& other);
349
350 wxPyCallbackHelper() {
351 m_class = NULL;
352 m_self = NULL;
353 m_lastFound = NULL;
354 m_incRef = FALSE;
355 }
356
357 ~wxPyCallbackHelper() {
358#ifdef wxPyUSE_EXPORT
359 wxPyCoreAPIPtr->p_wxPyCBH_delete(this);
360#else
361 wxPyCBH_delete(this);
362#endif
363 }
364
365 void setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
366 bool findCallback(const char* name) const;
367 int callCallback(PyObject* argTuple) const;
368 PyObject* callCallbackObj(PyObject* argTuple) const;
369
370private:
371 PyObject* m_self;
372 PyObject* m_class;
373 PyObject* m_lastFound;
374 int m_incRef;
375
376 friend void wxPyCBH_delete(wxPyCallbackHelper* cbh);
377};
378
379
0122b7e3 380void wxPyCBH_setCallbackInfo(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref);
1e7ecb7b
RD
381bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name);
382int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple);
383PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple);
384void wxPyCBH_delete(wxPyCallbackHelper* cbh);
385
386
387
900d9886 388
bb0054cd
RD
389//---------------------------------------------------------------------------
390// These macros are used to implement the virtual methods that should
391// redirect to a Python method if one exists. The names designate the
b1462dfa 392// return type, if any, as well as any parameter types.
bb0054cd
RD
393//---------------------------------------------------------------------------
394
f6bcfd97 395#define PYPRIVATE \
0122b7e3
RD
396 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
397 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
f6bcfd97 398 } \
c368d904 399 private: wxPyCallbackHelper m_myInst
efc5f224
RD
400
401//---------------------------------------------------------------------------
402
d559219f
RD
403#define DEC_PYCALLBACK__(CBNAME) \
404 void CBNAME(); \
405 void base_##CBNAME();
406
407
19a97bd6
RD
408#define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
409 void CLASS::CBNAME() { \
410 bool found; \
4268f798 411 wxPyBeginBlockThreads(); \
19a97bd6
RD
412 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
413 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 414 wxPyEndBlockThreads(); \
19a97bd6
RD
415 if (! found) \
416 PCLASS::CBNAME(); \
417 } \
418 void CLASS::base_##CBNAME() { \
419 PCLASS::CBNAME(); \
d559219f
RD
420 }
421
422//---------------------------------------------------------------------------
423
424#define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
425 bool CBNAME(int a, int b); \
426 bool base_##CBNAME(int a, int b);
427
428
429#define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
430 bool CLASS::CBNAME(int a, int b) { \
059a841c 431 bool rval=FALSE, found; \
4268f798 432 wxPyBeginBlockThreads(); \
19a97bd6 433 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1e7ecb7b 434 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
4268f798 435 wxPyEndBlockThreads(); \
19a97bd6 436 if (! found) \
d559219f 437 rval = PCLASS::CBNAME(a,b); \
d559219f 438 return rval; \
bb0054cd 439 } \
d559219f 440 bool CLASS::base_##CBNAME(int a, int b) { \
bb0054cd
RD
441 return PCLASS::CBNAME(a,b); \
442 }
443
444//---------------------------------------------------------------------------
445
c368d904
RD
446#define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
447 void CBNAME(int a, int b); \
448 void base_##CBNAME(int a, int b);
449
450
451#define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
452 void CLASS::CBNAME(int a, int b) { \
19a97bd6 453 bool found; \
4268f798 454 wxPyBeginBlockThreads(); \
19a97bd6
RD
455 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
456 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
4268f798 457 wxPyEndBlockThreads(); \
19a97bd6 458 if (! found) \
c368d904 459 PCLASS::CBNAME(a,b); \
c368d904
RD
460 } \
461 void CLASS::base_##CBNAME(int a, int b) { \
462 PCLASS::CBNAME(a,b); \
463 }
464
465//---------------------------------------------------------------------------
466
d559219f
RD
467#define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
468 bool CBNAME(int a); \
469 bool base_##CBNAME(int a);
470
471
472#define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
473 bool CLASS::CBNAME(int a) { \
059a841c 474 bool rval=FALSE, found; \
4268f798 475 wxPyBeginBlockThreads(); \
19a97bd6 476 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
059a841c 477 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
4268f798 478 wxPyEndBlockThreads(); \
19a97bd6 479 if (! found) \
d559219f 480 rval = PCLASS::CBNAME(a); \
d559219f 481 return rval; \
bb0054cd 482 } \
d559219f 483 bool CLASS::base_##CBNAME(int a) { \
bb0054cd
RD
484 return PCLASS::CBNAME(a); \
485 }
486
efc5f224
RD
487//---------------------------------------------------------------------------
488
d559219f
RD
489#define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
490 bool CBNAME(int a);
491
492
493#define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
494 bool CLASS::CBNAME(int a) { \
059a841c 495 bool rval=FALSE; \
4268f798 496 wxPyBeginBlockThreads(); \
19a97bd6 497 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1e7ecb7b 498 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
194fa2ac 499 else rval = FALSE; \
4268f798 500 wxPyEndBlockThreads(); \
d559219f 501 return rval; \
bb0054cd
RD
502 }
503
504
505//---------------------------------------------------------------------------
506
d559219f
RD
507#define DEC_PYCALLBACK__DC(CBNAME) \
508 void CBNAME(wxDC& a); \
509 void base_##CBNAME(wxDC& a);
510
511
19a97bd6
RD
512#define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
513 void CLASS::CBNAME(wxDC& a) { \
514 bool found; \
4268f798 515 wxPyBeginBlockThreads(); \
19a97bd6
RD
516 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
517 PyObject* obj = wxPyMake_wxObject(&a); \
518 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
519 Py_DECREF(obj); \
520 } \
4268f798 521 wxPyEndBlockThreads(); \
19a97bd6
RD
522 if (! found) \
523 PCLASS::CBNAME(a); \
524 } \
525 void CLASS::base_##CBNAME(wxDC& a) { \
526 PCLASS::CBNAME(a); \
bb0054cd
RD
527 }
528
efc5f224
RD
529
530
bb0054cd
RD
531//---------------------------------------------------------------------------
532
d559219f
RD
533#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
534 void CBNAME(wxDC& a, bool b); \
535 void base_##CBNAME(wxDC& a, bool b);
536
537
538#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
539 void CLASS::CBNAME(wxDC& a, bool b) { \
19a97bd6 540 bool found; \
4268f798 541 wxPyBeginBlockThreads(); \
19a97bd6
RD
542 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
543 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 544 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
de20db99
RD
545 Py_DECREF(obj); \
546 } \
4268f798 547 wxPyEndBlockThreads(); \
19a97bd6 548 if (! found) \
efc5f224
RD
549 PCLASS::CBNAME(a, b); \
550 } \
d559219f 551 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
efc5f224
RD
552 PCLASS::CBNAME(a, b); \
553 }
554
555//---------------------------------------------------------------------------
556
d559219f
RD
557#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
558 void CBNAME(wxDC& a, bool b); \
559 void base_##CBNAME(wxDC& a, bool b);
560
561
562#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
563 void CLASS::CBNAME(wxDC& a, bool b) { \
19a97bd6 564 bool found; \
4268f798 565 wxPyBeginBlockThreads(); \
19a97bd6
RD
566 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
567 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 568 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
de20db99
RD
569 Py_DECREF(obj); \
570 } \
4268f798 571 wxPyEndBlockThreads(); \
19a97bd6 572 if (! found) \
efc5f224
RD
573 PCLASS::CBNAME(a, b); \
574 } \
d559219f 575 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
efc5f224
RD
576 PCLASS::CBNAME(a, b); \
577 }
578
579//---------------------------------------------------------------------------
580
d559219f
RD
581#define DEC_PYCALLBACK__2DBL(CBNAME) \
582 void CBNAME(double a, double b); \
583 void base_##CBNAME(double a, double b);
584
585
19a97bd6
RD
586#define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
587 void CLASS::CBNAME(double a, double b) { \
588 bool found; \
4268f798 589 wxPyBeginBlockThreads(); \
19a97bd6
RD
590 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
591 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
4268f798 592 wxPyEndBlockThreads(); \
19a97bd6
RD
593 if (! found) \
594 PCLASS::CBNAME(a, b); \
595 } \
596 void CLASS::base_##CBNAME(double a, double b) { \
597 PCLASS::CBNAME(a, b); \
efc5f224
RD
598 }
599
600//---------------------------------------------------------------------------
601
d559219f
RD
602#define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
603 void CBNAME(double a, double b, int c, int d); \
604 void base_##CBNAME(double a, double b, int c, int d);
605
606
607#define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
608 void CLASS::CBNAME(double a, double b, int c, int d) { \
19a97bd6 609 bool found; \
4268f798 610 wxPyBeginBlockThreads(); \
19a97bd6
RD
611 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
612 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
efc5f224 613 a,b,c,d)); \
4268f798 614 wxPyEndBlockThreads(); \
19a97bd6 615 if (! found) \
efc5f224
RD
616 PCLASS::CBNAME(a, b, c, d); \
617 } \
d559219f 618 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
efc5f224
RD
619 PCLASS::CBNAME(a, b, c, d); \
620 }
621
622//---------------------------------------------------------------------------
623
19a97bd6 624#define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
d559219f
RD
625 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
626 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
627
628
629#define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
630 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
19a97bd6 631 bool found; \
4268f798 632 wxPyBeginBlockThreads(); \
19a97bd6
RD
633 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
634 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 635 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
de20db99
RD
636 Py_DECREF(obj); \
637 } \
4268f798 638 wxPyEndBlockThreads(); \
19a97bd6 639 if (! found) \
d559219f 640 PCLASS::CBNAME(a, b, c, d, e, f); \
d559219f
RD
641 } \
642 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
643 PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
644 }
645
646//---------------------------------------------------------------------------
647
d559219f
RD
648#define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
649 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
650 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
651
652
653#define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
654 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
19a97bd6 655 bool found; \
4268f798 656 wxPyBeginBlockThreads(); \
059a841c 657 bool rval=FALSE; \
19a97bd6
RD
658 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
659 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 660 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
de20db99
RD
661 Py_DECREF(obj); \
662 } \
4268f798 663 wxPyEndBlockThreads(); \
19a97bd6 664 if (! found) \
99a49d3e 665 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
99a49d3e 666 return rval; \
d559219f
RD
667 } \
668 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
669 return PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
670 }
671
672//---------------------------------------------------------------------------
673
d559219f
RD
674#define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
675 void CBNAME(bool a, double b, double c, int d, int e); \
676 void base_##CBNAME(bool a, double b, double c, int d, int e);
677
678
679#define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
680 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
19a97bd6 681 bool found; \
4268f798 682 wxPyBeginBlockThreads(); \
19a97bd6 683 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
f2e1c18a 684 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
d559219f 685 (int)a,b,c,d,e)); \
4268f798 686 wxPyEndBlockThreads(); \
19a97bd6 687 if (! found) \
d559219f 688 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
689 } \
690 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
691 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
692 }
693
694//---------------------------------------------------------------------------
695
19a97bd6 696#define DEC_PYCALLBACK__DC4DBL(CBNAME) \
d559219f
RD
697 void CBNAME(wxDC& a, double b, double c, double d, double e); \
698 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
699
700
701#define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
702 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
19a97bd6 703 bool found; \
4268f798 704 wxPyBeginBlockThreads(); \
19a97bd6
RD
705 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
706 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 707 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
de20db99
RD
708 Py_DECREF(obj); \
709 } \
4268f798 710 wxPyEndBlockThreads(); \
19a97bd6 711 if (! found) \
d559219f 712 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
713 } \
714 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
715 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
716 }
717
718//---------------------------------------------------------------------------
719
d559219f
RD
720#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
721 void CBNAME(wxDC& a, bool b); \
722 void base_##CBNAME(wxDC& a, bool b);
723
724
19a97bd6
RD
725#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
726 void CLASS::CBNAME(wxDC& a, bool b) { \
727 bool found; \
4268f798 728 wxPyBeginBlockThreads(); \
19a97bd6
RD
729 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
730 PyObject* obj = wxPyMake_wxObject(&a); \
731 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
732 Py_DECREF(obj); \
733 } \
4268f798 734 wxPyEndBlockThreads(); \
19a97bd6
RD
735 if (! found) \
736 PCLASS::CBNAME(a, b); \
737 } \
738 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
739 PCLASS::CBNAME(a, b); \
efc5f224 740 }
bb0054cd 741
7bf85405 742//---------------------------------------------------------------------------
7bf85405 743
d559219f
RD
744#define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
745 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
746 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
747
748
749#define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
750 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
751 int e, int f) { \
19a97bd6 752 bool found; \
4268f798 753 wxPyBeginBlockThreads(); \
19a97bd6
RD
754 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
755 PyObject* obj = wxPyMake_wxObject(a); \
1e7ecb7b 756 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
de20db99
RD
757 Py_DECREF(obj); \
758 } \
4268f798 759 wxPyEndBlockThreads(); \
19a97bd6 760 if (! found) \
d559219f 761 PCLASS::CBNAME(a, b, c, d, e, f); \
d559219f
RD
762 } \
763 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
764 int e, int f) { \
765 PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
766 }
767
768//---------------------------------------------------------------------------
769
d559219f
RD
770#define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
771 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
772 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
773
774
775#define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
776 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
19a97bd6 777 bool found; \
4268f798 778 wxPyBeginBlockThreads(); \
19a97bd6
RD
779 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
780 PyObject* obj = wxPyMake_wxObject(a); \
1e7ecb7b 781 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
de20db99
RD
782 Py_DECREF(obj); \
783 } \
4268f798 784 wxPyEndBlockThreads(); \
19a97bd6 785 if (! found) \
d559219f 786 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
787 } \
788 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
789 int d, int e) { \
790 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
791 }
792
793//---------------------------------------------------------------------------
794
d559219f
RD
795#define DEC_PYCALLBACK__2DBLINT(CBNAME) \
796 void CBNAME(double a, double b, int c); \
797 void base_##CBNAME(double a, double b, int c);
798
799
19a97bd6
RD
800#define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
801 void CLASS::CBNAME(double a, double b, int c) { \
802 bool found; \
4268f798 803 wxPyBeginBlockThreads(); \
19a97bd6
RD
804 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
805 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
4268f798 806 wxPyEndBlockThreads(); \
19a97bd6
RD
807 if (! found) \
808 PCLASS::CBNAME(a, b, c); \
809 } \
810 void CLASS::base_##CBNAME(double a, double b, int c) { \
811 PCLASS::CBNAME(a, b, c); \
efc5f224
RD
812 }
813
814//---------------------------------------------------------------------------
815
d559219f
RD
816#define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
817 void CBNAME(bool a, double b, double c, int d); \
818 void base_##CBNAME(bool a, double b, double c, int d);
819
820
821#define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
822 void CLASS::CBNAME(bool a, double b, double c, int d) { \
19a97bd6 823 bool found; \
4268f798 824 wxPyBeginBlockThreads(); \
19a97bd6
RD
825 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
826 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
4268f798 827 wxPyEndBlockThreads(); \
19a97bd6 828 if (! found) \
d559219f 829 PCLASS::CBNAME(a, b, c, d); \
d559219f
RD
830 } \
831 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
832 PCLASS::CBNAME(a, b, c, d); \
efc5f224
RD
833 }
834
835//---------------------------------------------------------------------------
836//---------------------------------------------------------------------------
389c5527
RD
837
838#define DEC_PYCALLBACK__STRING(CBNAME) \
839 void CBNAME(const wxString& a); \
840 void base_##CBNAME(const wxString& a);
841
19a97bd6
RD
842#define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
843 void CLASS::CBNAME(const wxString& a) { \
844 bool found; \
4268f798 845 wxPyBeginBlockThreads(); \
19a97bd6 846 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325 847 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
4268f798 848 wxPyEndBlockThreads(); \
19a97bd6
RD
849 if (! found) \
850 PCLASS::CBNAME(a); \
851 } \
852 void CLASS::base_##CBNAME(const wxString& a) { \
853 PCLASS::CBNAME(a); \
389c5527
RD
854 }
855
856//---------------------------------------------------------------------------
857
858#define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
859 bool CBNAME(const wxString& a); \
860 bool base_##CBNAME(const wxString& a);
861
389c5527
RD
862#define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
863 bool CLASS::CBNAME(const wxString& a) { \
059a841c 864 bool rval=FALSE; \
19a97bd6 865 bool found; \
4268f798 866 wxPyBeginBlockThreads(); \
19a97bd6 867 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325 868 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
4268f798 869 wxPyEndBlockThreads(); \
19a97bd6 870 if (! found) \
389c5527 871 rval = PCLASS::CBNAME(a); \
389c5527
RD
872 return rval; \
873 } \
874 bool CLASS::base_##CBNAME(const wxString& a) { \
875 return PCLASS::CBNAME(a); \
876 }
877
878//---------------------------------------------------------------------------
879
c368d904
RD
880#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
881 bool CBNAME(const wxString& a);
c8bc7bb8 882
19a97bd6
RD
883#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
884 bool CLASS::CBNAME(const wxString& a) { \
059a841c 885 bool rval=FALSE; \
4268f798 886 wxPyBeginBlockThreads(); \
19a97bd6 887 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
a541c325 888 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
4268f798 889 wxPyEndBlockThreads(); \
19a97bd6
RD
890 return rval; \
891 } \
c368d904
RD
892
893//---------------------------------------------------------------------------
894
895#define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
896 wxString CBNAME(const wxString& a); \
897
898#define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
899 wxString CLASS::CBNAME(const wxString& a) { \
900 wxString rval; \
a541c325 901 wxPyBeginBlockThreads(); \
19a97bd6 902 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 903 PyObject* ro; \
a541c325 904 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
c368d904 905 if (ro) { \
a541c325
RD
906 rval = Py2wxString(ro); \
907 Py_DECREF(ro); \
c368d904
RD
908 } \
909 } \
a541c325 910 wxPyEndBlockThreads(); \
c368d904
RD
911 return rval; \
912 } \
913
914//---------------------------------------------------------------------------
915
916#define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
917 wxString CBNAME(const wxString& a,int b); \
918
919#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
920 wxString CLASS::CBNAME(const wxString& a,int b) { \
921 wxString rval; \
4268f798 922 wxPyBeginBlockThreads(); \
19a97bd6 923 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 924 PyObject* ro; \
a541c325 925 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
c368d904 926 if (ro) { \
a541c325
RD
927 rval = Py2wxString(ro); \
928 Py_DECREF(ro); \
c368d904
RD
929 } \
930 } \
a541c325 931 wxPyEndBlockThreads(); \
c368d904
RD
932 return rval; \
933 } \
934
935//---------------------------------------------------------------------------
936
f0261a72
RD
937#define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
938 bool CBNAME(const wxString& a, const wxString& b); \
939 bool base_##CBNAME(const wxString& a, const wxString& b);
940
f0261a72
RD
941#define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
942 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
059a841c 943 bool rval=FALSE; \
19a97bd6 944 bool found; \
4268f798 945 wxPyBeginBlockThreads(); \
19a97bd6 946 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325
RD
947 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
948 wx2PyString(a), wx2PyString(b))); \
949 wxPyEndBlockThreads(); \
19a97bd6 950 if (! found) \
f0261a72 951 rval = PCLASS::CBNAME(a, b); \
f0261a72
RD
952 return rval; \
953 } \
954 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
955 return PCLASS::CBNAME(a, b); \
956 }
957
958//---------------------------------------------------------------------------
959
389c5527
RD
960#define DEC_PYCALLBACK_STRING_(CBNAME) \
961 wxString CBNAME(); \
962 wxString base_##CBNAME();
963
389c5527
RD
964#define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
965 wxString CLASS::CBNAME() { \
966 wxString rval; \
19a97bd6 967 bool found; \
4268f798 968 wxPyBeginBlockThreads(); \
19a97bd6 969 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
389c5527 970 PyObject* ro; \
19a97bd6 971 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97 972 if (ro) { \
a541c325
RD
973 rval = Py2wxString(ro); \
974 Py_DECREF(ro); \
f6bcfd97 975 } \
389c5527 976 } \
a541c325 977 wxPyEndBlockThreads(); \
19a97bd6 978 if (! found) \
b1462dfa 979 rval = PCLASS::CBNAME(); \
389c5527
RD
980 return rval; \
981 } \
b1462dfa
RD
982 wxString CLASS::base_##CBNAME() { \
983 return PCLASS::CBNAME(); \
389c5527
RD
984 }
985
986//---------------------------------------------------------------------------
987
988#define DEC_PYCALLBACK_STRING__pure(CBNAME) \
989 wxString CBNAME();
990
389c5527
RD
991#define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
992 wxString CLASS::CBNAME() { \
993 wxString rval; \
4268f798 994 wxPyBeginBlockThreads(); \
19a97bd6 995 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
389c5527 996 PyObject* ro; \
19a97bd6 997 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97 998 if (ro) { \
a541c325
RD
999 rval = Py2wxString(ro); \
1000 Py_DECREF(ro); \
f6bcfd97 1001 } \
389c5527 1002 } \
a541c325 1003 wxPyEndBlockThreads(); \
389c5527
RD
1004 return rval; \
1005 }
1006
1007//---------------------------------------------------------------------------
1008
1009#define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1010 bool CBNAME(const wxHtmlTag& a); \
1011
1012
1013#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1014 bool CLASS::CBNAME(const wxHtmlTag& a) { \
059a841c 1015 bool rval=FALSE; \
4268f798 1016 wxPyBeginBlockThreads(); \
19a97bd6
RD
1017 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1018 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1019 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
de20db99
RD
1020 Py_DECREF(obj); \
1021 } \
4268f798 1022 wxPyEndBlockThreads(); \
389c5527
RD
1023 return rval; \
1024 }
1025
0122b7e3
RD
1026//---------------------------------------------------------------------------
1027
1028#define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1029 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1030 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1031
1032#define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1033 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
0122b7e3 1034 bool found; \
4268f798 1035 wxPyBeginBlockThreads(); \
0122b7e3
RD
1036 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1037 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1038 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1039 Py_DECREF(obj); \
1040 } \
4268f798 1041 wxPyEndBlockThreads(); \
0122b7e3
RD
1042 if (! found) \
1043 PCLASS::CBNAME(cell, x, y); \
1044 } \
1045 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1046 PCLASS::CBNAME(cell, x, y); \
1047 }
1048
1049
1050//---------------------------------------------------------------------------
1051
1052#define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1053 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1054 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1055
1056#define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1057 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1058 bool found; \
4268f798 1059 wxPyBeginBlockThreads(); \
0122b7e3
RD
1060 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1061 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1062 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1063 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1064 Py_DECREF(obj); \
1065 Py_DECREF(o2); \
1066 } \
4268f798 1067 wxPyEndBlockThreads(); \
0122b7e3
RD
1068 if (! found) \
1069 PCLASS::CBNAME(cell, x, y, e); \
1070 } \
1071 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1072 PCLASS::CBNAME(cell, x, y, e); \
1073 }
1074
1075
1076
389c5527 1077//---------------------------------------------------------------------------
2f90df85
RD
1078
1079#define DEC_PYCALLBACK___pure(CBNAME) \
1080 void CBNAME(); \
1081
1082
1083#define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1084 void CLASS::CBNAME() { \
4268f798 1085 wxPyBeginBlockThreads(); \
19a97bd6
RD
1086 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1087 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 1088 wxPyEndBlockThreads(); \
2f90df85
RD
1089 }
1090
1091//---------------------------------------------------------------------------
1092
1093#define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1094 wxSize CBNAME(); \
1095
1096
1097#define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1098 wxSize CLASS::CBNAME() { \
db0ff83e 1099 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
2f90df85 1100 wxSize rval(0,0); \
db0ff83e 1101 wxPyBeginBlockThreads(); \
19a97bd6 1102 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2f90df85
RD
1103 PyObject* ro; \
1104 wxSize* ptr; \
19a97bd6 1105 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97
BP
1106 if (ro) { \
1107 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1108 rval = *ptr; \
db0ff83e
RD
1109 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1110 PyObject* o1 = PySequence_GetItem(ro, 0); \
1111 PyObject* o2 = PySequence_GetItem(ro, 1); \
1112 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1113 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1114 else \
1115 PyErr_SetString(PyExc_TypeError, errmsg); \
1116 Py_DECREF(o1); \
1117 Py_DECREF(o2); \
1118 } \
1119 else { \
1120 PyErr_SetString(PyExc_TypeError, errmsg); \
1121 } \
f6bcfd97
BP
1122 Py_DECREF(ro); \
1123 } \
2f90df85 1124 } \
db0ff83e 1125 wxPyEndBlockThreads(); \
2f90df85
RD
1126 return rval; \
1127 }
1128
1129//---------------------------------------------------------------------------
1130
1131#define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1132 bool CBNAME(wxWindow* a); \
1133 bool base_##CBNAME(wxWindow* a);
1134
1135
19a97bd6
RD
1136#define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1137 bool CLASS::CBNAME(wxWindow* a) { \
059a841c 1138 bool rval=FALSE; \
19a97bd6 1139 bool found; \
4268f798 1140 wxPyBeginBlockThreads(); \
19a97bd6
RD
1141 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1142 PyObject* obj = wxPyMake_wxObject(a); \
1143 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1144 Py_DECREF(obj); \
1145 } \
4268f798 1146 wxPyEndBlockThreads(); \
19a97bd6
RD
1147 if (! found) \
1148 rval = PCLASS::CBNAME(a); \
1149 return rval; \
1150 } \
1151 bool CLASS::base_##CBNAME(wxWindow* a) { \
1152 return PCLASS::CBNAME(a); \
2f90df85
RD
1153 }
1154
389c5527 1155//---------------------------------------------------------------------------
2f90df85
RD
1156
1157#define DEC_PYCALLBACK_BOOL_(CBNAME) \
1158 bool CBNAME(); \
1159 bool base_##CBNAME();
1160
1161
19a97bd6
RD
1162#define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1163 bool CLASS::CBNAME() { \
059a841c 1164 bool rval=FALSE; \
19a97bd6 1165 bool found; \
4268f798 1166 wxPyBeginBlockThreads(); \
19a97bd6
RD
1167 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1168 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 1169 wxPyEndBlockThreads(); \
19a97bd6
RD
1170 if (! found) \
1171 rval = PCLASS::CBNAME(); \
1172 return rval; \
1173 } \
1174 bool CLASS::base_##CBNAME() { \
1175 return PCLASS::CBNAME(); \
2f90df85
RD
1176 }
1177
b1462dfa
RD
1178//---------------------------------------------------------------------------
1179
19a97bd6
RD
1180#define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1181 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
b1462dfa
RD
1182 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1183
1184
19a97bd6
RD
1185#define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1186 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
059a841c 1187 int rval=0; \
19a97bd6 1188 bool found; \
cac344f6 1189 wxPyBeginBlockThreads(); \
19a97bd6 1190 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1e7ecb7b 1191 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
cac344f6 1192 wxPyEndBlockThreads(); \
19a97bd6
RD
1193 if (! found) \
1194 rval = PCLASS::CBNAME(a, b, c); \
1195 return (wxDragResult)rval; \
1196 } \
1197 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1198 return PCLASS::CBNAME(a, b, c); \
b1462dfa
RD
1199 }
1200
1201//---------------------------------------------------------------------------
1202
c368d904
RD
1203#define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1204 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1205
1206#define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1207 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
cac344f6 1208 wxPyBeginBlockThreads(); \
c368d904 1209 wxFSFile* rval=0; \
19a97bd6 1210 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 1211 PyObject* ro; \
19a97bd6 1212 PyObject* obj = wxPyMake_wxObject(&a); \
a541c325 1213 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
cac344f6 1214 obj, wx2PyString(b))); \
c368d904
RD
1215 if (ro) { \
1216 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1217 Py_DECREF(ro); \
1218 } \
de20db99
RD
1219 Py_DECREF(obj); \
1220 } \
cac344f6 1221 wxPyEndBlockThreads(); \
c368d904
RD
1222 return rval; \
1223 };
1224
1225//---------------------------------------------------------------------------
1226
b1462dfa
RD
1227#define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1228 bool CBNAME(wxDragResult a); \
1229 bool base_##CBNAME(wxDragResult a);
1230
1231
1232#define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1233 bool CLASS::CBNAME(wxDragResult a) { \
059a841c 1234 bool rval=FALSE; \
19a97bd6 1235 bool found; \
a541c325 1236 wxPyBeginBlockThreads(); \
19a97bd6
RD
1237 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1238 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
a541c325 1239 wxPyEndBlockThreads(); \
19a97bd6 1240 if (! found) \
b1462dfa 1241 rval = PCLASS::CBNAME(a); \
b1462dfa
RD
1242 return rval; \
1243 } \
1244 bool CLASS::base_##CBNAME(wxDragResult a) { \
1245 return PCLASS::CBNAME(a); \
1246 }
1247
1248//---------------------------------------------------------------------------
1249
1250#define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1251 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1252
1253
1254#define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1255 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
a541c325 1256 wxPyBeginBlockThreads(); \
059a841c 1257 int rval=0; \
19a97bd6 1258 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1e7ecb7b 1259 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
a541c325 1260 wxPyEndBlockThreads(); \
b1462dfa
RD
1261 return (wxDragResult)rval; \
1262 } \
1263
1264//---------------------------------------------------------------------------
1265
1266#define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1267 bool CBNAME(int a, int b, const wxString& c);
1268
b1462dfa
RD
1269#define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1270 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
059a841c 1271 bool rval=FALSE; \
a541c325 1272 wxPyBeginBlockThreads(); \
19a97bd6 1273 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
a541c325
RD
1274 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1275 wxPyEndBlockThreads(); \
b1462dfa
RD
1276 return rval; \
1277 } \
1278
1279//---------------------------------------------------------------------------
1280
1281#define DEC_PYCALLBACK_SIZET_(CBNAME) \
1282 size_t CBNAME(); \
1283 size_t base_##CBNAME();
1284
1285
1286#define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1287 size_t CLASS::CBNAME() { \
059a841c 1288 size_t rval=0; \
19a97bd6 1289 bool found; \
a541c325 1290 wxPyBeginBlockThreads(); \
19a97bd6
RD
1291 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1292 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
a541c325 1293 wxPyEndBlockThreads(); \
19a97bd6 1294 if (! found) \
b1462dfa 1295 rval = PCLASS::CBNAME(); \
b1462dfa
RD
1296 return rval; \
1297 } \
1298 size_t CLASS::base_##CBNAME() { \
1299 return PCLASS::CBNAME(); \
1300 }
1301
1302//---------------------------------------------------------------------------
1303
c7e7022c
RD
1304#define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1305 wxDataFormat CBNAME(size_t a); \
1306 wxDataFormat base_##CBNAME(size_t a);
b1462dfa
RD
1307
1308
1309#define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1310 wxDataFormat CLASS::CBNAME(size_t a) { \
059a841c 1311 wxDataFormat rval=0; \
19a97bd6 1312 bool found; \
a541c325 1313 wxPyBeginBlockThreads(); \
19a97bd6 1314 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
b1462dfa
RD
1315 PyObject* ro; \
1316 wxDataFormat* ptr; \
c7e7022c 1317 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
f6bcfd97
BP
1318 if (ro) { \
1319 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1320 rval = *ptr; \
1321 Py_DECREF(ro); \
1322 } \
b1462dfa 1323 } \
a541c325 1324 wxPyEndBlockThreads(); \
19a97bd6 1325 if (! found) \
b1462dfa 1326 rval = PCLASS::CBNAME(a); \
b1462dfa
RD
1327 return rval; \
1328 } \
1329 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1330 return PCLASS::CBNAME(a); \
1331 }
1332
389c5527 1333//---------------------------------------------------------------------------
f6bcfd97
BP
1334
1335#define DEC_PYCALLBACK__constany(CBNAME, Type) \
1336 void CBNAME(const Type& a); \
1337 void base_##CBNAME(const Type& a);
1338
1339
19a97bd6
RD
1340#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1341 void CLASS::CBNAME(const Type& a) { \
1342 bool found; \
a541c325 1343 wxPyBeginBlockThreads(); \
19a97bd6
RD
1344 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1345 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1346 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1347 Py_DECREF(obj); \
1348 } \
a541c325 1349 wxPyEndBlockThreads(); \
19a97bd6
RD
1350 if (! found) \
1351 PCLASS::CBNAME(a); \
1352 } \
1353 void CLASS::base_##CBNAME(const Type& a) { \
1354 PCLASS::CBNAME(a); \
f6bcfd97
BP
1355 }
1356
1357
1358//---------------------------------------------------------------------------
1359
1360#define DEC_PYCALLBACK__any(CBNAME, Type) \
1361 void CBNAME(Type& a); \
1362 void base_##CBNAME(Type& a);
1363
1364
19a97bd6
RD
1365#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1366 void CLASS::CBNAME(Type& a) { \
1367 bool found; \
a541c325 1368 wxPyBeginBlockThreads(); \
19a97bd6
RD
1369 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1370 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1371 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1372 Py_DECREF(obj); \
1373 } \
a541c325 1374 wxPyEndBlockThreads(); \
19a97bd6
RD
1375 if (! found) \
1376 PCLASS::CBNAME(a); \
1377 } \
1378 void CLASS::base_##CBNAME(Type& a) { \
1379 PCLASS::CBNAME(a); \
f6bcfd97
BP
1380 }
1381
efc5f224 1382//---------------------------------------------------------------------------
f6bcfd97
BP
1383
1384#define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1385 bool CBNAME(Type& a); \
1386 bool base_##CBNAME(Type& a);
1387
1388
19a97bd6
RD
1389#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1390 bool CLASS::CBNAME(Type& a) { \
36fd8ec3 1391 bool rv=FALSE; \
19a97bd6 1392 bool found; \
a541c325 1393 wxPyBeginBlockThreads(); \
19a97bd6
RD
1394 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1395 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1396 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1397 Py_DECREF(obj); \
1398 } \
a541c325 1399 wxPyEndBlockThreads(); \
19a97bd6
RD
1400 if (! found) \
1401 rv = PCLASS::CBNAME(a); \
1402 return rv; \
1403 } \
1404 bool CLASS::base_##CBNAME(Type& a) { \
1405 return PCLASS::CBNAME(a); \
f6bcfd97
BP
1406 }
1407
efc5f224
RD
1408//---------------------------------------------------------------------------
1409
c7e7022c
RD
1410#define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1411 wxString CBNAME(long a, long b) const; \
1412 wxString base_##CBNAME(long a, long b)const ;
1413
c7e7022c
RD
1414#define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1415 wxString CLASS::CBNAME(long a, long b) const { \
1416 wxString rval; \
19a97bd6 1417 bool found; \
a541c325 1418 wxPyBeginBlockThreads(); \
19a97bd6 1419 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1420 PyObject* ro; \
1421 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1422 if (ro) { \
a541c325
RD
1423 rval = Py2wxString(ro); \
1424 Py_DECREF(ro); \
c7e7022c
RD
1425 } \
1426 } \
a541c325 1427 wxPyEndBlockThreads(); \
19a97bd6 1428 if (! found) \
c7e7022c 1429 rval = PCLASS::CBNAME(a,b); \
c7e7022c
RD
1430 return rval; \
1431 } \
1432 wxString CLASS::base_##CBNAME(long a, long b) const { \
1433 return PCLASS::CBNAME(a,b); \
1434 }
1435
1436//---------------------------------------------------------------------------
1437
1438#define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1439 int CBNAME(long a) const; \
1440 int base_##CBNAME(long a)const ;
1441
1442
1443#define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1444 int CLASS::CBNAME(long a) const { \
1445 int rval=-1; \
19a97bd6 1446 bool found; \
a541c325 1447 wxPyBeginBlockThreads(); \
19a97bd6 1448 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1449 PyObject* ro; \
1450 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1451 if (ro) { \
1452 rval = PyInt_AsLong(ro); \
1453 Py_DECREF(ro); \
1454 } \
1455 } \
a541c325 1456 wxPyEndBlockThreads(); \
19a97bd6 1457 if (! found) \
c7e7022c 1458 rval = PCLASS::CBNAME(a); \
c7e7022c
RD
1459 return rval; \
1460 } \
1461 int CLASS::base_##CBNAME(long a) const { \
1462 return PCLASS::CBNAME(a); \
1463 }
1464
1465
1466//---------------------------------------------------------------------------
1467
1468#define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
00b6c4e3 1469 wxListItemAttr* CBNAME(long a) const; \
c7e7022c
RD
1470 wxListItemAttr* base_##CBNAME(long a);
1471
1472
1473#define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
00b6c4e3 1474 wxListItemAttr *CLASS::CBNAME(long a) const { \
c7e7022c 1475 wxListItemAttr *rval = NULL; \
19a97bd6 1476 bool found; \
a541c325 1477 wxPyBeginBlockThreads(); \
19a97bd6 1478 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1479 PyObject* ro; \
1480 wxListItemAttr* ptr; \
1481 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1482 if (ro) { \
1483 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1484 rval = ptr; \
1485 Py_DECREF(ro); \
1486 } \
1487 } \
a541c325 1488 wxPyEndBlockThreads(); \
19a97bd6 1489 if (! found) \
c7e7022c 1490 rval = PCLASS::CBNAME(a); \
c7e7022c
RD
1491 return rval; \
1492 } \
1493 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1494 return PCLASS::CBNAME(a); \
1495 }
1496
1497//---------------------------------------------------------------------------
1498
a541c325
RD
1499#define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1500 bool CBNAME(wxMouseEvent& e); \
0122b7e3
RD
1501 bool base_##CBNAME(wxMouseEvent& e);
1502
a541c325
RD
1503#define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1504 bool CLASS::CBNAME(wxMouseEvent& e) { \
1505 bool rval=FALSE; \
1506 bool found; \
1507 wxPyBeginBlockThreads(); \
1508 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1509 PyObject* ro; \
1510 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1511 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1512 if (ro) { \
1513 rval = PyInt_AsLong(ro); \
1514 Py_DECREF(ro); \
1515 } \
1516 Py_DECREF(obj); \
1517 } \
1518 wxPyEndBlockThreads(); \
1519 if (! found) \
1520 return PCLASS::CBNAME(e); \
1521 return rval; \
1522 } \
1523 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1524 return PCLASS::CBNAME(e); \
0122b7e3
RD
1525 }
1526
1527
1528//---------------------------------------------------------------------------
1529
7bf85405 1530#endif