]>
Commit | Line | Data |
---|---|---|
b1462dfa | 1 | //////////////////////////////////////////////////////////////////////////// |
7bf85405 | 2 | // Name: helpers.h |
a2426843 | 3 | // Purpose: Helper functions/classes for the wxPython extension module |
7bf85405 RD |
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 | |
4acff284 RD |
104 | //---------------------------------------------------------------------- |
105 | // Other helpful stuff | |
106 | ||
9d37f964 RD |
107 | #if PYTHON_API_VERSION < 1009 |
108 | #define PySequence_Fast_GET_ITEM(o, i) \ | |
109 | (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) | |
110 | #endif | |
111 | ||
112 | bool _2int_seq_helper(PyObject* source, int* i1, int* i2); | |
113 | bool _4int_seq_helper(PyObject* source, int* i1, int* i2, int* i3, int* i4); | |
114 | ||
115 | ||
7b7ac0ab | 116 | PyObject* wxArrayString2PyList_helper(const wxArrayString& arr); |
293a0a86 | 117 | PyObject* wxArrayInt2PyList_helper(const wxArrayInt& arr); |
b37c7e1d | 118 | |
4acff284 RD |
119 | #define RETURN_NONE() { Py_INCREF(Py_None); return Py_None; } |
120 | #define DECLARE_DEF_STRING(name) static const wxString wxPy##name(wx##name) | |
121 | #define DECLARE_DEF_STRING2(name,val) static const wxString wxPy##name(val) | |
b37c7e1d | 122 | |
2f90df85 | 123 | //---------------------------------------------------------------------- |
7bf85405 RD |
124 | |
125 | #ifndef SWIGCODE | |
126 | extern "C" void SWIG_MakePtr(char *, void *, char *); | |
127 | extern "C" char *SWIG_GetPtr(char *, void **, char *); | |
d559219f | 128 | extern "C" char *SWIG_GetPtrObj(PyObject *obj, void **ptr, char *type); |
7bf85405 RD |
129 | #endif |
130 | ||
131 | ||
132 | #ifdef _MSC_VER | |
133 | # pragma warning(disable:4800) | |
f6bcfd97 | 134 | # pragma warning(disable:4190) |
7bf85405 RD |
135 | #endif |
136 | ||
7bf85405 RD |
137 | //---------------------------------------------------------------------- |
138 | ||
139 | class wxPyCallback : public wxObject { | |
2f90df85 | 140 | DECLARE_ABSTRACT_CLASS(wxPyCallback); |
7bf85405 | 141 | public: |
cf694132 | 142 | wxPyCallback(PyObject* func); |
2f90df85 | 143 | wxPyCallback(const wxPyCallback& other); |
cf694132 | 144 | ~wxPyCallback(); |
7bf85405 RD |
145 | |
146 | void EventThunker(wxEvent& event); | |
147 | ||
148 | PyObject* m_func; | |
149 | }; | |
150 | ||
7bf85405 RD |
151 | //--------------------------------------------------------------------------- |
152 | ||
153 | class wxPyTimer : public wxTimer { | |
154 | public: | |
155 | wxPyTimer(PyObject* callback); | |
156 | ~wxPyTimer(); | |
157 | ||
158 | void Notify(); | |
159 | ||
160 | private: | |
161 | PyObject* func; | |
162 | }; | |
163 | ||
cf694132 | 164 | //--------------------------------------------------------------------------- |
65dd82cb | 165 | //--------------------------------------------------------------------------- |
9b3d3bc4 RD |
166 | // These Event classes can be derived from in Python and passed through the |
167 | // event system without loosing anything. They do this by keeping a reference | |
168 | // to themselves and some special case handling in wxPyCallback::EventThunker. | |
65dd82cb RD |
169 | |
170 | ||
e19b7164 | 171 | class wxPyEvtSelfRef { |
65dd82cb | 172 | public: |
e19b7164 RD |
173 | wxPyEvtSelfRef(); |
174 | ~wxPyEvtSelfRef(); | |
65dd82cb RD |
175 | |
176 | void SetSelf(PyObject* self, bool clone=FALSE); | |
177 | PyObject* GetSelf() const; | |
178 | ||
179 | protected: | |
180 | PyObject* m_self; | |
181 | bool m_cloned; | |
182 | }; | |
183 | ||
184 | ||
e19b7164 | 185 | class wxPyEvent : public wxEvent, public wxPyEvtSelfRef { |
07b2e1cd | 186 | DECLARE_ABSTRACT_CLASS(wxPyEvent) |
65dd82cb RD |
187 | public: |
188 | wxPyEvent(int id=0); | |
07b2e1cd | 189 | wxPyEvent(const wxPyEvent& evt); |
65dd82cb RD |
190 | ~wxPyEvent(); |
191 | ||
07b2e1cd | 192 | virtual wxEvent* Clone() const { return new wxPyEvent(*this); } |
65dd82cb RD |
193 | }; |
194 | ||
195 | ||
e19b7164 | 196 | class wxPyCommandEvent : public wxCommandEvent, public wxPyEvtSelfRef { |
07b2e1cd | 197 | DECLARE_ABSTRACT_CLASS(wxPyCommandEvent) |
65dd82cb RD |
198 | public: |
199 | wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0); | |
07b2e1cd | 200 | wxPyCommandEvent(const wxPyCommandEvent& evt); |
65dd82cb RD |
201 | ~wxPyCommandEvent(); |
202 | ||
07b2e1cd | 203 | virtual wxEvent* Clone() const { return new wxPyCommandEvent(*this); } |
65dd82cb RD |
204 | }; |
205 | ||
bb0054cd | 206 | |
4acff284 RD |
207 | |
208 | //---------------------------------------------------------------------- | |
209 | // Forward decalre a few things used in the exported API | |
210 | class wxPyClientData; | |
211 | class wxPyUserData; | |
212 | class wxPyOORClientData; | |
249a57f4 | 213 | class wxPyCBInputStream; |
4acff284 RD |
214 | |
215 | void wxPyClientData_dtor(wxPyClientData* self); | |
216 | void wxPyUserData_dtor(wxPyUserData* self); | |
217 | void wxPyOORClientData_dtor(wxPyOORClientData* self); | |
249a57f4 | 218 | wxPyCBInputStream* wxPyCBInputStream_create(PyObject *py, bool block); |
4acff284 RD |
219 | |
220 | ||
1e7ecb7b RD |
221 | //--------------------------------------------------------------------------- |
222 | // Export a C API in a struct. Other modules will be able to load this from | |
223 | // the wxc module and will then have safe access to these functions, even if | |
224 | // in another shared library. | |
225 | ||
226 | class wxPyCallbackHelper; | |
227 | ||
bc5f2236 RD |
228 | |
229 | // Make SunCC happy and make typedef's for these that are extern "C" | |
230 | typedef void (*p_SWIG_MakePtr_t)(char*, void*, char*); | |
231 | typedef char* (*p_SWIG_GetPtr_t)(char*, void**, char*); | |
232 | typedef char* (*p_SWIG_GetPtrObj_t)(PyObject*, void**, char*); | |
233 | typedef void (*p_SWIG_RegisterMapping_t)(char*, char*, void *(*cast)(void *)); | |
234 | typedef void (*p_SWIG_addvarlink_t)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)); | |
235 | typedef PyObject* (*p_SWIG_newvarlink_t)(void); | |
236 | ||
237 | ||
1e7ecb7b RD |
238 | struct wxPyCoreAPI { |
239 | ||
bc5f2236 RD |
240 | p_SWIG_MakePtr_t p_SWIG_MakePtr; |
241 | p_SWIG_GetPtr_t p_SWIG_GetPtr; | |
242 | p_SWIG_GetPtrObj_t p_SWIG_GetPtrObj; | |
243 | p_SWIG_RegisterMapping_t p_SWIG_RegisterMapping; | |
244 | p_SWIG_addvarlink_t p_SWIG_addvarlink; | |
245 | p_SWIG_newvarlink_t p_SWIG_newvarlink; | |
1e7ecb7b | 246 | |
4268f798 RD |
247 | PyThreadState* (*p_wxPyBeginAllowThreads)(); |
248 | void (*p_wxPyEndAllowThreads)(PyThreadState* state); | |
249 | void (*p_wxPyBeginBlockThreads)(); | |
250 | void (*p_wxPyEndBlockThreads)(); | |
19a97bd6 | 251 | |
a541c325 | 252 | PyObject* (*p_wxPyConstructObject)(void *, const wxString&, int); |
1e7ecb7b RD |
253 | PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className); |
254 | ||
c8bc7bb8 | 255 | wxString* (*p_wxString_in_helper)(PyObject* source); |
a541c325 RD |
256 | wxString (*p_Py2wxString)(PyObject* source); |
257 | PyObject* (*p_wx2PyString)(const wxString& src); | |
c8bc7bb8 | 258 | |
1e7ecb7b RD |
259 | byte* (*p_byte_LIST_helper)(PyObject* source); |
260 | int* (*p_int_LIST_helper)(PyObject* source); | |
261 | long* (*p_long_LIST_helper)(PyObject* source); | |
262 | char** (*p_string_LIST_helper)(PyObject* source); | |
e0672e2f | 263 | wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source, int* npoints); |
1e7ecb7b RD |
264 | wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source); |
265 | wxString* (*p_wxString_LIST_helper)(PyObject* source); | |
266 | wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source); | |
267 | ||
268 | bool (*p_wxSize_helper)(PyObject* source, wxSize** obj); | |
269 | bool (*p_wxPoint_helper)(PyObject* source, wxPoint** obj); | |
270 | bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj); | |
271 | bool (*p_wxRect_helper)(PyObject* source, wxRect** obj); | |
272 | bool (*p_wxColour_helper)(PyObject* source, wxColour** obj); | |
273 | ||
0122b7e3 | 274 | void (*p_wxPyCBH_setCallbackInfo)(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); |
1e7ecb7b RD |
275 | bool (*p_wxPyCBH_findCallback)(const wxPyCallbackHelper& cbh, const char* name); |
276 | int (*p_wxPyCBH_callCallback)(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
277 | PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
278 | void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh); | |
279 | ||
a541c325 | 280 | PyObject* (*p_wxPyClassExists)(const wxString& className); |
2f4e9287 RD |
281 | PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler); |
282 | PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source); | |
9416aa89 | 283 | void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName); |
7b7ac0ab | 284 | PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr); |
293a0a86 | 285 | PyObject* (*p_wxArrayInt2PyList_helper)(const wxArrayInt& arr); |
4acff284 RD |
286 | |
287 | void (*p_wxPyClientData_dtor)(wxPyClientData*); | |
288 | void (*p_wxPyUserData_dtor)(wxPyUserData*); | |
289 | void (*p_wxPyOORClientData_dtor)(wxPyOORClientData*); | |
249a57f4 RD |
290 | |
291 | wxPyCBInputStream* (*p_wxPyCBInputStream_create)(PyObject *py, bool block); | |
292 | ||
4acff284 RD |
293 | }; |
294 | ||
295 | #ifdef wxPyUSE_EXPORT | |
a2426843 RD |
296 | // Notice that this is static, not extern. This is by design, each module |
297 | // needs one, but doesn't have to use it. | |
298 | static wxPyCoreAPI* wxPyCoreAPIPtr = NULL; | |
4acff284 RD |
299 | #endif |
300 | ||
301 | ||
302 | //--------------------------------------------------------------------------- | |
303 | ||
304 | ||
305 | class wxPyUserData : public wxObject { | |
306 | public: | |
307 | wxPyUserData(PyObject* obj) { | |
308 | m_obj = obj; | |
309 | Py_INCREF(m_obj); | |
310 | } | |
311 | ||
312 | ~wxPyUserData() { | |
313 | #ifdef wxPyUSE_EXPORT | |
314 | wxPyCoreAPIPtr->p_wxPyUserData_dtor(this); | |
315 | #else | |
316 | wxPyUserData_dtor(this); | |
317 | #endif | |
318 | } | |
319 | PyObject* m_obj; | |
320 | }; | |
321 | ||
322 | ||
323 | class wxPyClientData : public wxClientData { | |
324 | public: | |
325 | wxPyClientData(PyObject* obj) { | |
326 | m_obj = obj; | |
327 | Py_INCREF(m_obj); | |
328 | } | |
329 | ||
330 | ~wxPyClientData() { | |
331 | #ifdef wxPyUSE_EXPORT | |
332 | wxPyCoreAPIPtr->p_wxPyClientData_dtor(this); | |
333 | #else | |
334 | wxPyClientData_dtor(this); | |
335 | #endif | |
336 | } | |
337 | PyObject* m_obj; | |
1e7ecb7b RD |
338 | }; |
339 | ||
4acff284 RD |
340 | |
341 | class wxPyOORClientData : public wxPyClientData { | |
342 | public: | |
343 | wxPyOORClientData(PyObject* obj) | |
344 | : wxPyClientData(obj) {} | |
345 | ||
346 | ~wxPyOORClientData() { | |
1e7ecb7b | 347 | #ifdef wxPyUSE_EXPORT |
4acff284 RD |
348 | wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(this); |
349 | #else | |
350 | wxPyOORClientData_dtor(this); | |
1e7ecb7b | 351 | #endif |
4acff284 RD |
352 | } |
353 | }; | |
1e7ecb7b RD |
354 | |
355 | //--------------------------------------------------------------------------- | |
356 | // This class holds an instance of a Python Shadow Class object and assists | |
357 | // with looking up and invoking Python callback methods from C++ virtual | |
358 | // method redirections. For all classes which have virtuals which should be | |
359 | // overridable in wxPython, a new subclass is created that contains a | |
360 | // wxPyCallbackHelper. | |
361 | // | |
362 | ||
363 | class wxPyCallbackHelper { | |
364 | public: | |
365 | wxPyCallbackHelper(const wxPyCallbackHelper& other); | |
366 | ||
367 | wxPyCallbackHelper() { | |
368 | m_class = NULL; | |
369 | m_self = NULL; | |
370 | m_lastFound = NULL; | |
371 | m_incRef = FALSE; | |
372 | } | |
373 | ||
374 | ~wxPyCallbackHelper() { | |
375 | #ifdef wxPyUSE_EXPORT | |
376 | wxPyCoreAPIPtr->p_wxPyCBH_delete(this); | |
377 | #else | |
378 | wxPyCBH_delete(this); | |
379 | #endif | |
380 | } | |
381 | ||
382 | void setSelf(PyObject* self, PyObject* klass, int incref=TRUE); | |
383 | bool findCallback(const char* name) const; | |
384 | int callCallback(PyObject* argTuple) const; | |
385 | PyObject* callCallbackObj(PyObject* argTuple) const; | |
386 | ||
387 | private: | |
388 | PyObject* m_self; | |
389 | PyObject* m_class; | |
390 | PyObject* m_lastFound; | |
391 | int m_incRef; | |
392 | ||
393 | friend void wxPyCBH_delete(wxPyCallbackHelper* cbh); | |
394 | }; | |
395 | ||
396 | ||
0122b7e3 | 397 | void wxPyCBH_setCallbackInfo(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref); |
1e7ecb7b RD |
398 | bool wxPyCBH_findCallback(const wxPyCallbackHelper& cbh, const char* name); |
399 | int wxPyCBH_callCallback(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
400 | PyObject* wxPyCBH_callCallbackObj(const wxPyCallbackHelper& cbh, PyObject* argTuple); | |
401 | void wxPyCBH_delete(wxPyCallbackHelper* cbh); | |
402 | ||
403 | ||
404 | ||
900d9886 | 405 | |
bb0054cd RD |
406 | //--------------------------------------------------------------------------- |
407 | // These macros are used to implement the virtual methods that should | |
408 | // redirect to a Python method if one exists. The names designate the | |
b1462dfa | 409 | // return type, if any, as well as any parameter types. |
bb0054cd RD |
410 | //--------------------------------------------------------------------------- |
411 | ||
f6bcfd97 | 412 | #define PYPRIVATE \ |
0122b7e3 RD |
413 | void _setCallbackInfo(PyObject* self, PyObject* _class, int incref=1) { \ |
414 | wxPyCBH_setCallbackInfo(m_myInst, self, _class, incref); \ | |
f6bcfd97 | 415 | } \ |
c368d904 | 416 | private: wxPyCallbackHelper m_myInst |
efc5f224 RD |
417 | |
418 | //--------------------------------------------------------------------------- | |
419 | ||
d559219f RD |
420 | #define DEC_PYCALLBACK__(CBNAME) \ |
421 | void CBNAME(); \ | |
422 | void base_##CBNAME(); | |
423 | ||
424 | ||
19a97bd6 RD |
425 | #define IMP_PYCALLBACK__(CLASS, PCLASS, CBNAME) \ |
426 | void CLASS::CBNAME() { \ | |
427 | bool found; \ | |
4268f798 | 428 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
429 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
430 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
4268f798 | 431 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
432 | if (! found) \ |
433 | PCLASS::CBNAME(); \ | |
434 | } \ | |
435 | void CLASS::base_##CBNAME() { \ | |
436 | PCLASS::CBNAME(); \ | |
d559219f RD |
437 | } |
438 | ||
439 | //--------------------------------------------------------------------------- | |
440 | ||
441 | #define DEC_PYCALLBACK_BOOL_INTINT(CBNAME) \ | |
442 | bool CBNAME(int a, int b); \ | |
443 | bool base_##CBNAME(int a, int b); | |
444 | ||
445 | ||
446 | #define IMP_PYCALLBACK_BOOL_INTINT(CLASS, PCLASS, CBNAME) \ | |
447 | bool CLASS::CBNAME(int a, int b) { \ | |
059a841c | 448 | bool rval=FALSE, found; \ |
4268f798 | 449 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 450 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1e7ecb7b | 451 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ |
4268f798 | 452 | wxPyEndBlockThreads(); \ |
19a97bd6 | 453 | if (! found) \ |
d559219f | 454 | rval = PCLASS::CBNAME(a,b); \ |
d559219f | 455 | return rval; \ |
bb0054cd | 456 | } \ |
d559219f | 457 | bool CLASS::base_##CBNAME(int a, int b) { \ |
bb0054cd RD |
458 | return PCLASS::CBNAME(a,b); \ |
459 | } | |
460 | ||
461 | //--------------------------------------------------------------------------- | |
462 | ||
c368d904 RD |
463 | #define DEC_PYCALLBACK_VOID_INTINT(CBNAME) \ |
464 | void CBNAME(int a, int b); \ | |
465 | void base_##CBNAME(int a, int b); | |
466 | ||
467 | ||
468 | #define IMP_PYCALLBACK_VOID_INTINT(CLASS, PCLASS, CBNAME) \ | |
469 | void CLASS::CBNAME(int a, int b) { \ | |
19a97bd6 | 470 | bool found; \ |
b0e5c039 | 471 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
472 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
473 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ii)",a,b)); \ | |
b0e5c039 | 474 | wxPyEndBlockThreads(); \ |
19a97bd6 | 475 | if (! found) \ |
c368d904 | 476 | PCLASS::CBNAME(a,b); \ |
c368d904 RD |
477 | } \ |
478 | void CLASS::base_##CBNAME(int a, int b) { \ | |
479 | PCLASS::CBNAME(a,b); \ | |
480 | } | |
481 | ||
482 | //--------------------------------------------------------------------------- | |
483 | ||
b0e5c039 RD |
484 | #define DEC_PYCALLBACK_VOID_INT4(CBNAME) \ |
485 | void CBNAME(int a, int b, int c, int d); \ | |
486 | void base_##CBNAME(int a, int b, int c, int d); | |
487 | ||
488 | ||
489 | #define IMP_PYCALLBACK_VOID_INT4(CLASS, PCLASS, CBNAME) \ | |
490 | void CLASS::CBNAME(int a, int b, int c, int d) { \ | |
491 | bool found; \ | |
492 | wxPyBeginBlockThreads(); \ | |
493 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
494 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiii)",a,b,c,d)); \ | |
495 | wxPyEndBlockThreads(); \ | |
496 | if (! found) \ | |
497 | PCLASS::CBNAME(a,b,c,d); \ | |
498 | } \ | |
499 | void CLASS::base_##CBNAME(int a, int b, int c, int d) { \ | |
500 | PCLASS::CBNAME(a,b,c,d); \ | |
501 | } | |
502 | ||
503 | //--------------------------------------------------------------------------- | |
504 | #define DEC_PYCALLBACK_VOID_INT5(CBNAME) \ | |
505 | void CBNAME(int a, int b, int c, int d, int e); \ | |
506 | void base_##CBNAME(int a, int b, int c, int d, int e); | |
507 | ||
508 | ||
509 | #define IMP_PYCALLBACK_VOID_INT5(CLASS, PCLASS, CBNAME) \ | |
510 | void CLASS::CBNAME(int a, int b, int c, int d, int e) { \ | |
511 | bool found; \ | |
512 | wxPyBeginBlockThreads(); \ | |
513 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
514 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiiii)",a,b,c,d,e)); \ | |
515 | wxPyEndBlockThreads(); \ | |
516 | if (! found) \ | |
517 | PCLASS::CBNAME(a,b,c,d,e); \ | |
518 | } \ | |
519 | void CLASS::base_##CBNAME(int a, int b, int c, int d, int e) { \ | |
520 | PCLASS::CBNAME(a,b,c,d,e); \ | |
521 | } | |
522 | ||
523 | //--------------------------------------------------------------------------- | |
524 | ||
525 | #define DEC_PYCALLBACK_VOID_INTPINTP_const(CBNAME) \ | |
526 | void CBNAME(int* a, int* b) const; \ | |
527 | void base_##CBNAME(int* a, int* b) const; | |
528 | ||
529 | ||
530 | #define IMP_PYCALLBACK_VOID_INTPINTP_const(CLASS, PCLASS, CBNAME) \ | |
531 | void CLASS::CBNAME(int* a, int* b) const { \ | |
532 | const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ | |
533 | bool found; \ | |
534 | wxPyBeginBlockThreads(); \ | |
535 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
536 | PyObject* ro; \ | |
537 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
538 | if (ro) { \ | |
539 | if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ | |
540 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
541 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
542 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \ | |
543 | *a = PyInt_AsLong(o1); *b = PyInt_AsLong(o2); \ | |
544 | } \ | |
545 | else \ | |
546 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
547 | Py_DECREF(o1); \ | |
548 | Py_DECREF(o2); \ | |
549 | } \ | |
550 | else { \ | |
551 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
552 | } \ | |
553 | Py_DECREF(ro); \ | |
554 | } \ | |
555 | } \ | |
556 | wxPyEndBlockThreads(); \ | |
557 | if (! found) \ | |
558 | PCLASS::CBNAME(a,b); \ | |
559 | } \ | |
560 | void CLASS::base_##CBNAME(int* a, int* b) const { \ | |
561 | PCLASS::CBNAME(a,b); \ | |
562 | } | |
563 | ||
564 | ||
565 | //--------------------------------------------------------------------------- | |
566 | ||
567 | #define DEC_PYCALLBACK_SIZE_const(CBNAME) \ | |
568 | wxSize CBNAME() const; \ | |
569 | wxSize base_##CBNAME() const; | |
570 | ||
571 | ||
572 | #define IMP_PYCALLBACK_SIZE_const(CLASS, PCLASS, CBNAME) \ | |
573 | wxSize CLASS::CBNAME() const { \ | |
574 | const char* errmsg = #CBNAME " should return a 2-tuple of integers."; \ | |
575 | bool found; wxSize rval(0,0); \ | |
576 | wxPyBeginBlockThreads(); \ | |
577 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
578 | PyObject* ro; \ | |
579 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
580 | if (ro) { \ | |
581 | if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ | |
582 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
583 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
584 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) { \ | |
585 | rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \ | |
586 | } \ | |
587 | else \ | |
588 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
589 | Py_DECREF(o1); \ | |
590 | Py_DECREF(o2); \ | |
591 | } \ | |
592 | else { \ | |
593 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
594 | } \ | |
595 | Py_DECREF(ro); \ | |
596 | } \ | |
597 | } \ | |
598 | wxPyEndBlockThreads(); \ | |
599 | if (! found) \ | |
600 | return PCLASS::CBNAME(); \ | |
601 | else \ | |
602 | return rval; \ | |
603 | } \ | |
604 | wxSize CLASS::base_##CBNAME() const { \ | |
605 | return PCLASS::CBNAME(); \ | |
606 | } | |
607 | ||
608 | ||
609 | //--------------------------------------------------------------------------- | |
610 | ||
d559219f RD |
611 | #define DEC_PYCALLBACK_BOOL_INT(CBNAME) \ |
612 | bool CBNAME(int a); \ | |
613 | bool base_##CBNAME(int a); | |
614 | ||
615 | ||
616 | #define IMP_PYCALLBACK_BOOL_INT(CLASS, PCLASS, CBNAME) \ | |
617 | bool CLASS::CBNAME(int a) { \ | |
059a841c | 618 | bool rval=FALSE, found; \ |
b0e5c039 | 619 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 620 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
059a841c | 621 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a));\ |
b0e5c039 | 622 | wxPyEndBlockThreads(); \ |
19a97bd6 | 623 | if (! found) \ |
d559219f | 624 | rval = PCLASS::CBNAME(a); \ |
d559219f | 625 | return rval; \ |
bb0054cd | 626 | } \ |
d559219f | 627 | bool CLASS::base_##CBNAME(int a) { \ |
bb0054cd RD |
628 | return PCLASS::CBNAME(a); \ |
629 | } | |
630 | ||
efc5f224 RD |
631 | //--------------------------------------------------------------------------- |
632 | ||
d559219f RD |
633 | #define DEC_PYCALLBACK_BOOL_INT_pure(CBNAME) \ |
634 | bool CBNAME(int a); | |
635 | ||
636 | ||
637 | #define IMP_PYCALLBACK_BOOL_INT_pure(CLASS, PCLASS, CBNAME) \ | |
638 | bool CLASS::CBNAME(int a) { \ | |
059a841c | 639 | bool rval=FALSE; \ |
4268f798 | 640 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 641 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1e7ecb7b | 642 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)",a)); \ |
194fa2ac | 643 | else rval = FALSE; \ |
4268f798 | 644 | wxPyEndBlockThreads(); \ |
d559219f | 645 | return rval; \ |
bb0054cd RD |
646 | } |
647 | ||
648 | ||
649 | //--------------------------------------------------------------------------- | |
650 | ||
d559219f RD |
651 | #define DEC_PYCALLBACK__DC(CBNAME) \ |
652 | void CBNAME(wxDC& a); \ | |
653 | void base_##CBNAME(wxDC& a); | |
654 | ||
655 | ||
19a97bd6 RD |
656 | #define IMP_PYCALLBACK__DC(CLASS, PCLASS, CBNAME) \ |
657 | void CLASS::CBNAME(wxDC& a) { \ | |
658 | bool found; \ | |
4268f798 | 659 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
660 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
661 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
662 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
663 | Py_DECREF(obj); \ | |
664 | } \ | |
4268f798 | 665 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
666 | if (! found) \ |
667 | PCLASS::CBNAME(a); \ | |
668 | } \ | |
669 | void CLASS::base_##CBNAME(wxDC& a) { \ | |
670 | PCLASS::CBNAME(a); \ | |
bb0054cd RD |
671 | } |
672 | ||
efc5f224 RD |
673 | |
674 | ||
bb0054cd RD |
675 | //--------------------------------------------------------------------------- |
676 | ||
d559219f RD |
677 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
678 | void CBNAME(wxDC& a, bool b); \ | |
679 | void base_##CBNAME(wxDC& a, bool b); | |
680 | ||
681 | ||
682 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ | |
683 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
19a97bd6 | 684 | bool found; \ |
4268f798 | 685 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
686 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
687 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 688 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ |
de20db99 RD |
689 | Py_DECREF(obj); \ |
690 | } \ | |
4268f798 | 691 | wxPyEndBlockThreads(); \ |
19a97bd6 | 692 | if (! found) \ |
efc5f224 RD |
693 | PCLASS::CBNAME(a, b); \ |
694 | } \ | |
d559219f | 695 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ |
efc5f224 RD |
696 | PCLASS::CBNAME(a, b); \ |
697 | } | |
698 | ||
699 | //--------------------------------------------------------------------------- | |
700 | ||
d559219f RD |
701 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
702 | void CBNAME(wxDC& a, bool b); \ | |
703 | void base_##CBNAME(wxDC& a, bool b); | |
704 | ||
705 | ||
706 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ | |
707 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
19a97bd6 | 708 | bool found; \ |
4268f798 | 709 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
710 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
711 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 712 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ |
de20db99 RD |
713 | Py_DECREF(obj); \ |
714 | } \ | |
4268f798 | 715 | wxPyEndBlockThreads(); \ |
19a97bd6 | 716 | if (! found) \ |
efc5f224 RD |
717 | PCLASS::CBNAME(a, b); \ |
718 | } \ | |
d559219f | 719 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ |
efc5f224 RD |
720 | PCLASS::CBNAME(a, b); \ |
721 | } | |
722 | ||
723 | //--------------------------------------------------------------------------- | |
724 | ||
d559219f RD |
725 | #define DEC_PYCALLBACK__2DBL(CBNAME) \ |
726 | void CBNAME(double a, double b); \ | |
727 | void base_##CBNAME(double a, double b); | |
728 | ||
729 | ||
19a97bd6 RD |
730 | #define IMP_PYCALLBACK__2DBL(CLASS, PCLASS, CBNAME) \ |
731 | void CLASS::CBNAME(double a, double b) { \ | |
732 | bool found; \ | |
4268f798 | 733 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
734 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
735 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(dd)",a,b)); \ | |
4268f798 | 736 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
737 | if (! found) \ |
738 | PCLASS::CBNAME(a, b); \ | |
739 | } \ | |
740 | void CLASS::base_##CBNAME(double a, double b) { \ | |
741 | PCLASS::CBNAME(a, b); \ | |
efc5f224 RD |
742 | } |
743 | ||
744 | //--------------------------------------------------------------------------- | |
745 | ||
d559219f RD |
746 | #define DEC_PYCALLBACK__2DBL2INT(CBNAME) \ |
747 | void CBNAME(double a, double b, int c, int d); \ | |
748 | void base_##CBNAME(double a, double b, int c, int d); | |
749 | ||
750 | ||
751 | #define IMP_PYCALLBACK__2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
752 | void CLASS::CBNAME(double a, double b, int c, int d) { \ | |
19a97bd6 | 753 | bool found; \ |
4268f798 | 754 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
755 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
756 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddii)", \ | |
efc5f224 | 757 | a,b,c,d)); \ |
4268f798 | 758 | wxPyEndBlockThreads(); \ |
19a97bd6 | 759 | if (! found) \ |
efc5f224 RD |
760 | PCLASS::CBNAME(a, b, c, d); \ |
761 | } \ | |
d559219f | 762 | void CLASS::base_##CBNAME(double a, double b, int c, int d) { \ |
efc5f224 RD |
763 | PCLASS::CBNAME(a, b, c, d); \ |
764 | } | |
765 | ||
766 | //--------------------------------------------------------------------------- | |
767 | ||
19a97bd6 | 768 | #define DEC_PYCALLBACK__DC4DBLBOOL(CBNAME) \ |
d559219f RD |
769 | void CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ |
770 | void base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f); | |
771 | ||
772 | ||
773 | #define IMP_PYCALLBACK__DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ | |
774 | void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ | |
19a97bd6 | 775 | bool found; \ |
4268f798 | 776 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
777 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
778 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 779 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f)); \ |
de20db99 RD |
780 | Py_DECREF(obj); \ |
781 | } \ | |
4268f798 | 782 | wxPyEndBlockThreads(); \ |
19a97bd6 | 783 | if (! found) \ |
d559219f | 784 | PCLASS::CBNAME(a, b, c, d, e, f); \ |
d559219f RD |
785 | } \ |
786 | void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ | |
787 | PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
788 | } |
789 | ||
790 | //--------------------------------------------------------------------------- | |
791 | ||
d559219f RD |
792 | #define DEC_PYCALLBACK_BOOL_DC4DBLBOOL(CBNAME) \ |
793 | bool CBNAME(wxDC& a, double b, double c, double d, double e, bool f); \ | |
794 | bool base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f); | |
795 | ||
796 | ||
797 | #define IMP_PYCALLBACK_BOOL_DC4DBLBOOL(CLASS, PCLASS, CBNAME) \ | |
798 | bool CLASS::CBNAME(wxDC& a, double b, double c, double d, double e, bool f) { \ | |
19a97bd6 | 799 | bool found; \ |
4268f798 | 800 | wxPyBeginBlockThreads(); \ |
059a841c | 801 | bool rval=FALSE; \ |
19a97bd6 RD |
802 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
803 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 804 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddddi)", obj, b, c, d, e, (int)f));\ |
de20db99 RD |
805 | Py_DECREF(obj); \ |
806 | } \ | |
4268f798 | 807 | wxPyEndBlockThreads(); \ |
19a97bd6 | 808 | if (! found) \ |
99a49d3e | 809 | rval = PCLASS::CBNAME(a, b, c, d, e, f); \ |
99a49d3e | 810 | return rval; \ |
d559219f RD |
811 | } \ |
812 | bool CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e, bool f) {\ | |
813 | return PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
814 | } |
815 | ||
816 | //--------------------------------------------------------------------------- | |
817 | ||
d559219f RD |
818 | #define DEC_PYCALLBACK__BOOL2DBL2INT(CBNAME) \ |
819 | void CBNAME(bool a, double b, double c, int d, int e); \ | |
820 | void base_##CBNAME(bool a, double b, double c, int d, int e); | |
821 | ||
822 | ||
823 | #define IMP_PYCALLBACK__BOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
824 | void CLASS::CBNAME(bool a, double b, double c, int d, int e) { \ | |
19a97bd6 | 825 | bool found; \ |
4268f798 | 826 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 827 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
f2e1c18a | 828 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddii)", \ |
d559219f | 829 | (int)a,b,c,d,e)); \ |
4268f798 | 830 | wxPyEndBlockThreads(); \ |
19a97bd6 | 831 | if (! found) \ |
d559219f | 832 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
833 | } \ |
834 | void CLASS::base_##CBNAME(bool a, double b, double c, int d, int e) { \ | |
835 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
836 | } |
837 | ||
838 | //--------------------------------------------------------------------------- | |
839 | ||
19a97bd6 | 840 | #define DEC_PYCALLBACK__DC4DBL(CBNAME) \ |
d559219f RD |
841 | void CBNAME(wxDC& a, double b, double c, double d, double e); \ |
842 | void base_##CBNAME(wxDC& a, double b, double c, double d, double e); | |
843 | ||
844 | ||
845 | #define IMP_PYCALLBACK__DC4DBL(CLASS, PCLASS, CBNAME) \ | |
846 | void CLASS::CBNAME(wxDC& a, double b, double c, double d, double e) { \ | |
19a97bd6 | 847 | bool found; \ |
4268f798 | 848 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
849 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
850 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
1e7ecb7b | 851 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Odddd)", obj, b, c, d, e)); \ |
de20db99 RD |
852 | Py_DECREF(obj); \ |
853 | } \ | |
4268f798 | 854 | wxPyEndBlockThreads(); \ |
19a97bd6 | 855 | if (! found) \ |
d559219f | 856 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
857 | } \ |
858 | void CLASS::base_##CBNAME(wxDC& a, double b, double c, double d, double e) {\ | |
859 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
860 | } |
861 | ||
862 | //--------------------------------------------------------------------------- | |
863 | ||
d559219f RD |
864 | #define DEC_PYCALLBACK__DCBOOL(CBNAME) \ |
865 | void CBNAME(wxDC& a, bool b); \ | |
866 | void base_##CBNAME(wxDC& a, bool b); | |
867 | ||
868 | ||
19a97bd6 RD |
869 | #define IMP_PYCALLBACK__DCBOOL(CLASS, PCLASS, CBNAME) \ |
870 | void CLASS::CBNAME(wxDC& a, bool b) { \ | |
871 | bool found; \ | |
4268f798 | 872 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
873 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
874 | PyObject* obj = wxPyMake_wxObject(&a); \ | |
875 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oi)", obj, (int)b)); \ | |
876 | Py_DECREF(obj); \ | |
877 | } \ | |
4268f798 | 878 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
879 | if (! found) \ |
880 | PCLASS::CBNAME(a, b); \ | |
881 | } \ | |
882 | void CLASS::base_##CBNAME(wxDC& a, bool b) { \ | |
883 | PCLASS::CBNAME(a, b); \ | |
efc5f224 | 884 | } |
bb0054cd | 885 | |
7bf85405 | 886 | //--------------------------------------------------------------------------- |
7bf85405 | 887 | |
d559219f RD |
888 | #define DEC_PYCALLBACK__WXCPBOOL2DBL2INT(CBNAME) \ |
889 | void CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); \ | |
890 | void base_##CBNAME(wxControlPoint* a, bool b, double c, double d, int e, int f); | |
891 | ||
892 | ||
893 | #define IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
894 | void CLASS::CBNAME(wxControlPoint* a, bool b, double c, double d, \ | |
895 | int e, int f) { \ | |
19a97bd6 | 896 | bool found; \ |
4268f798 | 897 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
898 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
899 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1e7ecb7b | 900 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oiddii)", obj, (int)b, c, d, e, f));\ |
de20db99 RD |
901 | Py_DECREF(obj); \ |
902 | } \ | |
4268f798 | 903 | wxPyEndBlockThreads(); \ |
19a97bd6 | 904 | if (! found) \ |
d559219f | 905 | PCLASS::CBNAME(a, b, c, d, e, f); \ |
d559219f RD |
906 | } \ |
907 | void CLASS::base_##CBNAME(wxControlPoint* a, bool b, double c, double d, \ | |
908 | int e, int f) { \ | |
909 | PCLASS::CBNAME(a, b, c, d, e, f); \ | |
efc5f224 RD |
910 | } |
911 | ||
912 | //--------------------------------------------------------------------------- | |
913 | ||
d559219f RD |
914 | #define DEC_PYCALLBACK__WXCP2DBL2INT(CBNAME) \ |
915 | void CBNAME(wxControlPoint* a, double b, double c, int d, int e); \ | |
916 | void base_##CBNAME(wxControlPoint* a, double b, double c, int d, int e); | |
917 | ||
918 | ||
919 | #define IMP_PYCALLBACK__WXCP2DBL2INT(CLASS, PCLASS, CBNAME) \ | |
920 | void CLASS::CBNAME(wxControlPoint* a, double b, double c, int d, int e) { \ | |
19a97bd6 | 921 | bool found; \ |
4268f798 | 922 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
923 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
924 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1e7ecb7b | 925 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(Oddii)", obj, b, c, d, e)); \ |
de20db99 RD |
926 | Py_DECREF(obj); \ |
927 | } \ | |
4268f798 | 928 | wxPyEndBlockThreads(); \ |
19a97bd6 | 929 | if (! found) \ |
d559219f | 930 | PCLASS::CBNAME(a, b, c, d, e); \ |
d559219f RD |
931 | } \ |
932 | void CLASS::base_##CBNAME(wxControlPoint* a, double b, double c, \ | |
933 | int d, int e) { \ | |
934 | PCLASS::CBNAME(a, b, c, d, e); \ | |
efc5f224 RD |
935 | } |
936 | ||
937 | //--------------------------------------------------------------------------- | |
938 | ||
d559219f RD |
939 | #define DEC_PYCALLBACK__2DBLINT(CBNAME) \ |
940 | void CBNAME(double a, double b, int c); \ | |
941 | void base_##CBNAME(double a, double b, int c); | |
942 | ||
943 | ||
19a97bd6 RD |
944 | #define IMP_PYCALLBACK__2DBLINT(CLASS, PCLASS, CBNAME) \ |
945 | void CLASS::CBNAME(double a, double b, int c) { \ | |
946 | bool found; \ | |
4268f798 | 947 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
948 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
949 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(ddi)", a,b,c)); \ | |
4268f798 | 950 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
951 | if (! found) \ |
952 | PCLASS::CBNAME(a, b, c); \ | |
953 | } \ | |
954 | void CLASS::base_##CBNAME(double a, double b, int c) { \ | |
955 | PCLASS::CBNAME(a, b, c); \ | |
efc5f224 RD |
956 | } |
957 | ||
958 | //--------------------------------------------------------------------------- | |
959 | ||
d559219f RD |
960 | #define DEC_PYCALLBACK__BOOL2DBLINT(CBNAME) \ |
961 | void CBNAME(bool a, double b, double c, int d); \ | |
962 | void base_##CBNAME(bool a, double b, double c, int d); | |
963 | ||
964 | ||
965 | #define IMP_PYCALLBACK__BOOL2DBLINT(CLASS, PCLASS, CBNAME) \ | |
966 | void CLASS::CBNAME(bool a, double b, double c, int d) { \ | |
19a97bd6 | 967 | bool found; \ |
a66212dc | 968 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
969 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
970 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iddi)", (int)a,b,c,d));\ | |
a66212dc | 971 | wxPyEndBlockThreads(); \ |
19a97bd6 | 972 | if (! found) \ |
d559219f | 973 | PCLASS::CBNAME(a, b, c, d); \ |
d559219f RD |
974 | } \ |
975 | void CLASS::base_##CBNAME(bool a, double b, double c, int d) { \ | |
976 | PCLASS::CBNAME(a, b, c, d); \ | |
efc5f224 RD |
977 | } |
978 | ||
979 | //--------------------------------------------------------------------------- | |
980 | //--------------------------------------------------------------------------- | |
389c5527 RD |
981 | |
982 | #define DEC_PYCALLBACK__STRING(CBNAME) \ | |
983 | void CBNAME(const wxString& a); \ | |
984 | void base_##CBNAME(const wxString& a); | |
985 | ||
19a97bd6 RD |
986 | #define IMP_PYCALLBACK__STRING(CLASS, PCLASS, CBNAME) \ |
987 | void CLASS::CBNAME(const wxString& a) { \ | |
988 | bool found; \ | |
a66212dc RD |
989 | wxPyBeginBlockThreads(); \ |
990 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
991 | PyObject* s = wx2PyString(a); \ | |
992 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
993 | Py_DECREF(s); \ | |
994 | } \ | |
995 | wxPyEndBlockThreads(); \ | |
19a97bd6 RD |
996 | if (! found) \ |
997 | PCLASS::CBNAME(a); \ | |
998 | } \ | |
999 | void CLASS::base_##CBNAME(const wxString& a) { \ | |
1000 | PCLASS::CBNAME(a); \ | |
389c5527 RD |
1001 | } |
1002 | ||
1003 | //--------------------------------------------------------------------------- | |
1004 | ||
1005 | #define DEC_PYCALLBACK_BOOL_STRING(CBNAME) \ | |
1006 | bool CBNAME(const wxString& a); \ | |
1007 | bool base_##CBNAME(const wxString& a); | |
1008 | ||
389c5527 RD |
1009 | #define IMP_PYCALLBACK_BOOL_STRING(CLASS, PCLASS, CBNAME) \ |
1010 | bool CLASS::CBNAME(const wxString& a) { \ | |
059a841c | 1011 | bool rval=FALSE; \ |
19a97bd6 | 1012 | bool found; \ |
a66212dc RD |
1013 | wxPyBeginBlockThreads(); \ |
1014 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1015 | PyObject* s = wx2PyString(a); \ | |
1016 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
1017 | Py_DECREF(s); \ | |
1018 | } \ | |
1019 | wxPyEndBlockThreads(); \ | |
19a97bd6 | 1020 | if (! found) \ |
389c5527 | 1021 | rval = PCLASS::CBNAME(a); \ |
389c5527 RD |
1022 | return rval; \ |
1023 | } \ | |
1024 | bool CLASS::base_##CBNAME(const wxString& a) { \ | |
1025 | return PCLASS::CBNAME(a); \ | |
1026 | } | |
1027 | ||
1028 | //--------------------------------------------------------------------------- | |
1029 | ||
c368d904 RD |
1030 | #define DEC_PYCALLBACK_BOOL_STRING_pure(CBNAME) \ |
1031 | bool CBNAME(const wxString& a); | |
c8bc7bb8 | 1032 | |
a66212dc RD |
1033 | #define IMP_PYCALLBACK_BOOL_STRING_pure(CLASS, PCLASS, CBNAME) \ |
1034 | bool CLASS::CBNAME(const wxString& a) { \ | |
1035 | bool rval=FALSE; \ | |
1036 | wxPyBeginBlockThreads(); \ | |
1037 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
1038 | PyObject* s = wx2PyString(a); \ | |
1039 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", s)); \ | |
1040 | Py_DECREF(s); \ | |
1041 | } \ | |
1042 | wxPyEndBlockThreads(); \ | |
1043 | return rval; \ | |
1044 | } \ | |
c368d904 RD |
1045 | |
1046 | //--------------------------------------------------------------------------- | |
1047 | ||
1048 | #define DEC_PYCALLBACK_STRING_STRING_pure(CBNAME) \ | |
1049 | wxString CBNAME(const wxString& a); \ | |
1050 | ||
1051 | #define IMP_PYCALLBACK_STRING_STRING_pure(CLASS, PCLASS, CBNAME) \ | |
1052 | wxString CLASS::CBNAME(const wxString& a) { \ | |
1053 | wxString rval; \ | |
a541c325 | 1054 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1055 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1056 | PyObject* ro; \ |
a66212dc RD |
1057 | PyObject* s = wx2PyString(a); \ |
1058 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \ | |
1059 | Py_DECREF(s); \ | |
c368d904 | 1060 | if (ro) { \ |
a541c325 RD |
1061 | rval = Py2wxString(ro); \ |
1062 | Py_DECREF(ro); \ | |
c368d904 RD |
1063 | } \ |
1064 | } \ | |
a541c325 | 1065 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1066 | return rval; \ |
1067 | } \ | |
1068 | ||
1069 | //--------------------------------------------------------------------------- | |
1070 | ||
fd512ba2 RD |
1071 | #define DEC_PYCALLBACK_STRING_STRING(CBNAME) \ |
1072 | wxString CBNAME(const wxString& a); \ | |
1073 | wxString base_##CBNAME(const wxString& a); | |
1074 | ||
1075 | #define IMP_PYCALLBACK_STRING_STRING(CLASS, PCLASS, CBNAME) \ | |
1076 | wxString CLASS::CBNAME(const wxString& a) { \ | |
1077 | wxString rval; \ | |
1078 | bool found; \ | |
1079 | wxPyBeginBlockThreads(); \ | |
1080 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1081 | PyObject* ro; \ | |
1082 | PyObject* s = wx2PyString(a); \ | |
1083 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)", s)); \ | |
1084 | Py_DECREF(s); \ | |
1085 | if (ro) { \ | |
1086 | rval = Py2wxString(ro); \ | |
1087 | Py_DECREF(ro); \ | |
1088 | } \ | |
1089 | } \ | |
1090 | if (! found) \ | |
1091 | rval = PCLASS::CBNAME(a); \ | |
1092 | wxPyEndBlockThreads(); \ | |
1093 | return rval; \ | |
1094 | } \ | |
1095 | ||
1096 | //--------------------------------------------------------------------------- | |
1097 | ||
c368d904 RD |
1098 | #define DEC_PYCALLBACK_STRING_STRINGINT_pure(CBNAME) \ |
1099 | wxString CBNAME(const wxString& a,int b); \ | |
1100 | ||
1101 | #define IMP_PYCALLBACK_STRING_STRINGINT_pure(CLASS, PCLASS, CBNAME) \ | |
1102 | wxString CLASS::CBNAME(const wxString& a,int b) { \ | |
1103 | wxString rval; \ | |
a66212dc | 1104 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1105 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1106 | PyObject* ro; \ |
a66212dc RD |
1107 | PyObject* s = wx2PyString(a); \ |
1108 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oi)",s,b)); \ | |
1109 | Py_DECREF(s); \ | |
c368d904 | 1110 | if (ro) { \ |
a541c325 RD |
1111 | rval = Py2wxString(ro); \ |
1112 | Py_DECREF(ro); \ | |
c368d904 RD |
1113 | } \ |
1114 | } \ | |
a541c325 | 1115 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1116 | return rval; \ |
1117 | } \ | |
1118 | ||
1119 | //--------------------------------------------------------------------------- | |
1120 | ||
f0261a72 RD |
1121 | #define DEC_PYCALLBACK_BOOL_STRINGSTRING(CBNAME) \ |
1122 | bool CBNAME(const wxString& a, const wxString& b); \ | |
1123 | bool base_##CBNAME(const wxString& a, const wxString& b); | |
1124 | ||
f0261a72 RD |
1125 | #define IMP_PYCALLBACK_BOOL_STRINGSTRING(CLASS, PCLASS, CBNAME) \ |
1126 | bool CLASS::CBNAME(const wxString& a, const wxString& b) { \ | |
059a841c | 1127 | bool rval=FALSE; \ |
19a97bd6 | 1128 | bool found; \ |
a66212dc RD |
1129 | wxPyBeginBlockThreads(); \ |
1130 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1131 | PyObject* s1 = wx2PyString(a); \ | |
1132 | PyObject* s2 = wx2PyString(b); \ | |
1133 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(OO)",s1,s2)); \ | |
1134 | Py_DECREF(s1); \ | |
1135 | Py_DECREF(s2); \ | |
1136 | } \ | |
a541c325 | 1137 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1138 | if (! found) \ |
f0261a72 | 1139 | rval = PCLASS::CBNAME(a, b); \ |
f0261a72 RD |
1140 | return rval; \ |
1141 | } \ | |
1142 | bool CLASS::base_##CBNAME(const wxString& a, const wxString& b) { \ | |
1143 | return PCLASS::CBNAME(a, b); \ | |
1144 | } | |
1145 | ||
1146 | //--------------------------------------------------------------------------- | |
1147 | ||
389c5527 RD |
1148 | #define DEC_PYCALLBACK_STRING_(CBNAME) \ |
1149 | wxString CBNAME(); \ | |
1150 | wxString base_##CBNAME(); | |
1151 | ||
389c5527 RD |
1152 | #define IMP_PYCALLBACK_STRING_(CLASS, PCLASS, CBNAME) \ |
1153 | wxString CLASS::CBNAME() { \ | |
1154 | wxString rval; \ | |
19a97bd6 | 1155 | bool found; \ |
4268f798 | 1156 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1157 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
389c5527 | 1158 | PyObject* ro; \ |
19a97bd6 | 1159 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 | 1160 | if (ro) { \ |
a541c325 RD |
1161 | rval = Py2wxString(ro); \ |
1162 | Py_DECREF(ro); \ | |
f6bcfd97 | 1163 | } \ |
389c5527 | 1164 | } \ |
a541c325 | 1165 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1166 | if (! found) \ |
b1462dfa | 1167 | rval = PCLASS::CBNAME(); \ |
389c5527 RD |
1168 | return rval; \ |
1169 | } \ | |
b1462dfa RD |
1170 | wxString CLASS::base_##CBNAME() { \ |
1171 | return PCLASS::CBNAME(); \ | |
389c5527 RD |
1172 | } |
1173 | ||
1174 | //--------------------------------------------------------------------------- | |
1175 | ||
1176 | #define DEC_PYCALLBACK_STRING__pure(CBNAME) \ | |
1177 | wxString CBNAME(); | |
1178 | ||
389c5527 RD |
1179 | #define IMP_PYCALLBACK_STRING__pure(CLASS, PCLASS, CBNAME) \ |
1180 | wxString CLASS::CBNAME() { \ | |
1181 | wxString rval; \ | |
4268f798 | 1182 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1183 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
389c5527 | 1184 | PyObject* ro; \ |
19a97bd6 | 1185 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 | 1186 | if (ro) { \ |
a541c325 RD |
1187 | rval = Py2wxString(ro); \ |
1188 | Py_DECREF(ro); \ | |
f6bcfd97 | 1189 | } \ |
389c5527 | 1190 | } \ |
a541c325 | 1191 | wxPyEndBlockThreads(); \ |
389c5527 RD |
1192 | return rval; \ |
1193 | } | |
1194 | ||
1195 | //--------------------------------------------------------------------------- | |
1196 | ||
1197 | #define DEC_PYCALLBACK_BOOL_TAG_pure(CBNAME) \ | |
1198 | bool CBNAME(const wxHtmlTag& a); \ | |
1199 | ||
1200 | ||
1201 | #define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \ | |
1202 | bool CLASS::CBNAME(const wxHtmlTag& a) { \ | |
059a841c | 1203 | bool rval=FALSE; \ |
a66212dc | 1204 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1205 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
1206 | PyObject* obj = wxPyConstructObject((void*)&a, "wxHtmlTag", 0); \ | |
1207 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
de20db99 RD |
1208 | Py_DECREF(obj); \ |
1209 | } \ | |
a66212dc | 1210 | wxPyEndBlockThreads(); \ |
389c5527 RD |
1211 | return rval; \ |
1212 | } | |
1213 | ||
0122b7e3 RD |
1214 | //--------------------------------------------------------------------------- |
1215 | ||
1216 | #define DEC_PYCALLBACK__CELLINTINT(CBNAME) \ | |
1217 | void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); \ | |
1218 | void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y); | |
1219 | ||
1220 | #define IMP_PYCALLBACK__CELLINTINT(CLASS, PCLASS, CBNAME) \ | |
1221 | void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ | |
0122b7e3 | 1222 | bool found; \ |
a66212dc | 1223 | wxPyBeginBlockThreads(); \ |
0122b7e3 RD |
1224 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1225 | PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ | |
1226 | wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(Oii)",obj,x,y)); \ | |
1227 | Py_DECREF(obj); \ | |
1228 | } \ | |
a66212dc | 1229 | wxPyEndBlockThreads(); \ |
0122b7e3 RD |
1230 | if (! found) \ |
1231 | PCLASS::CBNAME(cell, x, y); \ | |
1232 | } \ | |
1233 | void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y) { \ | |
1234 | PCLASS::CBNAME(cell, x, y); \ | |
1235 | } | |
1236 | ||
1237 | ||
1238 | //--------------------------------------------------------------------------- | |
1239 | ||
1240 | #define DEC_PYCALLBACK__CELLINTINTME(CBNAME) \ | |
1241 | void CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); \ | |
1242 | void base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e); | |
1243 | ||
1244 | #define IMP_PYCALLBACK__CELLINTINTME(CLASS, PCLASS, CBNAME) \ | |
1245 | void CLASS::CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ | |
1246 | bool found; \ | |
a66212dc | 1247 | wxPyBeginBlockThreads(); \ |
0122b7e3 RD |
1248 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1249 | PyObject* obj = wxPyConstructObject((void*)cell, "wxHtmlCell", 0); \ | |
1250 | PyObject* o2 = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ | |
1251 | wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OiiO)",obj,x,y,o2)); \ | |
1252 | Py_DECREF(obj); \ | |
1253 | Py_DECREF(o2); \ | |
1254 | } \ | |
a66212dc | 1255 | wxPyEndBlockThreads(); \ |
0122b7e3 | 1256 | if (! found) \ |
a66212dc | 1257 | PCLASS::CBNAME(cell, x, y, e); \ |
0122b7e3 RD |
1258 | } \ |
1259 | void CLASS::base_##CBNAME(wxHtmlCell *cell, wxCoord x, wxCoord y, const wxMouseEvent& e) { \ | |
a66212dc | 1260 | PCLASS::CBNAME(cell, x, y, e); \ |
0122b7e3 RD |
1261 | } |
1262 | ||
1263 | ||
1264 | ||
389c5527 | 1265 | //--------------------------------------------------------------------------- |
2f90df85 RD |
1266 | |
1267 | #define DEC_PYCALLBACK___pure(CBNAME) \ | |
1268 | void CBNAME(); \ | |
1269 | ||
1270 | ||
1271 | #define IMP_PYCALLBACK___pure(CLASS, PCLASS, CBNAME) \ | |
1272 | void CLASS::CBNAME() { \ | |
a66212dc | 1273 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1274 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1275 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
a66212dc | 1276 | wxPyEndBlockThreads(); \ |
2f90df85 RD |
1277 | } |
1278 | ||
1279 | //--------------------------------------------------------------------------- | |
1280 | ||
1281 | #define DEC_PYCALLBACK_wxSize__pure(CBNAME) \ | |
1282 | wxSize CBNAME(); \ | |
1283 | ||
1284 | ||
1285 | #define IMP_PYCALLBACK_wxSize__pure(CLASS, PCLASS, CBNAME) \ | |
1286 | wxSize CLASS::CBNAME() { \ | |
db0ff83e | 1287 | const char* errmsg = #CBNAME " should return a 2-tuple of integers or a wxSize object."; \ |
2f90df85 | 1288 | wxSize rval(0,0); \ |
db0ff83e | 1289 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1290 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
2f90df85 RD |
1291 | PyObject* ro; \ |
1292 | wxSize* ptr; \ | |
19a97bd6 | 1293 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ |
f6bcfd97 BP |
1294 | if (ro) { \ |
1295 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxSize_p")) \ | |
1296 | rval = *ptr; \ | |
db0ff83e RD |
1297 | else if (PySequence_Check(ro) && PyObject_Length(ro) == 2) { \ |
1298 | PyObject* o1 = PySequence_GetItem(ro, 0); \ | |
1299 | PyObject* o2 = PySequence_GetItem(ro, 1); \ | |
1300 | if (PyNumber_Check(o1) && PyNumber_Check(o2)) \ | |
1301 | rval = wxSize(PyInt_AsLong(o1), PyInt_AsLong(o2)); \ | |
1302 | else \ | |
1303 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
1304 | Py_DECREF(o1); \ | |
1305 | Py_DECREF(o2); \ | |
1306 | } \ | |
1307 | else { \ | |
1308 | PyErr_SetString(PyExc_TypeError, errmsg); \ | |
1309 | } \ | |
f6bcfd97 BP |
1310 | Py_DECREF(ro); \ |
1311 | } \ | |
2f90df85 | 1312 | } \ |
db0ff83e | 1313 | wxPyEndBlockThreads(); \ |
2f90df85 RD |
1314 | return rval; \ |
1315 | } | |
1316 | ||
1317 | //--------------------------------------------------------------------------- | |
1318 | ||
1319 | #define DEC_PYCALLBACK_BOOL_WXWIN(CBNAME) \ | |
1320 | bool CBNAME(wxWindow* a); \ | |
1321 | bool base_##CBNAME(wxWindow* a); | |
1322 | ||
1323 | ||
19a97bd6 RD |
1324 | #define IMP_PYCALLBACK_BOOL_WXWIN(CLASS, PCLASS, CBNAME) \ |
1325 | bool CLASS::CBNAME(wxWindow* a) { \ | |
059a841c | 1326 | bool rval=FALSE; \ |
19a97bd6 | 1327 | bool found; \ |
a66212dc | 1328 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1329 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1330 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1331 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1332 | Py_DECREF(obj); \ | |
1333 | } \ | |
a66212dc | 1334 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1335 | if (! found) \ |
1336 | rval = PCLASS::CBNAME(a); \ | |
1337 | return rval; \ | |
1338 | } \ | |
1339 | bool CLASS::base_##CBNAME(wxWindow* a) { \ | |
1340 | return PCLASS::CBNAME(a); \ | |
2f90df85 RD |
1341 | } |
1342 | ||
389c5527 | 1343 | //--------------------------------------------------------------------------- |
2f90df85 | 1344 | |
aaad759f RD |
1345 | #define DEC_PYCALLBACK_VOID_WXWINBASE(CBNAME) \ |
1346 | void CBNAME(wxWindowBase* a); \ | |
1347 | void base_##CBNAME(wxWindowBase* a); | |
1348 | ||
1349 | ||
1350 | #define IMP_PYCALLBACK_VOID_WXWINBASE(CLASS, PCLASS, CBNAME) \ | |
1351 | void CLASS::CBNAME(wxWindowBase* a) { \ | |
1352 | bool found; \ | |
1353 | wxPyBeginBlockThreads(); \ | |
1354 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1355 | PyObject* obj = wxPyMake_wxObject(a); \ | |
1356 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1357 | Py_DECREF(obj); \ | |
1358 | } \ | |
1359 | wxPyEndBlockThreads(); \ | |
1360 | if (! found) \ | |
1361 | PCLASS::CBNAME(a); \ | |
1362 | } \ | |
1363 | void CLASS::base_##CBNAME(wxWindowBase* a) { \ | |
1364 | PCLASS::CBNAME(a); \ | |
1365 | } | |
1366 | ||
1367 | //--------------------------------------------------------------------------- | |
1368 | ||
2f90df85 RD |
1369 | #define DEC_PYCALLBACK_BOOL_(CBNAME) \ |
1370 | bool CBNAME(); \ | |
1371 | bool base_##CBNAME(); | |
1372 | ||
1373 | ||
19a97bd6 RD |
1374 | #define IMP_PYCALLBACK_BOOL_(CLASS, PCLASS, CBNAME) \ |
1375 | bool CLASS::CBNAME() { \ | |
059a841c | 1376 | bool rval=FALSE; \ |
19a97bd6 | 1377 | bool found; \ |
b0e5c039 | 1378 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1379 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1380 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
b0e5c039 | 1381 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1382 | if (! found) \ |
1383 | rval = PCLASS::CBNAME(); \ | |
1384 | return rval; \ | |
1385 | } \ | |
1386 | bool CLASS::base_##CBNAME() { \ | |
1387 | return PCLASS::CBNAME(); \ | |
2f90df85 RD |
1388 | } |
1389 | ||
b1462dfa RD |
1390 | //--------------------------------------------------------------------------- |
1391 | ||
b0e5c039 RD |
1392 | #define DEC_PYCALLBACK_BOOL_const(CBNAME) \ |
1393 | bool CBNAME() const; \ | |
1394 | bool base_##CBNAME() const; | |
1395 | ||
1396 | ||
1397 | #define IMP_PYCALLBACK_BOOL_const(CLASS, PCLASS, CBNAME) \ | |
1398 | bool CLASS::CBNAME() const { \ | |
1399 | bool rval=FALSE; \ | |
1400 | bool found; \ | |
1401 | wxPyBeginBlockThreads(); \ | |
1402 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ | |
1403 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
1404 | wxPyEndBlockThreads(); \ | |
1405 | if (! found) \ | |
1406 | rval = PCLASS::CBNAME(); \ | |
1407 | return rval; \ | |
1408 | } \ | |
1409 | bool CLASS::base_##CBNAME() const { \ | |
1410 | return PCLASS::CBNAME(); \ | |
1411 | } | |
1412 | ||
1413 | //--------------------------------------------------------------------------- | |
1414 | ||
19a97bd6 RD |
1415 | #define DEC_PYCALLBACK_DR_2WXCDR(CBNAME) \ |
1416 | wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); \ | |
b1462dfa RD |
1417 | wxDragResult base_##CBNAME(wxCoord x, wxCoord y, wxDragResult def); |
1418 | ||
1419 | ||
19a97bd6 RD |
1420 | #define IMP_PYCALLBACK_DR_2WXCDR(CLASS, PCLASS, CBNAME) \ |
1421 | wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
059a841c | 1422 | int rval=0; \ |
19a97bd6 | 1423 | bool found; \ |
cac344f6 | 1424 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1425 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1e7ecb7b | 1426 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ |
cac344f6 | 1427 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1428 | if (! found) \ |
1429 | rval = PCLASS::CBNAME(a, b, c); \ | |
1430 | return (wxDragResult)rval; \ | |
1431 | } \ | |
1432 | wxDragResult CLASS::base_##CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
1433 | return PCLASS::CBNAME(a, b, c); \ | |
b1462dfa RD |
1434 | } |
1435 | ||
1436 | //--------------------------------------------------------------------------- | |
1437 | ||
c368d904 RD |
1438 | #define DEC_PYCALLBACK_FSF_FSSTRING_pure(CBNAME) \ |
1439 | wxFSFile* CBNAME(wxFileSystem& fs, const wxString& location); \ | |
1440 | ||
1441 | #define IMP_PYCALLBACK_FSF_FSSTRING_pure(CLASS, PCLASS, CBNAME) \ | |
1442 | wxFSFile* CLASS::CBNAME(wxFileSystem& a,const wxString& b) { \ | |
cac344f6 | 1443 | wxPyBeginBlockThreads(); \ |
c368d904 | 1444 | wxFSFile* rval=0; \ |
19a97bd6 | 1445 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
c368d904 | 1446 | PyObject* ro; \ |
19a97bd6 | 1447 | PyObject* obj = wxPyMake_wxObject(&a); \ |
a66212dc | 1448 | PyObject* s = wx2PyString(b); \ |
a541c325 | 1449 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(OO)",\ |
a66212dc | 1450 | obj, s)); \ |
c368d904 RD |
1451 | if (ro) { \ |
1452 | SWIG_GetPtrObj(ro, (void **)&rval, "_wxFSFILE_p"); \ | |
1453 | Py_DECREF(ro); \ | |
1454 | } \ | |
de20db99 | 1455 | Py_DECREF(obj); \ |
a66212dc | 1456 | Py_DECREF(s); \ |
de20db99 | 1457 | } \ |
cac344f6 | 1458 | wxPyEndBlockThreads(); \ |
c368d904 RD |
1459 | return rval; \ |
1460 | }; | |
1461 | ||
1462 | //--------------------------------------------------------------------------- | |
1463 | ||
b1462dfa RD |
1464 | #define DEC_PYCALLBACK_BOOL_DR(CBNAME) \ |
1465 | bool CBNAME(wxDragResult a); \ | |
1466 | bool base_##CBNAME(wxDragResult a); | |
1467 | ||
1468 | ||
1469 | #define IMP_PYCALLBACK_BOOL_DR(CLASS, PCLASS, CBNAME) \ | |
1470 | bool CLASS::CBNAME(wxDragResult a) { \ | |
059a841c | 1471 | bool rval=FALSE; \ |
19a97bd6 | 1472 | bool found; \ |
a541c325 | 1473 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1474 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1475 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(i)", a));\ | |
a541c325 | 1476 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1477 | if (! found) \ |
b1462dfa | 1478 | rval = PCLASS::CBNAME(a); \ |
b1462dfa RD |
1479 | return rval; \ |
1480 | } \ | |
1481 | bool CLASS::base_##CBNAME(wxDragResult a) { \ | |
1482 | return PCLASS::CBNAME(a); \ | |
1483 | } | |
1484 | ||
1485 | //--------------------------------------------------------------------------- | |
1486 | ||
1487 | #define DEC_PYCALLBACK_DR_2WXCDR_pure(CBNAME) \ | |
1488 | wxDragResult CBNAME(wxCoord x, wxCoord y, wxDragResult def); | |
1489 | ||
1490 | ||
1491 | #define IMP_PYCALLBACK_DR_2WXCDR_pure(CLASS, PCLASS, CBNAME) \ | |
1492 | wxDragResult CLASS::CBNAME(wxCoord a, wxCoord b, wxDragResult c) { \ | |
a541c325 | 1493 | wxPyBeginBlockThreads(); \ |
059a841c | 1494 | int rval=0; \ |
19a97bd6 | 1495 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) \ |
1e7ecb7b | 1496 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iii)", a,b,c));\ |
a541c325 | 1497 | wxPyEndBlockThreads(); \ |
b1462dfa RD |
1498 | return (wxDragResult)rval; \ |
1499 | } \ | |
1500 | ||
1501 | //--------------------------------------------------------------------------- | |
1502 | ||
1503 | #define DEC_PYCALLBACK_BOOL_INTINTSTR_pure(CBNAME) \ | |
1504 | bool CBNAME(int a, int b, const wxString& c); | |
1505 | ||
b1462dfa RD |
1506 | #define IMP_PYCALLBACK_BOOL_INTINTSTR_pure(CLASS, PCLASS, CBNAME) \ |
1507 | bool CLASS::CBNAME(int a, int b, const wxString& c) { \ | |
059a841c | 1508 | bool rval=FALSE; \ |
a541c325 | 1509 | wxPyBeginBlockThreads(); \ |
a66212dc RD |
1510 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
1511 | PyObject* s = wx2PyString(c); \ | |
1512 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(iiO)",a,b,s));\ | |
1513 | Py_DECREF(s); \ | |
1514 | } \ | |
a541c325 | 1515 | wxPyEndBlockThreads(); \ |
b1462dfa RD |
1516 | return rval; \ |
1517 | } \ | |
1518 | ||
1519 | //--------------------------------------------------------------------------- | |
1520 | ||
1521 | #define DEC_PYCALLBACK_SIZET_(CBNAME) \ | |
1522 | size_t CBNAME(); \ | |
1523 | size_t base_##CBNAME(); | |
1524 | ||
1525 | ||
1526 | #define IMP_PYCALLBACK_SIZET_(CLASS, PCLASS, CBNAME) \ | |
1527 | size_t CLASS::CBNAME() { \ | |
059a841c | 1528 | size_t rval=0; \ |
19a97bd6 | 1529 | bool found; \ |
a541c325 | 1530 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1531 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) \ |
1532 | rval = wxPyCBH_callCallback(m_myInst, Py_BuildValue("()")); \ | |
a541c325 | 1533 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1534 | if (! found) \ |
b1462dfa | 1535 | rval = PCLASS::CBNAME(); \ |
b1462dfa RD |
1536 | return rval; \ |
1537 | } \ | |
1538 | size_t CLASS::base_##CBNAME() { \ | |
1539 | return PCLASS::CBNAME(); \ | |
1540 | } | |
1541 | ||
1542 | //--------------------------------------------------------------------------- | |
1543 | ||
c7e7022c RD |
1544 | #define DEC_PYCALLBACK_DATAFMT_SIZET(CBNAME) \ |
1545 | wxDataFormat CBNAME(size_t a); \ | |
1546 | wxDataFormat base_##CBNAME(size_t a); | |
b1462dfa RD |
1547 | |
1548 | ||
1549 | #define IMP_PYCALLBACK_DATAFMT_SIZET(CLASS, PCLASS, CBNAME) \ | |
1550 | wxDataFormat CLASS::CBNAME(size_t a) { \ | |
059a841c | 1551 | wxDataFormat rval=0; \ |
19a97bd6 | 1552 | bool found; \ |
a541c325 | 1553 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1554 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
b1462dfa RD |
1555 | PyObject* ro; \ |
1556 | wxDataFormat* ptr; \ | |
c7e7022c | 1557 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \ |
f6bcfd97 BP |
1558 | if (ro) { \ |
1559 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxDataFormat_p")) \ | |
1560 | rval = *ptr; \ | |
1561 | Py_DECREF(ro); \ | |
1562 | } \ | |
b1462dfa | 1563 | } \ |
a541c325 | 1564 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1565 | if (! found) \ |
b1462dfa | 1566 | rval = PCLASS::CBNAME(a); \ |
b1462dfa RD |
1567 | return rval; \ |
1568 | } \ | |
1569 | wxDataFormat CLASS::base_##CBNAME(size_t a) { \ | |
1570 | return PCLASS::CBNAME(a); \ | |
1571 | } | |
1572 | ||
389c5527 | 1573 | //--------------------------------------------------------------------------- |
f6bcfd97 BP |
1574 | |
1575 | #define DEC_PYCALLBACK__constany(CBNAME, Type) \ | |
1576 | void CBNAME(const Type& a); \ | |
1577 | void base_##CBNAME(const Type& a); | |
1578 | ||
1579 | ||
19a97bd6 RD |
1580 | #define IMP_PYCALLBACK__constany(CLASS, PCLASS, CBNAME, Type) \ |
1581 | void CLASS::CBNAME(const Type& a) { \ | |
1582 | bool found; \ | |
a541c325 | 1583 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1584 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1585 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1586 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1587 | Py_DECREF(obj); \ | |
1588 | } \ | |
a541c325 | 1589 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1590 | if (! found) \ |
1591 | PCLASS::CBNAME(a); \ | |
1592 | } \ | |
1593 | void CLASS::base_##CBNAME(const Type& a) { \ | |
1594 | PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1595 | } |
1596 | ||
1597 | ||
1598 | //--------------------------------------------------------------------------- | |
1599 | ||
1600 | #define DEC_PYCALLBACK__any(CBNAME, Type) \ | |
1601 | void CBNAME(Type& a); \ | |
1602 | void base_##CBNAME(Type& a); | |
1603 | ||
1604 | ||
19a97bd6 RD |
1605 | #define IMP_PYCALLBACK__any(CLASS, PCLASS, CBNAME, Type) \ |
1606 | void CLASS::CBNAME(Type& a) { \ | |
1607 | bool found; \ | |
a541c325 | 1608 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1609 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1610 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1611 | wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1612 | Py_DECREF(obj); \ | |
1613 | } \ | |
a541c325 | 1614 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1615 | if (! found) \ |
1616 | PCLASS::CBNAME(a); \ | |
1617 | } \ | |
1618 | void CLASS::base_##CBNAME(Type& a) { \ | |
1619 | PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1620 | } |
1621 | ||
efc5f224 | 1622 | //--------------------------------------------------------------------------- |
f6bcfd97 BP |
1623 | |
1624 | #define DEC_PYCALLBACK_bool_any(CBNAME, Type) \ | |
1625 | bool CBNAME(Type& a); \ | |
1626 | bool base_##CBNAME(Type& a); | |
1627 | ||
1628 | ||
19a97bd6 RD |
1629 | #define IMP_PYCALLBACK_bool_any(CLASS, PCLASS, CBNAME, Type) \ |
1630 | bool CLASS::CBNAME(Type& a) { \ | |
36fd8ec3 | 1631 | bool rv=FALSE; \ |
19a97bd6 | 1632 | bool found; \ |
a541c325 | 1633 | wxPyBeginBlockThreads(); \ |
19a97bd6 RD |
1634 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
1635 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1636 | rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1637 | Py_DECREF(obj); \ | |
1638 | } \ | |
a541c325 | 1639 | wxPyEndBlockThreads(); \ |
19a97bd6 RD |
1640 | if (! found) \ |
1641 | rv = PCLASS::CBNAME(a); \ | |
1642 | return rv; \ | |
1643 | } \ | |
1644 | bool CLASS::base_##CBNAME(Type& a) { \ | |
1645 | return PCLASS::CBNAME(a); \ | |
f6bcfd97 BP |
1646 | } |
1647 | ||
efc5f224 RD |
1648 | //--------------------------------------------------------------------------- |
1649 | ||
628c7f79 RD |
1650 | #define DEC_PYCALLBACK_bool_anypure(CBNAME, Type) \ |
1651 | bool CBNAME(Type& a); | |
1652 | ||
1653 | ||
1654 | #define IMP_PYCALLBACK_bool_anypure(CLASS, PCLASS, CBNAME, Type) \ | |
1655 | bool CLASS::CBNAME(Type& a) { \ | |
1656 | bool rv=FALSE; \ | |
1657 | wxPyBeginBlockThreads(); \ | |
1658 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
1659 | PyObject* obj = wxPyConstructObject((void*)&a, #Type, 0); \ | |
1660 | rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1661 | Py_DECREF(obj); \ | |
1662 | } \ | |
1663 | wxPyEndBlockThreads(); \ | |
1664 | return rv; \ | |
1665 | } \ | |
1666 | ||
1667 | //--------------------------------------------------------------------------- | |
1668 | ||
c7e7022c RD |
1669 | #define DEC_PYCALLBACK_STRING_LONGLONG(CBNAME) \ |
1670 | wxString CBNAME(long a, long b) const; \ | |
1671 | wxString base_##CBNAME(long a, long b)const ; | |
1672 | ||
c7e7022c RD |
1673 | #define IMP_PYCALLBACK_STRING_LONGLONG(CLASS, PCLASS, CBNAME) \ |
1674 | wxString CLASS::CBNAME(long a, long b) const { \ | |
1675 | wxString rval; \ | |
19a97bd6 | 1676 | bool found; \ |
a541c325 | 1677 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1678 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1679 | PyObject* ro; \ |
1680 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(ll)",a,b)); \ | |
1681 | if (ro) { \ | |
a541c325 RD |
1682 | rval = Py2wxString(ro); \ |
1683 | Py_DECREF(ro); \ | |
c7e7022c RD |
1684 | } \ |
1685 | } \ | |
a541c325 | 1686 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1687 | if (! found) \ |
c7e7022c | 1688 | rval = PCLASS::CBNAME(a,b); \ |
c7e7022c RD |
1689 | return rval; \ |
1690 | } \ | |
1691 | wxString CLASS::base_##CBNAME(long a, long b) const { \ | |
1692 | return PCLASS::CBNAME(a,b); \ | |
1693 | } | |
1694 | ||
1695 | //--------------------------------------------------------------------------- | |
1696 | ||
1697 | #define DEC_PYCALLBACK_INT_LONG(CBNAME) \ | |
1698 | int CBNAME(long a) const; \ | |
1699 | int base_##CBNAME(long a)const ; | |
1700 | ||
1701 | ||
1702 | #define IMP_PYCALLBACK_INT_LONG(CLASS, PCLASS, CBNAME) \ | |
1703 | int CLASS::CBNAME(long a) const { \ | |
1704 | int rval=-1; \ | |
19a97bd6 | 1705 | bool found; \ |
a541c325 | 1706 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1707 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1708 | PyObject* ro; \ |
1709 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(l)",a)); \ | |
1710 | if (ro) { \ | |
1711 | rval = PyInt_AsLong(ro); \ | |
1712 | Py_DECREF(ro); \ | |
1713 | } \ | |
1714 | } \ | |
a541c325 | 1715 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1716 | if (! found) \ |
c7e7022c | 1717 | rval = PCLASS::CBNAME(a); \ |
c7e7022c RD |
1718 | return rval; \ |
1719 | } \ | |
1720 | int CLASS::base_##CBNAME(long a) const { \ | |
1721 | return PCLASS::CBNAME(a); \ | |
1722 | } | |
1723 | ||
1724 | ||
1725 | //--------------------------------------------------------------------------- | |
1726 | ||
1727 | #define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \ | |
00b6c4e3 | 1728 | wxListItemAttr* CBNAME(long a) const; \ |
c7e7022c RD |
1729 | wxListItemAttr* base_##CBNAME(long a); |
1730 | ||
1731 | ||
1732 | #define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \ | |
00b6c4e3 | 1733 | wxListItemAttr *CLASS::CBNAME(long a) const { \ |
c7e7022c | 1734 | wxListItemAttr *rval = NULL; \ |
19a97bd6 | 1735 | bool found; \ |
a541c325 | 1736 | wxPyBeginBlockThreads(); \ |
19a97bd6 | 1737 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ |
c7e7022c RD |
1738 | PyObject* ro; \ |
1739 | wxListItemAttr* ptr; \ | |
1740 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(i)", a)); \ | |
1741 | if (ro) { \ | |
1742 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxListItemAttr_p")) \ | |
1743 | rval = ptr; \ | |
1744 | Py_DECREF(ro); \ | |
1745 | } \ | |
1746 | } \ | |
a541c325 | 1747 | wxPyEndBlockThreads(); \ |
19a97bd6 | 1748 | if (! found) \ |
c7e7022c | 1749 | rval = PCLASS::CBNAME(a); \ |
c7e7022c RD |
1750 | return rval; \ |
1751 | } \ | |
1752 | wxListItemAttr *CLASS::base_##CBNAME(long a) { \ | |
1753 | return PCLASS::CBNAME(a); \ | |
1754 | } | |
1755 | ||
1756 | //--------------------------------------------------------------------------- | |
1757 | ||
a541c325 RD |
1758 | #define DEC_PYCALLBACK_BOOL_ME(CBNAME) \ |
1759 | bool CBNAME(wxMouseEvent& e); \ | |
0122b7e3 RD |
1760 | bool base_##CBNAME(wxMouseEvent& e); |
1761 | ||
a541c325 RD |
1762 | #define IMP_PYCALLBACK_BOOL_ME(CLASS, PCLASS, CBNAME) \ |
1763 | bool CLASS::CBNAME(wxMouseEvent& e) { \ | |
1764 | bool rval=FALSE; \ | |
1765 | bool found; \ | |
1766 | wxPyBeginBlockThreads(); \ | |
1767 | if ((found = wxPyCBH_findCallback(m_myInst, #CBNAME))) { \ | |
1768 | PyObject* ro; \ | |
1769 | PyObject* obj = wxPyConstructObject((void*)&e, "wxMouseEvent", 0); \ | |
1770 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("(O)",obj)); \ | |
1771 | if (ro) { \ | |
1772 | rval = PyInt_AsLong(ro); \ | |
1773 | Py_DECREF(ro); \ | |
1774 | } \ | |
1775 | Py_DECREF(obj); \ | |
1776 | } \ | |
1777 | wxPyEndBlockThreads(); \ | |
1778 | if (! found) \ | |
1779 | return PCLASS::CBNAME(e); \ | |
1780 | return rval; \ | |
1781 | } \ | |
1782 | bool CLASS::base_##CBNAME(wxMouseEvent& e) { \ | |
1783 | return PCLASS::CBNAME(e); \ | |
0122b7e3 RD |
1784 | } |
1785 | ||
1786 | ||
1787 | //--------------------------------------------------------------------------- | |
1788 | ||
af83019e RD |
1789 | #define DEC_PYCALLBACK_WIZPG__pure(CBNAME) \ |
1790 | wxWizardPage* CBNAME() const; | |
1791 | ||
1792 | #define IMP_PYCALLBACK_WIZPG__pure(CLASS, PCLASS, CBNAME) \ | |
1793 | wxWizardPage* CLASS::CBNAME() const { \ | |
1794 | wxWizardPage* rv = NULL; \ | |
af83019e | 1795 | wxPyBeginBlockThreads(); \ |
628c7f79 | 1796 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
af83019e RD |
1797 | PyObject* ro; \ |
1798 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
1799 | if (ro) { \ | |
1800 | SWIG_GetPtrObj(ro, (void **)&rv, "_wxWizardPage_p"); \ | |
1801 | Py_DECREF(ro); \ | |
1802 | } \ | |
1803 | } \ | |
1804 | wxPyEndBlockThreads(); \ | |
1805 | return rv; \ | |
1806 | } | |
1807 | ||
1808 | //--------------------------------------------------------------------------- | |
1809 | ||
1810 | #define DEC_PYCALLBACK_BITMAP__pure(CBNAME) \ | |
1811 | wxBitmap CBNAME() const; | |
1812 | ||
1813 | #define IMP_PYCALLBACK_BITMAP__pure(CLASS, PCLASS, CBNAME) \ | |
1814 | wxBitmap CLASS::CBNAME() const { \ | |
1815 | wxBitmap rv; \ | |
af83019e | 1816 | wxPyBeginBlockThreads(); \ |
628c7f79 | 1817 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ |
af83019e RD |
1818 | PyObject* ro; \ |
1819 | wxBitmap* ptr; \ | |
1820 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
1821 | if (ro) { \ | |
1822 | if (! SWIG_GetPtrObj(ro, (void **)&ptr, "_wxBitmap_p")) \ | |
1823 | rv = *ptr; \ | |
1824 | Py_DECREF(ro); \ | |
1825 | } \ | |
1826 | } \ | |
1827 | wxPyEndBlockThreads(); \ | |
1828 | return rv; \ | |
1829 | } | |
1830 | ||
1831 | //--------------------------------------------------------------------------- | |
1832 | ||
628c7f79 RD |
1833 | #define DEC_PYCALLBACK_OBJECT__pure(CBNAME) \ |
1834 | wxObject* CBNAME(); | |
1835 | ||
1836 | #define IMP_PYCALLBACK_OBJECT__pure(CLASS, PCLASS, CBNAME) \ | |
1837 | wxObject* CLASS::CBNAME() { \ | |
1838 | wxObject* rv = NULL; \ | |
1839 | wxPyBeginBlockThreads(); \ | |
1840 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
1841 | PyObject* ro; \ | |
1842 | ro = wxPyCBH_callCallbackObj(m_myInst, Py_BuildValue("()")); \ | |
1843 | if (ro) { \ | |
1844 | SWIG_GetPtrObj(ro, (void **)&rv, "_wxObject_p"); \ | |
1845 | Py_DECREF(ro); \ | |
1846 | } \ | |
1847 | } \ | |
1848 | wxPyEndBlockThreads(); \ | |
1849 | return rv; \ | |
1850 | } | |
1851 | ||
1852 | //--------------------------------------------------------------------------- | |
1853 | ||
1854 | #define DEC_PYCALLBACK_BOOL_NODE_pure(CBNAME) \ | |
1855 | bool CBNAME(wxXmlNode* a); | |
1856 | ||
1857 | ||
1858 | #define IMP_PYCALLBACK_BOOL_NODE_pure(CLASS, PCLASS, CBNAME) \ | |
1859 | bool CLASS::CBNAME(wxXmlNode* a) { \ | |
1860 | bool rv=FALSE; \ | |
1861 | wxPyBeginBlockThreads(); \ | |
1862 | if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \ | |
1863 | PyObject* obj = wxPyConstructObject((void*)a, "wxXmlNode", 0); \ | |
1864 | rv = wxPyCBH_callCallback(m_myInst, Py_BuildValue("(O)", obj)); \ | |
1865 | Py_DECREF(obj); \ | |
1866 | } \ | |
1867 | wxPyEndBlockThreads(); \ | |
1868 | return rv; \ | |
1869 | } \ | |
1870 | ||
1871 | //--------------------------------------------------------------------------- | |
7bf85405 | 1872 | #endif |