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