+ wxWeakRef<T>& operator=(const wxWeakRef<T>& wr)
+ {
+ AssignCopy(wr);
+ return *this;
+ }
+
+ virtual ~wxWeakRef() { this->Release(); }
+
+ // Smart pointer functions
+ T& operator*() const { return *this->m_pobj; }
+ T* operator->() const { return this->m_pobj; }
+
+ T* get() const { return this->m_pobj; }
+ operator T*() const { return this->m_pobj; }
+};
+
+
+#ifdef HAVE_DYNAMIC_CAST
+
+// Weak ref implementation assign objects are queried for wxTrackable
+// using dynamic_cast<>
+template <class T>
+class wxWeakRefDynamic : public wxTrackerNode
+{
+public:
+ wxWeakRefDynamic() : m_pobj(NULL) { }
+
+ wxWeakRefDynamic(T* pobj) : m_pobj(pobj)
+ {
+ Assign(pobj);
+ }
+
+ wxWeakRefDynamic(const wxWeakRef<T>& wr)
+ {
+ Assign(wr.get());
+ }
+
+ virtual ~wxWeakRefDynamic() { Release(); }
+
+ // Smart pointer functions
+ T& operator*() const { wxASSERT(m_pobj); return *m_pobj; }
+ T* operator->() const { wxASSERT(m_pobj); return m_pobj; }
+
+ T* get() const { return m_pobj; }
+ operator T* () const { return m_pobj; }
+
+ T* operator = (T* pobj) { Assign(pobj); return m_pobj; }
+
+ // Assign from another weak ref, point to same object
+ T* operator = (const wxWeakRef<T> &wr) { Assign( wr.get() ); return m_pobj; }
+
+ void Release()
+ {
+ // Release old object if any
+ if( m_pobj )