+//---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
+// 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.
+
+
+class wxPyEvtSelfRef {
+public:
+ wxPyEvtSelfRef();
+ ~wxPyEvtSelfRef();
+
+ void SetSelf(PyObject* self, bool clone=FALSE);
+ PyObject* GetSelf() const;
+
+protected:
+ PyObject* m_self;
+ bool m_cloned;
+};
+
+
+class wxPyEvent : public wxEvent, public wxPyEvtSelfRef {
+ DECLARE_DYNAMIC_CLASS(wxPyEvent)
+public:
+ wxPyEvent(int id=0);
+ ~wxPyEvent();
+
+ void CopyObject(wxObject& dest) const;
+};
+
+
+class wxPyCommandEvent : public wxCommandEvent, public wxPyEvtSelfRef {
+ DECLARE_DYNAMIC_CLASS(wxPyCommandEvent)
+public:
+ wxPyCommandEvent(wxEventType commandType = wxEVT_NULL, int id=0);
+ ~wxPyCommandEvent();
+
+ void CopyObject(wxObject& dest) const;
+};
+