+ virtual wxEvent* Clone() const { return new wxPyCommandEvent(*this); }
+};
+
+
+
+//----------------------------------------------------------------------
+// Forward decalre a few things used in the exported API
+class wxPyClientData;
+class wxPyUserData;
+class wxPyOORClientData;
+
+void wxPyClientData_dtor(wxPyClientData* self);
+void wxPyUserData_dtor(wxPyUserData* self);
+void wxPyOORClientData_dtor(wxPyOORClientData* self);
+
+
+//---------------------------------------------------------------------------
+// Export a C API in a struct. Other modules will be able to load this from
+// the wxc module and will then have safe access to these functions, even if
+// in another shared library.
+
+class wxPyCallbackHelper;
+
+struct wxPyCoreAPI {
+
+ void (*p_SWIG_MakePtr)(char*, void*, char*);
+ char* (*p_SWIG_GetPtr)(char*, void**, char*);
+ char* (*p_SWIG_GetPtrObj)(PyObject*, void**, char*);
+ void (*p_SWIG_RegisterMapping)(char*, char*, void *(*cast)(void *));
+ void (*p_SWIG_addvarlink)(PyObject*, char*, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p));
+ PyObject* (*p_SWIG_newvarlink)(void);
+
+ PyThreadState* (*p_wxPyBeginAllowThreads)();
+ void (*p_wxPyEndAllowThreads)(PyThreadState* state);
+ void (*p_wxPyBeginBlockThreads)();
+ void (*p_wxPyEndBlockThreads)();
+
+ PyObject* (*p_wxPyConstructObject)(void *, const wxString&, int);
+ PyObject* (*p_wxPy_ConvertList)(wxListBase* list, const char* className);
+
+ wxString* (*p_wxString_in_helper)(PyObject* source);
+ wxString (*p_Py2wxString)(PyObject* source);
+ PyObject* (*p_wx2PyString)(const wxString& src);
+
+ byte* (*p_byte_LIST_helper)(PyObject* source);
+ int* (*p_int_LIST_helper)(PyObject* source);
+ long* (*p_long_LIST_helper)(PyObject* source);
+ char** (*p_string_LIST_helper)(PyObject* source);
+ wxPoint* (*p_wxPoint_LIST_helper)(PyObject* source, int* npoints);
+ wxBitmap** (*p_wxBitmap_LIST_helper)(PyObject* source);
+ wxString* (*p_wxString_LIST_helper)(PyObject* source);
+ wxAcceleratorEntry* (*p_wxAcceleratorEntry_LIST_helper)(PyObject* source);
+
+ bool (*p_wxSize_helper)(PyObject* source, wxSize** obj);
+ bool (*p_wxPoint_helper)(PyObject* source, wxPoint** obj);
+ bool (*p_wxRealPoint_helper)(PyObject* source, wxRealPoint** obj);
+ bool (*p_wxRect_helper)(PyObject* source, wxRect** obj);
+ bool (*p_wxColour_helper)(PyObject* source, wxColour** obj);
+
+ void (*p_wxPyCBH_setCallbackInfo)(wxPyCallbackHelper& cbh, PyObject* self, PyObject* klass, int incref);
+ bool (*p_wxPyCBH_findCallback)(const wxPyCallbackHelper& cbh, const char* name);
+ int (*p_wxPyCBH_callCallback)(const wxPyCallbackHelper& cbh, PyObject* argTuple);
+ PyObject* (*p_wxPyCBH_callCallbackObj)(const wxPyCallbackHelper& cbh, PyObject* argTuple);
+ void (*p_wxPyCBH_delete)(wxPyCallbackHelper* cbh);
+
+ PyObject* (*p_wxPyClassExists)(const wxString& className);
+ PyObject* (*p_wxPyMake_wxObject)(wxObject* source, bool checkEvtHandler);
+ PyObject* (*p_wxPyMake_wxSizer)(wxSizer* source);
+ void (*p_wxPyPtrTypeMap_Add)(const char* commonName, const char* ptrName);
+ PyObject* (*p_wxArrayString2PyList_helper)(const wxArrayString& arr);
+ PyObject* (*p_wxArrayInt2PyList_helper)(const wxArrayInt& arr);
+
+ void (*p_wxPyClientData_dtor)(wxPyClientData*);
+ void (*p_wxPyUserData_dtor)(wxPyUserData*);
+ void (*p_wxPyOORClientData_dtor)(wxPyOORClientData*);
+};
+
+#ifdef wxPyUSE_EXPORT
+static wxPyCoreAPI* wxPyCoreAPIPtr = NULL; // Each module needs one, but doesn't have to use it.
+#endif
+
+
+//---------------------------------------------------------------------------
+
+
+class wxPyUserData : public wxObject {
+public:
+ wxPyUserData(PyObject* obj) {
+ m_obj = obj;
+ Py_INCREF(m_obj);
+ }
+
+ ~wxPyUserData() {
+#ifdef wxPyUSE_EXPORT
+ wxPyCoreAPIPtr->p_wxPyUserData_dtor(this);
+#else
+ wxPyUserData_dtor(this);
+#endif
+ }
+ PyObject* m_obj;
+};
+
+
+class wxPyClientData : public wxClientData {
+public:
+ wxPyClientData(PyObject* obj) {
+ m_obj = obj;
+ Py_INCREF(m_obj);
+ }
+
+ ~wxPyClientData() {
+#ifdef wxPyUSE_EXPORT
+ wxPyCoreAPIPtr->p_wxPyClientData_dtor(this);
+#else
+ wxPyClientData_dtor(this);
+#endif
+ }
+ PyObject* m_obj;
+};
+
+
+class wxPyOORClientData : public wxPyClientData {
+public:
+ wxPyOORClientData(PyObject* obj)
+ : wxPyClientData(obj) {}
+
+ ~wxPyOORClientData() {
+#ifdef wxPyUSE_EXPORT
+ wxPyCoreAPIPtr->p_wxPyOORClientData_dtor(this);
+#else
+ wxPyOORClientData_dtor(this);
+#endif
+ }
+};
+
+//---------------------------------------------------------------------------
+// This class holds an instance of a Python Shadow Class object and assists
+// with looking up and invoking Python callback methods from C++ virtual
+// method redirections. For all classes which have virtuals which should be
+// overridable in wxPython, a new subclass is created that contains a
+// wxPyCallbackHelper.
+//
+
+class wxPyCallbackHelper {
+public:
+ wxPyCallbackHelper(const wxPyCallbackHelper& other);
+
+ wxPyCallbackHelper() {
+ m_class = NULL;
+ m_self = NULL;
+ m_lastFound = NULL;
+ m_incRef = FALSE;
+ }
+
+ ~wxPyCallbackHelper() {
+#ifdef wxPyUSE_EXPORT
+ wxPyCoreAPIPtr->p_wxPyCBH_delete(this);
+#else
+ wxPyCBH_delete(this);
+#endif
+ }
+
+ void setSelf(PyObject* self, PyObject* klass, int incref=TRUE);
+ bool findCallback(const char* name) const;
+ int callCallback(PyObject* argTuple) const;
+ PyObject* callCallbackObj(PyObject* argTuple) const;
+
+private:
+ PyObject* m_self;
+ PyObject* m_class;
+ PyObject* m_lastFound;
+ int m_incRef;
+
+ friend void wxPyCBH_delete(wxPyCallbackHelper* cbh);