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