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