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