+#define wxDECLARE_CLASS_INFO_ITERATORS() \
+class WXDLLIMPEXP_BASE const_iterator \
+ { \
+ typedef wxHashTable_Node Node; \
+ public: \
+ typedef const wxClassInfo* value_type; \
+ typedef const value_type& const_reference; \
+ typedef const_iterator itor; \
+ typedef value_type* ptr_type; \
+ \
+ Node* m_node; \
+ wxHashTable* m_table; \
+ public: \
+ typedef const_reference reference_type; \
+ typedef ptr_type pointer_type; \
+ \
+ const_iterator(Node* node, wxHashTable* table) \
+ : m_node(node), m_table(table) { } \
+ const_iterator() : m_node(NULL), m_table(NULL) { } \
+ value_type operator*() const; \
+ itor& operator++(); \
+ const itor operator++(int); \
+ bool operator!=(const itor& it) const \
+ { return it.m_node != m_node; } \
+ bool operator==(const itor& it) const \
+ { return it.m_node == m_node; } \
+ }; \
+ \
+ static const_iterator begin_classinfo(); \
+ static const_iterator end_classinfo()
+
+// based on the value of wxUSE_EXTENDED_RTTI symbol,
+// only one of the RTTI system will be compiled:
+// - the "old" one (defined by rtti.h) or
+// - the "new" one (defined by xti.h)
+#include "wx/xti.h"
+#include "wx/rtti.h"
+
+#define wxIMPLEMENT_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_CLASS(name, basename)
+
+#define wxIMPLEMENT_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2)
+
+// -----------------------------------
+// for pluggable classes
+// -----------------------------------
+
+ // NOTE: this should probably be the very first statement
+ // in the class declaration so wxPluginSentinel is
+ // the first member initialised and the last destroyed.
+
+// _DECLARE_DL_SENTINEL(name) wxPluginSentinel m_pluginsentinel;
+
+#if wxUSE_NESTED_CLASSES
+
+#define _DECLARE_DL_SENTINEL(name, exportdecl) \
+class exportdecl name##PluginSentinel { \
+private: \
+ static const wxString sm_className; \
+public: \
+ name##PluginSentinel(); \
+ ~name##PluginSentinel(); \
+}; \
+name##PluginSentinel m_pluginsentinel
+
+#define _IMPLEMENT_DL_SENTINEL(name) \
+ const wxString name::name##PluginSentinel::sm_className(#name); \
+ name::name##PluginSentinel::name##PluginSentinel() { \
+ wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
+ if( e != 0 ) { e->RefObj(); } \
+ } \
+ name::name##PluginSentinel::~name##PluginSentinel() { \
+ wxPluginLibrary *e = (wxPluginLibrary*) wxPluginLibrary::ms_classes.Get(#name); \
+ if( e != 0 ) { e->UnrefObj(); } \
+ }
+#else
+
+#define _DECLARE_DL_SENTINEL(name)
+#define _IMPLEMENT_DL_SENTINEL(name)
+
+#endif // wxUSE_NESTED_CLASSES
+
+#define wxDECLARE_PLUGGABLE_CLASS(name) \
+ wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
+#define wxDECLARE_ABSTRACT_PLUGGABLE_CLASS(name) \
+ wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, WXDLLIMPEXP_CORE)
+
+#define wxDECLARE_USER_EXPORTED_PLUGGABLE_CLASS(name, usergoo) \
+ wxDECLARE_DYNAMIC_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
+#define wxDECLARE_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, usergoo) \
+ wxDECLARE_ABSTRACT_CLASS(name); _DECLARE_DL_SENTINEL(name, usergoo)
+
+#define wxIMPLEMENT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_DYNAMIC_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_DYNAMIC_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_CLASS(name, basename) _IMPLEMENT_DL_SENTINEL(name)
+#define wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) _IMPLEMENT_DL_SENTINEL(name)
+
+#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_PLUGGABLE_CLASS(name, basename)
+#define wxIMPLEMENT_USER_EXPORTED_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_PLUGGABLE_CLASS2(name, basename1, basename2)
+#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS(name, basename) \
+ wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS(name, basename)
+#define wxIMPLEMENT_USER_EXPORTED_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2) \
+ wxIMPLEMENT_ABSTRACT_PLUGGABLE_CLASS2(name, basename1, basename2)
+
+#define wxCLASSINFO(name) (&name::ms_classInfo)
+
+#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)
+
+// this cast does some more checks at compile time as it uses static_cast
+// internally
+//
+// note that it still has different semantics from dynamic_cast<> and so can't
+// be replaced by it as long as there are any compilers not supporting it
+#define wxDynamicCast(obj, className) \
+ ((className *) wxCheckDynamicCast( \
+ const_cast<wxObject *>(static_cast<const wxObject *>(\
+ const_cast<className *>(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)
+
+// FIXME-VC6: dummy argument needed because VC6 doesn't support explicitly
+// choosing the template function to call
+template <class T>
+inline T *wxCheckCast(const void *ptr, T * = NULL)
+{
+ wxASSERT_MSG( wxDynamicCast(ptr, T), "wxStaticCast() used incorrectly" );
+ return const_cast<T *>(static_cast<const T *>(ptr));
+}
+
+#define wxStaticCast(obj, className) wxCheckCast((obj), (className *)NULL)