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