HELPEREXPORT bool wxPyRestoreThread();
HELPEREXPORT void wxPySaveThread(bool doSave);
HELPEREXPORT PyObject* wxPy_ConvertList(wxListBase* list, const char* className);
+HELPEREXPORT long wxPyGetWinHandle(wxWindow* win);
+
+//----------------------------------------------------------------------
+
+class wxPyUserData : public wxObject {
+public:
+ wxPyUserData(PyObject* obj) { m_obj = obj; Py_INCREF(m_obj); }
+ ~wxPyUserData() {
+ bool doSave = wxPyRestoreThread();
+ Py_DECREF(m_obj);
+ wxPySaveThread(doSave);
+ }
+ PyObject* m_obj;
+};
//----------------------------------------------------------------------
// These are helpers used by the typemaps
PyObject* m_func;
};
-//---------------------------------------------------------------------------
-
-// class wxPyMenu : public wxMenu {
-// public:
-// wxPyMenu(const wxString& title = "", PyObject* func=NULL);
-// ~wxPyMenu();
-
-// private:
-// static void MenuCallback(wxMenu& menu, wxCommandEvent& evt);
-// PyObject* func;
-// };
-
-
//---------------------------------------------------------------------------
class wxPyTimer : public wxTimer {
private:
PyObject* m_self;
PyObject* m_lastFound;
+ int m_incRef;
};
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
-// These classes can be derived from in Python and passed through the event
-// system without loosing anything. They do this by keeping a reference to
-// themselves and some special case handling in wxPyCallback::EventThunker.
+// These Event classes can be derived from in Python and passed through the
+// event system without loosing anything. They do this by keeping a reference
+// to themselves and some special case handling in wxPyCallback::EventThunker.
class wxPyEvtSelfRef {
//---------------------------------------------------------------------------
#define PYPRIVATE \
- void _setSelf(PyObject* self, int incref=TRUE) { \
+ void _setSelf(PyObject* self, int incref=1) { \
m_myInst.setSelf(self, incref); \
} \
private: wxPyCallbackHelper m_myInst;
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
rval = m_myInst.callCallback(Py_BuildValue("(i)",a)); \
- else rval = false; \
+ else rval = FALSE; \
wxPySaveThread(doSave); \
return rval; \
}
#define IMP_PYCALLBACK_BOOL_TAG_pure(CLASS, PCLASS, CBNAME) \
bool CLASS::CBNAME(const wxHtmlTag& a) { \
- bool rval = false; \
+ bool rval = FALSE; \
bool doSave = wxPyRestoreThread(); \
if (m_myInst.findCallback(#CBNAME)) \
rval = m_myInst.callCallback(Py_BuildValue("(O)", \