+#endif // wxUSE_DYNAMIC_CLASSES
+
+
+#define wxIS_KIND_OF(obj, className) obj->IsKindOf(&className::sm_class##className)
+
+// Just seems a bit nicer-looking (pretend it's not a macro)
+#define wxIsKindOf(obj, className) obj->IsKindOf(&className::sm_class##className)
+
+// to be replaced by dynamic_cast<> in the future
+#define wxDynamicCast(obj, className) \
+ (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 wxDynamicCastThis(className) \
+ (IsKindOf(&className::sm_class##className) ? (className *)(this) : (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 // !__WXDEBUG__
+#define wxStaticCast(obj, className) ((className *)(obj))
+
+#endif // __WXDEBUG__
+
+
+// for some reason Borland seems to need this include.
+#if wxUSE_STD_IOSTREAM \
+ && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT) \
+ && defined(__BORLANDC__)
+ #if wxUSE_IOSTREAMH
+ #include <iostream.h>
+ #else
+ #include <iostream>
+ #endif
+#endif // wxUSE_IOSTREAMH
+
+// ----------------------------------------------------------------------------
+// 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