// 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.
-#define wxDynamicThisCast(obj, className) \
- (((obj)->IsKindOf(&className::sm_class##className)) \
- ? (className *)(obj) \
+#define wxDynamicCastThis(className) \
+ (IsKindOf(&className::sm_class##className) \
+ ? (className *)(this) \
: (className *)0)
#define wxConstCast(obj, className) ((className *)(obj))
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;
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__)