X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f763782968b314d45c416e2066b9ae5cc56aa406..b1d66b5415f7befb45e050d7097571642b8bfa56:/include/wx/object.h?ds=sidebyside diff --git a/include/wx/object.h b/include/wx/object.h index 845d0e238c..69e3796842 100644 --- a/include/wx/object.h +++ b/include/wx/object.h @@ -171,9 +171,7 @@ wxObject* WXDLLEXPORT_CTORFN wxConstructorFor##name(void) \ // to be replaced by dynamic_cast<> in the future #define wxDynamicCast(obj, className) \ - ((obj) && ((obj)->IsKindOf(&className::sm_class##className)) \ - ? (className *)(obj) \ - : (className *)0) + (className *) wxCheckDynamicCast((wxObject*)(obj), &className::sm_class##className) // The 'this' pointer is always true, so use this version to cast the this // pointer and avoid compiler warnings. @@ -221,8 +219,6 @@ class WXDLLEXPORT wxObject virtual ~wxObject(void); virtual wxClassInfo *GetClassInfo(void) const { return &sm_classwxObject; } - wxObject *Clone(void) const; - virtual void CopyObject(wxObject& object_dest) const; bool IsKindOf(wxClassInfo *info) const; @@ -297,6 +293,11 @@ private: int m_count; }; +inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo) +{ + return obj && obj->GetClassInfo()->IsKindOf(classInfo) ? obj : 0; +} + #ifdef __WXDEBUG__ #ifndef WXDEBUG_NEW #define WXDEBUG_NEW new(__TFILE__,__LINE__)