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