+ // 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_FWD_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;
+};
+#endif
+
+// ----------------------------------------------------------------------------
+// more debugging macros
+// ----------------------------------------------------------------------------
+
+// Redefine new to be the debugging version. This doesn't work with all
+// compilers, in which case you need to use WXDEBUG_NEW explicitly if you wish
+// to use the debugging version.
+
+#ifdef __WXDEBUG__
+ #define WXDEBUG_NEW new(__TFILE__,__LINE__)
+
+ #if wxUSE_DEBUG_NEW_ALWAYS
+ #if wxUSE_GLOBAL_MEMORY_OPERATORS
+ #define new WXDEBUG_NEW
+ #elif defined(__VISUALC__)
+ // Including this file redefines new and allows leak reports to
+ // contain line numbers
+ #include "wx/msw/msvcrt.h"
+ #endif
+ #endif // wxUSE_DEBUG_NEW_ALWAYS
+#else // !__WXDEBUG__
+ #define WXDEBUG_NEW new
+#endif // __WXDEBUG__/!__WXDEBUG__
+
+#endif // _WX_OBJECTH__