+ // ref counted data handling methods
+
+ // get/set
+ wxObjectRefData *GetRefData() const { return m_refData; }
+ void SetRefData(wxObjectRefData *data) { m_refData = data; }
+
+ // make a 'clone' of the object
+ void Ref(const wxObject& clone);
+
+ // destroy a reference
+ void UnRef();
+
+ // Make sure this object has only one reference
+ void UnShare() { AllocExclusive(); }
+
+ // check if this object references the same data as the other one
+ bool IsSameAs(const wxObject& o) const { return m_refData == o.m_refData; }
+
+protected:
+ // ensure that our data is not shared with anybody else: if we have no
+ // data, it is created using CreateRefData() below, if we have shared data
+ // it is copied using CloneRefData(), otherwise nothing is done
+ void AllocExclusive();
+
+ // both methods must be implemented if AllocExclusive() is used, not pure
+ // virtual only because of the backwards compatibility reasons
+
+ // create a new m_refData
+ virtual wxObjectRefData *CreateRefData() const;
+
+ // create a new m_refData initialized with the given one
+ virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
+
+ wxObjectRefData *m_refData;
+};
+
+inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
+{
+ return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : NULL;
+}
+
+#if wxUSE_EXTENDED_RTTI
+class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
+{
+ friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ;
+public:
+ // instantiates this object with an instance of its superclass
+ wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
+ virtual ~wxDynamicObject();
+
+ void SetProperty (const wxChar *propertyName, const wxxVariant &value);
+ wxxVariant GetProperty (const wxChar *propertyName) const ;
+
+ // get the runtime identity of this object
+ wxClassInfo *GetClassInfo() const
+ {
+#ifdef _MSC_VER
+ return (wxClassInfo*) m_classInfo;
+#else
+ wxDynamicClassInfo *nonconst = wx_const_cast(wxDynamicClassInfo *, m_classInfo);
+ return wx_static_cast(wxClassInfo *, nonconst);
+#endif
+ }
+
+ wxObject* GetSuperClassInstance() const
+ {
+ return m_superClassInstance ;
+ }
+private :
+ // removes an existing runtime-property
+ void RemoveProperty( const wxChar *propertyName ) ;
+
+ // renames an existing runtime-property
+ void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ;
+
+ wxObject *m_superClassInstance ;
+ const wxDynamicClassInfo *m_classInfo;
+ struct wxDynamicObjectInternal;
+ wxDynamicObjectInternal *m_data;
+};