+// ----------------------------------------------------------------------------
+// wxEventConnectionRef: A class that represents all connections between two event
+// handlers and enables automatic disconnect when an event handler sink goes
+// out of scope. Each connection/disconnect increases/decreases ref count, and
+// when zero the node goes out of scope.
+// ----------------------------------------------------------------------------
+
+struct wxEventConnectionRef : public wxTrackerNode {
+
+ wxEventConnectionRef() : m_src(0), m_sink(0), m_refCount(0) { }
+ wxEventConnectionRef( wxEvtHandler *src, wxEvtHandler *sink );
+ virtual ~wxEventConnectionRef();
+
+ // The sink is being destroyed
+ virtual void OnObjectDestroy( );
+ virtual wxTrackerNodeType GetType( ){ return EventConnectionRef; }
+
+ void IncRef( ) { m_refCount++; }
+ void DecRef( );
+
+protected:
+ wxEvtHandler *m_src, *m_sink;
+ int m_refCount;
+
+ friend class wxEvtHandler;
+
+private:
+ // It makes no sense to copy objects of this class
+ wxEventConnectionRef& operator = (const wxEventConnectionRef& WXUNUSED(other)) { wxASSERT(0); return *this; }
+};
+
+
+