]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/helpers.h
A few little tweaks, reswigged code for wxMac
[wxWidgets.git] / wxPython / src / helpers.h
CommitLineData
b1462dfa 1////////////////////////////////////////////////////////////////////////////
7bf85405 2// Name: helpers.h
a2426843 3// Purpose: Helper functions/classes for the wxPython extension module
7bf85405
RD
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
a2426843
RD
281// Notice that this is static, not extern. This is by design, each module
282// needs one, but doesn't have to use it.
283static wxPyCoreAPI* wxPyCoreAPIPtr = NULL;
4acff284
RD
284#endif
285
286
287//---------------------------------------------------------------------------
288
289
290class wxPyUserData : public wxObject {
291public:
292 wxPyUserData(PyObject* obj) {
293 m_obj = obj;
294 Py_INCREF(m_obj);
295 }
296
297 ~wxPyUserData() {
298#ifdef wxPyUSE_EXPORT
299 wxPyCoreAPIPtr->p_wxPyUserData_dtor(this);
300#else
301 wxPyUserData_dtor(this);
302#endif
303 }
304 PyObject* m_obj;
305};
306
307
308class wxPyClientData : public wxClientData {
309public:
310 wxPyClientData(PyObject* obj) {
311 m_obj = obj;
312 Py_INCREF(m_obj);
313 }
314
315 ~wxPyClientData() {
316#ifdef wxPyUSE_EXPORT
317 wxPyCoreAPIPtr->p_wxPyClientData_dtor(this);
318#else
319 wxPyClientData_dtor(this);
320#endif
321 }
322 PyObject* m_obj;
1e7ecb7b
RD
323};
324
4acff284
RD
325
326class wxPyOORClientData : public wxPyClientData {
327public:
328 wxPyOORClientData(PyObject* obj)
329 : wxPyClientData(obj) {}
330
331 ~wxPyOORClientData() {
1e7ecb7b 332#ifdef wxPyUSE_EXPORT
4acff284
RD
333 wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(this);
334#else
335 wxPyOORClientData_dtor(this);
1e7ecb7b 336#endif
4acff284
RD
337 }
338};
1e7ecb7b
RD
339
340//---------------------------------------------------------------------------
341// This class holds an instance of a Python Shadow Class object and assists
342// with looking up and invoking Python callback methods from C++ virtual
343// method redirections. For all classes which have virtuals which should be
344// overridable in wxPython, a new subclass is created that contains a
345// wxPyCallbackHelper.
346//
347
348class wxPyCallbackHelper {
349public:
350 wxPyCallbackHelper(const wxPyCallbackHelper& other);
351
352 wxPyCallbackHelper() {
353 m_class = NULL;
354 m_self = NULL;
355 m_lastFound = NULL;
356 m_incRef = FALSE;
357 }
358
359 ~wxPyCallbackHelper() {
360#ifdef wxPyUSE_EXPORT
361 wxPyCoreAPIPtr->p_wxPyCBH_delete(this);
362#else
363 wxPyCBH_delete(this);
364#endif
365 }
366
367 void setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
368 bool findCallback(const char* name) const;
369 int callCallback(PyObject* argTuple) const;
370 PyObject* callCallbackObj(PyObject* argTuple) const;
371
372private:
373 PyObject* m_self;
374 PyObject* m_class;
375 PyObject* m_lastFound;
376 int m_incRef;
377
378 friend void wxPyCBH_delete(wxPyCallbackHelper* cbh);
379};
380
381
0122b7e3 382void wxPyCBH_setCallbackInfo(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref);
1e7ecb7b
RD
383bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name);
384int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple);
385PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple);
386void wxPyCBH_delete(wxPyCallbackHelper* cbh);
387
388
389
900d9886 390
bb0054cd
RD
391//---------------------------------------------------------------------------
392// These macros are used to implement the virtual methods that should
393// redirect to a Python method if one exists. The names designate the
b1462dfa 394// return type, if any, as well as any parameter types.
bb0054cd
RD
395//---------------------------------------------------------------------------
396
f6bcfd97 397#define PYPRIVATE \
0122b7e3
RD
398 void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \
399 wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \
f6bcfd97 400 } \
c368d904 401 private: wxPyCallbackHelper m_myInst
efc5f224
RD
402
403//---------------------------------------------------------------------------
404
d559219f
RD
405#define DEC_PYCALLBACK__(CBNAME) \
406 void CBNAME(); \
407 void base_##CBNAME();
408
409
19a97bd6
RD
410#define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \
411 void CLASS::CBNAME() { \
412 bool found; \
4268f798 413 wxPyBeginBlockThreads(); \
19a97bd6
RD
414 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
415 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 416 wxPyEndBlockThreads(); \
19a97bd6
RD
417 if (! found) \
418 PCLASS::CBNAME(); \
419 } \
420 void CLASS::base_##CBNAME() { \
421 PCLASS::CBNAME(); \
d559219f
RD
422 }
423
424//---------------------------------------------------------------------------
425
426#define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \
427 bool CBNAME(int a, int b); \
428 bool base_##CBNAME(int a, int b);
429
430
431#define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \
432 bool CLASS::CBNAME(int a, int b) { \
059a841c 433 bool rval=FALSE, found; \
4268f798 434 wxPyBeginBlockThreads(); \
19a97bd6 435 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1e7ecb7b 436 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
4268f798 437 wxPyEndBlockThreads(); \
19a97bd6 438 if (! found) \
d559219f 439 rval = PCLASS::CBNAME(a,b); \
d559219f 440 return rval; \
bb0054cd 441 } \
d559219f 442 bool CLASS::base_##CBNAME(int a, int b) { \
bb0054cd
RD
443 return PCLASS::CBNAME(a,b); \
444 }
445
446//---------------------------------------------------------------------------
447
c368d904
RD
448#define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \
449 void CBNAME(int a, int b); \
450 void base_##CBNAME(int a, int b);
451
452
453#define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \
454 void CLASS::CBNAME(int a, int b) { \
19a97bd6 455 bool found; \
4268f798 456 wxPyBeginBlockThreads(); \
19a97bd6
RD
457 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
458 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \
4268f798 459 wxPyEndBlockThreads(); \
19a97bd6 460 if (! found) \
c368d904 461 PCLASS::CBNAME(a,b); \
c368d904
RD
462 } \
463 void CLASS::base_##CBNAME(int a, int b) { \
464 PCLASS::CBNAME(a,b); \
465 }
466
467//---------------------------------------------------------------------------
468
d559219f
RD
469#define DEC_PYCALLBACK_BOOL_INT(CBNAME) \
470 bool CBNAME(int a); \
471 bool base_##CBNAME(int a);
472
473
474#define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \
475 bool CLASS::CBNAME(int a) { \
059a841c 476 bool rval=FALSE, found; \
4268f798 477 wxPyBeginBlockThreads(); \
19a97bd6 478 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
059a841c 479 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\
4268f798 480 wxPyEndBlockThreads(); \
19a97bd6 481 if (! found) \
d559219f 482 rval = PCLASS::CBNAME(a); \
d559219f 483 return rval; \
bb0054cd 484 } \
d559219f 485 bool CLASS::base_##CBNAME(int a) { \
bb0054cd
RD
486 return PCLASS::CBNAME(a); \
487 }
488
efc5f224
RD
489//---------------------------------------------------------------------------
490
d559219f
RD
491#define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \
492 bool CBNAME(int a);
493
494
495#define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \
496 bool CLASS::CBNAME(int a) { \
059a841c 497 bool rval=FALSE; \
4268f798 498 wxPyBeginBlockThreads(); \
19a97bd6 499 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1e7ecb7b 500 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \
194fa2ac 501 else rval = FALSE; \
4268f798 502 wxPyEndBlockThreads(); \
d559219f 503 return rval; \
bb0054cd
RD
504 }
505
506
507//---------------------------------------------------------------------------
508
d559219f
RD
509#define DEC_PYCALLBACK__DC(CBNAME) \
510 void CBNAME(wxDC& a); \
511 void base_##CBNAME(wxDC& a);
512
513
19a97bd6
RD
514#define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \
515 void CLASS::CBNAME(wxDC& a) { \
516 bool found; \
4268f798 517 wxPyBeginBlockThreads(); \
19a97bd6
RD
518 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
519 PyObject* obj = wxPyMake_wxObject(&a); \
520 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
521 Py_DECREF(obj); \
522 } \
4268f798 523 wxPyEndBlockThreads(); \
19a97bd6
RD
524 if (! found) \
525 PCLASS::CBNAME(a); \
526 } \
527 void CLASS::base_##CBNAME(wxDC& a) { \
528 PCLASS::CBNAME(a); \
bb0054cd
RD
529 }
530
efc5f224
RD
531
532
bb0054cd
RD
533//---------------------------------------------------------------------------
534
d559219f
RD
535#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
536 void CBNAME(wxDC& a, bool b); \
537 void base_##CBNAME(wxDC& a, bool b);
538
539
540#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
541 void CLASS::CBNAME(wxDC& a, bool b) { \
19a97bd6 542 bool found; \
4268f798 543 wxPyBeginBlockThreads(); \
19a97bd6
RD
544 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
545 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 546 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
de20db99
RD
547 Py_DECREF(obj); \
548 } \
4268f798 549 wxPyEndBlockThreads(); \
19a97bd6 550 if (! found) \
efc5f224
RD
551 PCLASS::CBNAME(a, b); \
552 } \
d559219f 553 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
efc5f224
RD
554 PCLASS::CBNAME(a, b); \
555 }
556
557//---------------------------------------------------------------------------
558
d559219f
RD
559#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
560 void CBNAME(wxDC& a, bool b); \
561 void base_##CBNAME(wxDC& a, bool b);
562
563
564#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
565 void CLASS::CBNAME(wxDC& a, bool b) { \
19a97bd6 566 bool found; \
4268f798 567 wxPyBeginBlockThreads(); \
19a97bd6
RD
568 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
569 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 570 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
de20db99
RD
571 Py_DECREF(obj); \
572 } \
4268f798 573 wxPyEndBlockThreads(); \
19a97bd6 574 if (! found) \
efc5f224
RD
575 PCLASS::CBNAME(a, b); \
576 } \
d559219f 577 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
efc5f224
RD
578 PCLASS::CBNAME(a, b); \
579 }
580
581//---------------------------------------------------------------------------
582
d559219f
RD
583#define DEC_PYCALLBACK__2DBL(CBNAME) \
584 void CBNAME(double a, double b); \
585 void base_##CBNAME(double a, double b);
586
587
19a97bd6
RD
588#define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \
589 void CLASS::CBNAME(double a, double b) { \
590 bool found; \
4268f798 591 wxPyBeginBlockThreads(); \
19a97bd6
RD
592 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
593 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \
4268f798 594 wxPyEndBlockThreads(); \
19a97bd6
RD
595 if (! found) \
596 PCLASS::CBNAME(a, b); \
597 } \
598 void CLASS::base_##CBNAME(double a, double b) { \
599 PCLASS::CBNAME(a, b); \
efc5f224
RD
600 }
601
602//---------------------------------------------------------------------------
603
d559219f
RD
604#define DEC_PYCALLBACK__2DBL2INT(CBNAME) \
605 void CBNAME(double a, double b, int c, int d); \
606 void base_##CBNAME(double a, double b, int c, int d);
607
608
609#define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \
610 void CLASS::CBNAME(double a, double b, int c, int d) { \
19a97bd6 611 bool found; \
4268f798 612 wxPyBeginBlockThreads(); \
19a97bd6
RD
613 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
614 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \
efc5f224 615 a,b,c,d)); \
4268f798 616 wxPyEndBlockThreads(); \
19a97bd6 617 if (! found) \
efc5f224
RD
618 PCLASS::CBNAME(a, b, c, d); \
619 } \
d559219f 620 void CLASS::base_##CBNAME(double a, double b, int c, int d) { \
efc5f224
RD
621 PCLASS::CBNAME(a, b, c, d); \
622 }
623
624//---------------------------------------------------------------------------
625
19a97bd6 626#define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \
d559219f
RD
627 void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
628 void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
629
630
631#define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
632 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
19a97bd6 633 bool found; \
4268f798 634 wxPyBeginBlockThreads(); \
19a97bd6
RD
635 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
636 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 637 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \
de20db99
RD
638 Py_DECREF(obj); \
639 } \
4268f798 640 wxPyEndBlockThreads(); \
19a97bd6 641 if (! found) \
d559219f 642 PCLASS::CBNAME(a, b, c, d, e, f); \
d559219f
RD
643 } \
644 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
645 PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
646 }
647
648//---------------------------------------------------------------------------
649
d559219f
RD
650#define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \
651 bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \
652 bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f);
653
654
655#define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \
656 bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \
19a97bd6 657 bool found; \
4268f798 658 wxPyBeginBlockThreads(); \
059a841c 659 bool rval=FALSE; \
19a97bd6
RD
660 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
661 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 662 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\
de20db99
RD
663 Py_DECREF(obj); \
664 } \
4268f798 665 wxPyEndBlockThreads(); \
19a97bd6 666 if (! found) \
99a49d3e 667 rval = PCLASS::CBNAME(a, b, c, d, e, f); \
99a49d3e 668 return rval; \
d559219f
RD
669 } \
670 bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\
671 return PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
672 }
673
674//---------------------------------------------------------------------------
675
d559219f
RD
676#define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \
677 void CBNAME(bool a, double b, double c, int d, int e); \
678 void base_##CBNAME(bool a, double b, double c, int d, int e);
679
680
681#define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
682 void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \
19a97bd6 683 bool found; \
4268f798 684 wxPyBeginBlockThreads(); \
19a97bd6 685 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
f2e1c18a 686 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \
d559219f 687 (int)a,b,c,d,e)); \
4268f798 688 wxPyEndBlockThreads(); \
19a97bd6 689 if (! found) \
d559219f 690 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
691 } \
692 void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \
693 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
694 }
695
696//---------------------------------------------------------------------------
697
19a97bd6 698#define DEC_PYCALLBACK__DC4DBL(CBNAME) \
d559219f
RD
699 void CBNAME(wxDC& a, double b, double c, double d, double e); \
700 void base_##CBNAME(wxDC& a, double b, double c, double d, double e);
701
702
703#define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \
704 void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \
19a97bd6 705 bool found; \
4268f798 706 wxPyBeginBlockThreads(); \
19a97bd6
RD
707 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
708 PyObject* obj = wxPyMake_wxObject(&a); \
1e7ecb7b 709 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \
de20db99
RD
710 Py_DECREF(obj); \
711 } \
4268f798 712 wxPyEndBlockThreads(); \
19a97bd6 713 if (! found) \
d559219f 714 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
715 } \
716 void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\
717 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
718 }
719
720//---------------------------------------------------------------------------
721
d559219f
RD
722#define DEC_PYCALLBACK__DCBOOL(CBNAME) \
723 void CBNAME(wxDC& a, bool b); \
724 void base_##CBNAME(wxDC& a, bool b);
725
726
19a97bd6
RD
727#define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \
728 void CLASS::CBNAME(wxDC& a, bool b) { \
729 bool found; \
4268f798 730 wxPyBeginBlockThreads(); \
19a97bd6
RD
731 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
732 PyObject* obj = wxPyMake_wxObject(&a); \
733 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \
734 Py_DECREF(obj); \
735 } \
4268f798 736 wxPyEndBlockThreads(); \
19a97bd6
RD
737 if (! found) \
738 PCLASS::CBNAME(a, b); \
739 } \
740 void CLASS::base_##CBNAME(wxDC& a, bool b) { \
741 PCLASS::CBNAME(a, b); \
efc5f224 742 }
bb0054cd 743
7bf85405 744//---------------------------------------------------------------------------
7bf85405 745
d559219f
RD
746#define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \
747 void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \
748 void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f);
749
750
751#define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \
752 void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \
753 int e, int f) { \
19a97bd6 754 bool found; \
4268f798 755 wxPyBeginBlockThreads(); \
19a97bd6
RD
756 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
757 PyObject* obj = wxPyMake_wxObject(a); \
1e7ecb7b 758 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\
de20db99
RD
759 Py_DECREF(obj); \
760 } \
4268f798 761 wxPyEndBlockThreads(); \
19a97bd6 762 if (! found) \
d559219f 763 PCLASS::CBNAME(a, b, c, d, e, f); \
d559219f
RD
764 } \
765 void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \
766 int e, int f) { \
767 PCLASS::CBNAME(a, b, c, d, e, f); \
efc5f224
RD
768 }
769
770//---------------------------------------------------------------------------
771
d559219f
RD
772#define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \
773 void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \
774 void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e);
775
776
777#define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \
778 void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \
19a97bd6 779 bool found; \
4268f798 780 wxPyBeginBlockThreads(); \
19a97bd6
RD
781 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
782 PyObject* obj = wxPyMake_wxObject(a); \
1e7ecb7b 783 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \
de20db99
RD
784 Py_DECREF(obj); \
785 } \
4268f798 786 wxPyEndBlockThreads(); \
19a97bd6 787 if (! found) \
d559219f 788 PCLASS::CBNAME(a, b, c, d, e); \
d559219f
RD
789 } \
790 void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \
791 int d, int e) { \
792 PCLASS::CBNAME(a, b, c, d, e); \
efc5f224
RD
793 }
794
795//---------------------------------------------------------------------------
796
d559219f
RD
797#define DEC_PYCALLBACK__2DBLINT(CBNAME) \
798 void CBNAME(double a, double b, int c); \
799 void base_##CBNAME(double a, double b, int c);
800
801
19a97bd6
RD
802#define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \
803 void CLASS::CBNAME(double a, double b, int c) { \
804 bool found; \
4268f798 805 wxPyBeginBlockThreads(); \
19a97bd6
RD
806 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
807 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \
4268f798 808 wxPyEndBlockThreads(); \
19a97bd6
RD
809 if (! found) \
810 PCLASS::CBNAME(a, b, c); \
811 } \
812 void CLASS::base_##CBNAME(double a, double b, int c) { \
813 PCLASS::CBNAME(a, b, c); \
efc5f224
RD
814 }
815
816//---------------------------------------------------------------------------
817
d559219f
RD
818#define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \
819 void CBNAME(bool a, double b, double c, int d); \
820 void base_##CBNAME(bool a, double b, double c, int d);
821
822
823#define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \
824 void CLASS::CBNAME(bool a, double b, double c, int d) { \
19a97bd6 825 bool found; \
4268f798 826 wxPyBeginBlockThreads(); \
19a97bd6
RD
827 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
828 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\
4268f798 829 wxPyEndBlockThreads(); \
19a97bd6 830 if (! found) \
d559219f 831 PCLASS::CBNAME(a, b, c, d); \
d559219f
RD
832 } \
833 void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \
834 PCLASS::CBNAME(a, b, c, d); \
efc5f224
RD
835 }
836
837//---------------------------------------------------------------------------
838//---------------------------------------------------------------------------
389c5527
RD
839
840#define DEC_PYCALLBACK__STRING(CBNAME) \
841 void CBNAME(const wxString& a); \
842 void base_##CBNAME(const wxString& a);
843
19a97bd6
RD
844#define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \
845 void CLASS::CBNAME(const wxString& a) { \
846 bool found; \
4268f798 847 wxPyBeginBlockThreads(); \
19a97bd6 848 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325 849 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
4268f798 850 wxPyEndBlockThreads(); \
19a97bd6
RD
851 if (! found) \
852 PCLASS::CBNAME(a); \
853 } \
854 void CLASS::base_##CBNAME(const wxString& a) { \
855 PCLASS::CBNAME(a); \
389c5527
RD
856 }
857
858//---------------------------------------------------------------------------
859
860#define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \
861 bool CBNAME(const wxString& a); \
862 bool base_##CBNAME(const wxString& a);
863
389c5527
RD
864#define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \
865 bool CLASS::CBNAME(const wxString& a) { \
059a841c 866 bool rval=FALSE; \
19a97bd6 867 bool found; \
4268f798 868 wxPyBeginBlockThreads(); \
19a97bd6 869 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325 870 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
4268f798 871 wxPyEndBlockThreads(); \
19a97bd6 872 if (! found) \
389c5527 873 rval = PCLASS::CBNAME(a); \
389c5527
RD
874 return rval; \
875 } \
876 bool CLASS::base_##CBNAME(const wxString& a) { \
877 return PCLASS::CBNAME(a); \
878 }
879
880//---------------------------------------------------------------------------
881
c368d904
RD
882#define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \
883 bool CBNAME(const wxString& a);
c8bc7bb8 884
19a97bd6
RD
885#define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \
886 bool CLASS::CBNAME(const wxString& a) { \
059a841c 887 bool rval=FALSE; \
4268f798 888 wxPyBeginBlockThreads(); \
19a97bd6 889 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
a541c325 890 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", wx2PyString(a))); \
4268f798 891 wxPyEndBlockThreads(); \
19a97bd6
RD
892 return rval; \
893 } \
c368d904
RD
894
895//---------------------------------------------------------------------------
896
897#define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \
898 wxString CBNAME(const wxString& a); \
899
900#define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \
901 wxString CLASS::CBNAME(const wxString& a) { \
902 wxString rval; \
a541c325 903 wxPyBeginBlockThreads(); \
19a97bd6 904 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 905 PyObject* ro; \
a541c325 906 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", wx2PyString(a)));\
c368d904 907 if (ro) { \
a541c325
RD
908 rval = Py2wxString(ro); \
909 Py_DECREF(ro); \
c368d904
RD
910 } \
911 } \
a541c325 912 wxPyEndBlockThreads(); \
c368d904
RD
913 return rval; \
914 } \
915
916//---------------------------------------------------------------------------
917
918#define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \
919 wxString CBNAME(const wxString& a,int b); \
920
921#define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \
922 wxString CLASS::CBNAME(const wxString& a,int b) { \
923 wxString rval; \
4268f798 924 wxPyBeginBlockThreads(); \
19a97bd6 925 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 926 PyObject* ro; \
a541c325 927 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)", wx2PyString(a),b)); \
c368d904 928 if (ro) { \
a541c325
RD
929 rval = Py2wxString(ro); \
930 Py_DECREF(ro); \
c368d904
RD
931 } \
932 } \
a541c325 933 wxPyEndBlockThreads(); \
c368d904
RD
934 return rval; \
935 } \
936
937//---------------------------------------------------------------------------
938
f0261a72
RD
939#define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \
940 bool CBNAME(const wxString& a, const wxString& b); \
941 bool base_##CBNAME(const wxString& a, const wxString& b);
942
f0261a72
RD
943#define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \
944 bool CLASS::CBNAME(const wxString& a, const wxString& b) { \
059a841c 945 bool rval=FALSE; \
19a97bd6 946 bool found; \
4268f798 947 wxPyBeginBlockThreads(); \
19a97bd6 948 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
a541c325
RD
949 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)", \
950 wx2PyString(a), wx2PyString(b))); \
951 wxPyEndBlockThreads(); \
19a97bd6 952 if (! found) \
f0261a72 953 rval = PCLASS::CBNAME(a, b); \
f0261a72
RD
954 return rval; \
955 } \
956 bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \
957 return PCLASS::CBNAME(a, b); \
958 }
959
960//---------------------------------------------------------------------------
961
389c5527
RD
962#define DEC_PYCALLBACK_STRING_(CBNAME) \
963 wxString CBNAME(); \
964 wxString base_##CBNAME();
965
389c5527
RD
966#define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \
967 wxString CLASS::CBNAME() { \
968 wxString rval; \
19a97bd6 969 bool found; \
4268f798 970 wxPyBeginBlockThreads(); \
19a97bd6 971 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
389c5527 972 PyObject* ro; \
19a97bd6 973 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97 974 if (ro) { \
a541c325
RD
975 rval = Py2wxString(ro); \
976 Py_DECREF(ro); \
f6bcfd97 977 } \
389c5527 978 } \
a541c325 979 wxPyEndBlockThreads(); \
19a97bd6 980 if (! found) \
b1462dfa 981 rval = PCLASS::CBNAME(); \
389c5527
RD
982 return rval; \
983 } \
b1462dfa
RD
984 wxString CLASS::base_##CBNAME() { \
985 return PCLASS::CBNAME(); \
389c5527
RD
986 }
987
988//---------------------------------------------------------------------------
989
990#define DEC_PYCALLBACK_STRING__pure(CBNAME) \
991 wxString CBNAME();
992
389c5527
RD
993#define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \
994 wxString CLASS::CBNAME() { \
995 wxString rval; \
4268f798 996 wxPyBeginBlockThreads(); \
19a97bd6 997 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
389c5527 998 PyObject* ro; \
19a97bd6 999 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97 1000 if (ro) { \
a541c325
RD
1001 rval = Py2wxString(ro); \
1002 Py_DECREF(ro); \
f6bcfd97 1003 } \
389c5527 1004 } \
a541c325 1005 wxPyEndBlockThreads(); \
389c5527
RD
1006 return rval; \
1007 }
1008
1009//---------------------------------------------------------------------------
1010
1011#define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \
1012 bool CBNAME(const wxHtmlTag& a); \
1013
1014
1015#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
1016 bool CLASS::CBNAME(const wxHtmlTag& a) { \
059a841c 1017 bool rval=FALSE; \
4268f798 1018 wxPyBeginBlockThreads(); \
19a97bd6
RD
1019 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
1020 PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \
1021 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
de20db99
RD
1022 Py_DECREF(obj); \
1023 } \
4268f798 1024 wxPyEndBlockThreads(); \
389c5527
RD
1025 return rval; \
1026 }
1027
0122b7e3
RD
1028//---------------------------------------------------------------------------
1029
1030#define DEC_PYCALLBACK__CELLINTINT(CBNAME) \
1031 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \
1032 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y);
1033
1034#define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \
1035 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
0122b7e3 1036 bool found; \
4268f798 1037 wxPyBeginBlockThreads(); \
0122b7e3
RD
1038 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1039 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1040 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \
1041 Py_DECREF(obj); \
1042 } \
4268f798 1043 wxPyEndBlockThreads(); \
0122b7e3
RD
1044 if (! found) \
1045 PCLASS::CBNAME(cell, x, y); \
1046 } \
1047 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \
1048 PCLASS::CBNAME(cell, x, y); \
1049 }
1050
1051
1052//---------------------------------------------------------------------------
1053
1054#define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \
1055 void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \
1056 void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e);
1057
1058#define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \
1059 void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1060 bool found; \
4268f798 1061 wxPyBeginBlockThreads(); \
0122b7e3
RD
1062 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1063 PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \
1064 PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1065 wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \
1066 Py_DECREF(obj); \
1067 Py_DECREF(o2); \
1068 } \
4268f798 1069 wxPyEndBlockThreads(); \
0122b7e3
RD
1070 if (! found) \
1071 PCLASS::CBNAME(cell, x, y, e); \
1072 } \
1073 void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \
1074 PCLASS::CBNAME(cell, x, y, e); \
1075 }
1076
1077
1078
389c5527 1079//---------------------------------------------------------------------------
2f90df85
RD
1080
1081#define DEC_PYCALLBACK___pure(CBNAME) \
1082 void CBNAME(); \
1083
1084
1085#define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \
1086 void CLASS::CBNAME() { \
4268f798 1087 wxPyBeginBlockThreads(); \
19a97bd6
RD
1088 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1089 wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 1090 wxPyEndBlockThreads(); \
2f90df85
RD
1091 }
1092
1093//---------------------------------------------------------------------------
1094
1095#define DEC_PYCALLBACK_wxSize__pure(CBNAME) \
1096 wxSize CBNAME(); \
1097
1098
1099#define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \
1100 wxSize CLASS::CBNAME() { \
db0ff83e 1101 const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \
2f90df85 1102 wxSize rval(0,0); \
db0ff83e 1103 wxPyBeginBlockThreads(); \
19a97bd6 1104 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
2f90df85
RD
1105 PyObject* ro; \
1106 wxSize* ptr; \
19a97bd6 1107 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \
f6bcfd97
BP
1108 if (ro) { \
1109 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \
1110 rval = *ptr; \
db0ff83e
RD
1111 else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \
1112 PyObject* o1 = PySequence_GetItem(ro, 0); \
1113 PyObject* o2 = PySequence_GetItem(ro, 1); \
1114 if (PyNumber_Check(o1) && PyNumber_Check(o2)) \
1115 rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \
1116 else \
1117 PyErr_SetString(PyExc_TypeError, errmsg); \
1118 Py_DECREF(o1); \
1119 Py_DECREF(o2); \
1120 } \
1121 else { \
1122 PyErr_SetString(PyExc_TypeError, errmsg); \
1123 } \
f6bcfd97
BP
1124 Py_DECREF(ro); \
1125 } \
2f90df85 1126 } \
db0ff83e 1127 wxPyEndBlockThreads(); \
2f90df85
RD
1128 return rval; \
1129 }
1130
1131//---------------------------------------------------------------------------
1132
1133#define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \
1134 bool CBNAME(wxWindow* a); \
1135 bool base_##CBNAME(wxWindow* a);
1136
1137
19a97bd6
RD
1138#define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \
1139 bool CLASS::CBNAME(wxWindow* a) { \
059a841c 1140 bool rval=FALSE; \
19a97bd6 1141 bool found; \
4268f798 1142 wxPyBeginBlockThreads(); \
19a97bd6
RD
1143 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1144 PyObject* obj = wxPyMake_wxObject(a); \
1145 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1146 Py_DECREF(obj); \
1147 } \
4268f798 1148 wxPyEndBlockThreads(); \
19a97bd6
RD
1149 if (! found) \
1150 rval = PCLASS::CBNAME(a); \
1151 return rval; \
1152 } \
1153 bool CLASS::base_##CBNAME(wxWindow* a) { \
1154 return PCLASS::CBNAME(a); \
2f90df85
RD
1155 }
1156
389c5527 1157//---------------------------------------------------------------------------
2f90df85
RD
1158
1159#define DEC_PYCALLBACK_BOOL_(CBNAME) \
1160 bool CBNAME(); \
1161 bool base_##CBNAME();
1162
1163
19a97bd6
RD
1164#define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \
1165 bool CLASS::CBNAME() { \
059a841c 1166 bool rval=FALSE; \
19a97bd6 1167 bool found; \
4268f798 1168 wxPyBeginBlockThreads(); \
19a97bd6
RD
1169 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1170 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
4268f798 1171 wxPyEndBlockThreads(); \
19a97bd6
RD
1172 if (! found) \
1173 rval = PCLASS::CBNAME(); \
1174 return rval; \
1175 } \
1176 bool CLASS::base_##CBNAME() { \
1177 return PCLASS::CBNAME(); \
2f90df85
RD
1178 }
1179
b1462dfa
RD
1180//---------------------------------------------------------------------------
1181
19a97bd6
RD
1182#define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \
1183 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \
b1462dfa
RD
1184 wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1185
1186
19a97bd6
RD
1187#define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \
1188 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
059a841c 1189 int rval=0; \
19a97bd6 1190 bool found; \
cac344f6 1191 wxPyBeginBlockThreads(); \
19a97bd6 1192 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1e7ecb7b 1193 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
cac344f6 1194 wxPyEndBlockThreads(); \
19a97bd6
RD
1195 if (! found) \
1196 rval = PCLASS::CBNAME(a, b, c); \
1197 return (wxDragResult)rval; \
1198 } \
1199 wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
1200 return PCLASS::CBNAME(a, b, c); \
b1462dfa
RD
1201 }
1202
1203//---------------------------------------------------------------------------
1204
c368d904
RD
1205#define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \
1206 wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \
1207
1208#define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \
1209 wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \
cac344f6 1210 wxPyBeginBlockThreads(); \
c368d904 1211 wxFSFile* rval=0; \
19a97bd6 1212 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
c368d904 1213 PyObject* ro; \
19a97bd6 1214 PyObject* obj = wxPyMake_wxObject(&a); \
a541c325 1215 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\
cac344f6 1216 obj, wx2PyString(b))); \
c368d904
RD
1217 if (ro) { \
1218 SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \
1219 Py_DECREF(ro); \
1220 } \
de20db99
RD
1221 Py_DECREF(obj); \
1222 } \
cac344f6 1223 wxPyEndBlockThreads(); \
c368d904
RD
1224 return rval; \
1225 };
1226
1227//---------------------------------------------------------------------------
1228
b1462dfa
RD
1229#define DEC_PYCALLBACK_BOOL_DR(CBNAME) \
1230 bool CBNAME(wxDragResult a); \
1231 bool base_##CBNAME(wxDragResult a);
1232
1233
1234#define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \
1235 bool CLASS::CBNAME(wxDragResult a) { \
059a841c 1236 bool rval=FALSE; \
19a97bd6 1237 bool found; \
a541c325 1238 wxPyBeginBlockThreads(); \
19a97bd6
RD
1239 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1240 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\
a541c325 1241 wxPyEndBlockThreads(); \
19a97bd6 1242 if (! found) \
b1462dfa 1243 rval = PCLASS::CBNAME(a); \
b1462dfa
RD
1244 return rval; \
1245 } \
1246 bool CLASS::base_##CBNAME(wxDragResult a) { \
1247 return PCLASS::CBNAME(a); \
1248 }
1249
1250//---------------------------------------------------------------------------
1251
1252#define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \
1253 wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def);
1254
1255
1256#define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \
1257 wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \
a541c325 1258 wxPyBeginBlockThreads(); \
059a841c 1259 int rval=0; \
19a97bd6 1260 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
1e7ecb7b 1261 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\
a541c325 1262 wxPyEndBlockThreads(); \
b1462dfa
RD
1263 return (wxDragResult)rval; \
1264 } \
1265
1266//---------------------------------------------------------------------------
1267
1268#define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \
1269 bool CBNAME(int a, int b, const wxString& c);
1270
b1462dfa
RD
1271#define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \
1272 bool CLASS::CBNAME(int a, int b, const wxString& c) { \
059a841c 1273 bool rval=FALSE; \
a541c325 1274 wxPyBeginBlockThreads(); \
19a97bd6 1275 if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \
a541c325
RD
1276 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b, wx2PyString(c)));\
1277 wxPyEndBlockThreads(); \
b1462dfa
RD
1278 return rval; \
1279 } \
1280
1281//---------------------------------------------------------------------------
1282
1283#define DEC_PYCALLBACK_SIZET_(CBNAME) \
1284 size_t CBNAME(); \
1285 size_t base_##CBNAME();
1286
1287
1288#define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \
1289 size_t CLASS::CBNAME() { \
059a841c 1290 size_t rval=0; \
19a97bd6 1291 bool found; \
a541c325 1292 wxPyBeginBlockThreads(); \
19a97bd6
RD
1293 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \
1294 rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \
a541c325 1295 wxPyEndBlockThreads(); \
19a97bd6 1296 if (! found) \
b1462dfa 1297 rval = PCLASS::CBNAME(); \
b1462dfa
RD
1298 return rval; \
1299 } \
1300 size_t CLASS::base_##CBNAME() { \
1301 return PCLASS::CBNAME(); \
1302 }
1303
1304//---------------------------------------------------------------------------
1305
c7e7022c
RD
1306#define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \
1307 wxDataFormat CBNAME(size_t a); \
1308 wxDataFormat base_##CBNAME(size_t a);
b1462dfa
RD
1309
1310
1311#define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \
1312 wxDataFormat CLASS::CBNAME(size_t a) { \
059a841c 1313 wxDataFormat rval=0; \
19a97bd6 1314 bool found; \
a541c325 1315 wxPyBeginBlockThreads(); \
19a97bd6 1316 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
b1462dfa
RD
1317 PyObject* ro; \
1318 wxDataFormat* ptr; \
c7e7022c 1319 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
f6bcfd97
BP
1320 if (ro) { \
1321 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \
1322 rval = *ptr; \
1323 Py_DECREF(ro); \
1324 } \
b1462dfa 1325 } \
a541c325 1326 wxPyEndBlockThreads(); \
19a97bd6 1327 if (! found) \
b1462dfa 1328 rval = PCLASS::CBNAME(a); \
b1462dfa
RD
1329 return rval; \
1330 } \
1331 wxDataFormat CLASS::base_##CBNAME(size_t a) { \
1332 return PCLASS::CBNAME(a); \
1333 }
1334
389c5527 1335//---------------------------------------------------------------------------
f6bcfd97
BP
1336
1337#define DEC_PYCALLBACK__constany(CBNAME, Type) \
1338 void CBNAME(const Type& a); \
1339 void base_##CBNAME(const Type& a);
1340
1341
19a97bd6
RD
1342#define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \
1343 void CLASS::CBNAME(const Type& a) { \
1344 bool found; \
a541c325 1345 wxPyBeginBlockThreads(); \
19a97bd6
RD
1346 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1347 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1348 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1349 Py_DECREF(obj); \
1350 } \
a541c325 1351 wxPyEndBlockThreads(); \
19a97bd6
RD
1352 if (! found) \
1353 PCLASS::CBNAME(a); \
1354 } \
1355 void CLASS::base_##CBNAME(const Type& a) { \
1356 PCLASS::CBNAME(a); \
f6bcfd97
BP
1357 }
1358
1359
1360//---------------------------------------------------------------------------
1361
1362#define DEC_PYCALLBACK__any(CBNAME, Type) \
1363 void CBNAME(Type& a); \
1364 void base_##CBNAME(Type& a);
1365
1366
19a97bd6
RD
1367#define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \
1368 void CLASS::CBNAME(Type& a) { \
1369 bool found; \
a541c325 1370 wxPyBeginBlockThreads(); \
19a97bd6
RD
1371 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1372 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1373 wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1374 Py_DECREF(obj); \
1375 } \
a541c325 1376 wxPyEndBlockThreads(); \
19a97bd6
RD
1377 if (! found) \
1378 PCLASS::CBNAME(a); \
1379 } \
1380 void CLASS::base_##CBNAME(Type& a) { \
1381 PCLASS::CBNAME(a); \
f6bcfd97
BP
1382 }
1383
efc5f224 1384//---------------------------------------------------------------------------
f6bcfd97
BP
1385
1386#define DEC_PYCALLBACK_bool_any(CBNAME, Type) \
1387 bool CBNAME(Type& a); \
1388 bool base_##CBNAME(Type& a);
1389
1390
19a97bd6
RD
1391#define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \
1392 bool CLASS::CBNAME(Type& a) { \
36fd8ec3 1393 bool rv=FALSE; \
19a97bd6 1394 bool found; \
a541c325 1395 wxPyBeginBlockThreads(); \
19a97bd6
RD
1396 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1397 PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \
1398 rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \
1399 Py_DECREF(obj); \
1400 } \
a541c325 1401 wxPyEndBlockThreads(); \
19a97bd6
RD
1402 if (! found) \
1403 rv = PCLASS::CBNAME(a); \
1404 return rv; \
1405 } \
1406 bool CLASS::base_##CBNAME(Type& a) { \
1407 return PCLASS::CBNAME(a); \
f6bcfd97
BP
1408 }
1409
efc5f224
RD
1410//---------------------------------------------------------------------------
1411
c7e7022c
RD
1412#define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \
1413 wxString CBNAME(long a, long b) const; \
1414 wxString base_##CBNAME(long a, long b)const ;
1415
c7e7022c
RD
1416#define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \
1417 wxString CLASS::CBNAME(long a, long b) const { \
1418 wxString rval; \
19a97bd6 1419 bool found; \
a541c325 1420 wxPyBeginBlockThreads(); \
19a97bd6 1421 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1422 PyObject* ro; \
1423 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \
1424 if (ro) { \
a541c325
RD
1425 rval = Py2wxString(ro); \
1426 Py_DECREF(ro); \
c7e7022c
RD
1427 } \
1428 } \
a541c325 1429 wxPyEndBlockThreads(); \
19a97bd6 1430 if (! found) \
c7e7022c 1431 rval = PCLASS::CBNAME(a,b); \
c7e7022c
RD
1432 return rval; \
1433 } \
1434 wxString CLASS::base_##CBNAME(long a, long b) const { \
1435 return PCLASS::CBNAME(a,b); \
1436 }
1437
1438//---------------------------------------------------------------------------
1439
1440#define DEC_PYCALLBACK_INT_LONG(CBNAME) \
1441 int CBNAME(long a) const; \
1442 int base_##CBNAME(long a)const ;
1443
1444
1445#define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \
1446 int CLASS::CBNAME(long a) const { \
1447 int rval=-1; \
19a97bd6 1448 bool found; \
a541c325 1449 wxPyBeginBlockThreads(); \
19a97bd6 1450 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1451 PyObject* ro; \
1452 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \
1453 if (ro) { \
1454 rval = PyInt_AsLong(ro); \
1455 Py_DECREF(ro); \
1456 } \
1457 } \
a541c325 1458 wxPyEndBlockThreads(); \
19a97bd6 1459 if (! found) \
c7e7022c 1460 rval = PCLASS::CBNAME(a); \
c7e7022c
RD
1461 return rval; \
1462 } \
1463 int CLASS::base_##CBNAME(long a) const { \
1464 return PCLASS::CBNAME(a); \
1465 }
1466
1467
1468//---------------------------------------------------------------------------
1469
1470#define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
00b6c4e3 1471 wxListItemAttr* CBNAME(long a) const; \
c7e7022c
RD
1472 wxListItemAttr* base_##CBNAME(long a);
1473
1474
1475#define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
00b6c4e3 1476 wxListItemAttr *CLASS::CBNAME(long a) const { \
c7e7022c 1477 wxListItemAttr *rval = NULL; \
19a97bd6 1478 bool found; \
a541c325 1479 wxPyBeginBlockThreads(); \
19a97bd6 1480 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
c7e7022c
RD
1481 PyObject* ro; \
1482 wxListItemAttr* ptr; \
1483 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \
1484 if (ro) { \
1485 if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \
1486 rval = ptr; \
1487 Py_DECREF(ro); \
1488 } \
1489 } \
a541c325 1490 wxPyEndBlockThreads(); \
19a97bd6 1491 if (! found) \
c7e7022c 1492 rval = PCLASS::CBNAME(a); \
c7e7022c
RD
1493 return rval; \
1494 } \
1495 wxListItemAttr *CLASS::base_##CBNAME(long a) { \
1496 return PCLASS::CBNAME(a); \
1497 }
1498
1499//---------------------------------------------------------------------------
1500
a541c325
RD
1501#define DEC_PYCALLBACK_BOOL_ME(CBNAME) \
1502 bool CBNAME(wxMouseEvent& e); \
0122b7e3
RD
1503 bool base_##CBNAME(wxMouseEvent& e);
1504
a541c325
RD
1505#define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \
1506 bool CLASS::CBNAME(wxMouseEvent& e) { \
1507 bool rval=FALSE; \
1508 bool found; \
1509 wxPyBeginBlockThreads(); \
1510 if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \
1511 PyObject* ro; \
1512 PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \
1513 ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \
1514 if (ro) { \
1515 rval = PyInt_AsLong(ro); \
1516 Py_DECREF(ro); \
1517 } \
1518 Py_DECREF(obj); \
1519 } \
1520 wxPyEndBlockThreads(); \
1521 if (! found) \
1522 return PCLASS::CBNAME(e); \
1523 return rval; \
1524 } \
1525 bool CLASS::base_##CBNAME(wxMouseEvent& e) { \
1526 return PCLASS::CBNAME(e); \
0122b7e3
RD
1527 }
1528
1529
1530//---------------------------------------------------------------------------
1531
7bf85405 1532#endif