+#endif // wxUSE_DYNAMIC_CLASSES
+
+#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::ms_classInfo)
+
+// Just seems a bit nicer-looking (pretend it's not a macro)
+#define wxIsKindOf(obj, className) obj->IsKindOf(&className::ms_classInfo)
+
+// to be replaced by dynamic_cast<> in the future
+#define wxDynamicCast(obj, className) \
+ ((className *) wxCheckDynamicCast( \
+ wx_const_cast(wxObject *, wx_static_cast(const wxObject *, \
+ wx_const_cast(className *, wx_static_cast(const className *, obj)))), \
+ &className::ms_classInfo))
+
+// The 'this' pointer is always true, so use this version
+// to cast the this pointer and avoid compiler warnings.
+#define wxDynamicCastThis(className) \
+ (IsKindOf(&className::ms_classInfo) ? (className *)(this) : (className *)0)
+
+#ifdef __WXDEBUG__
+inline void* wxCheckCast(void *ptr)
+{
+ wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") );
+ return ptr;
+}
+#define wxStaticCast(obj, className) \
+ ((className *)wxCheckCast(wxDynamicCast(obj, className)))
+
+#else // !__WXDEBUG__
+#define wxStaticCast(obj, className) ((className *)(obj))
+
+#endif // __WXDEBUG__
+
+// ----------------------------------------------------------------------------
+// set up memory debugging macros
+// ----------------------------------------------------------------------------
+
+/*
+ Which new/delete operator variants do we want?
+
+ _WX_WANT_NEW_SIZET_WXCHAR_INT = void *operator new (size_t size, wxChar *fileName = 0, int lineNum = 0)
+ _WX_WANT_DELETE_VOID = void operator delete (void * buf)
+ _WX_WANT_DELETE_VOID_CONSTCHAR_SIZET = void operator delete (void *buf, const char *_fname, size_t _line)
+ _WX_WANT_DELETE_VOID_WXCHAR_INT = void operator delete(void *buf, wxChar*, int)
+ _WX_WANT_ARRAY_NEW_SIZET_WXCHAR_INT = void *operator new[] (size_t size, wxChar *fileName , int lineNum = 0)
+ _WX_WANT_ARRAY_DELETE_VOID = void operator delete[] (void *buf)
+ _WX_WANT_ARRAY_DELETE_VOID_WXCHAR_INT = void operator delete[] (void* buf, wxChar*, int )
+*/
+
+#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
+
+// All compilers get this one
+#define _WX_WANT_NEW_SIZET_WXCHAR_INT
+
+// Everyone except Visage gets the next one
+#ifndef __VISAGECPP__
+ #define _WX_WANT_DELETE_VOID