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