+// to be replaced by dynamic_cast<> in the future
+#define wxDynamicCast(obj, className) \
+ ((obj) && ((obj)->IsKindOf(&className::sm_class##className)) \
+ ? (className *)(obj) \
+ : (className *)0)
+
+// 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) \
+ : (className *)0)
+
+#define wxConstCast(obj, className) ((className *)(obj))
+
+#ifdef __WXDEBUG__
+ inline void wxCheckCast(void *ptr)
+ {
+ wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") );
+ }
+
+ #define wxStaticCast(obj, className) \
+ (wxCheckCast(wxDynamicCast(obj, className)), ((className *)(obj)))
+
+#else // !Debug
+ #define wxStaticCast(obj, className) ((className *)(obj))
+#endif // Debug/!Debug
+