#pragma optimize("", off)
#endif
-#if wxUSE_XTI
-const wxClassInfo* wxObject::sm_classParentswxObject[] = { NULL } ;
- wxObject* wxVariantToObjectConverterwxObject ( const wxxVariant &data )
-{ return data.Get<wxObject*>() ; }
- wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
+#if wxUSE_EXTENDED_RTTI
+const wxClassInfo* wxObject::sm_classParentswxObject[] = { NULL } ;
+ wxObject* wxVariantToObjectConverterwxObject ( wxxVariant &data )
+{ return data.Get<wxObject*>() ; }
+ wxObject* wxVariantOfPtrToObjectConverterwxObject ( wxxVariant &data )
+{ return &data.Get<wxObject>() ; }
+ wxxVariant wxObjectToVariantConverterwxObject ( wxObject *data )
{ return wxxVariant( dynamic_cast<wxObject*> (data) ) ; }
- wxClassInfo wxObject::sm_classwxObject(sm_classParentswxObject , wxT("") , wxT("wxObject"),
+ wxClassInfo wxObject::sm_classwxObject(sm_classParentswxObject , wxT("") , wxT("wxObject"),
(int) sizeof(wxObject), \
- (wxObjectConstructorFn) 0 ,
- (wxPropertyInfo*) NULL,0 , 0 ,
- 0 , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
+ (wxObjectConstructorFn) 0 ,
+ (wxPropertyInfo*) NULL,(wxHandlerInfo*) NULL,0 , 0 ,
+ 0 , wxVariantOfPtrToObjectConverterwxObject , wxVariantToObjectConverterwxObject , wxObjectToVariantConverterwxObject);
template<> void wxStringReadValue(const wxString & , wxObject * & ){assert(0) ;}
template<> void wxStringWriteValue(wxString & , wxObject* const & ){assert(0) ;}
+ template<> void wxStringReadValue(const wxString & , wxObject & ){assert(0) ;}
+ template<> void wxStringWriteValue(wxString & , wxObject const & ){assert(0) ;}
template<> const wxTypeInfo* wxGetTypeInfo( wxObject ** )
- { static wxClassTypeInfo s_typeInfo(&wxObject::sm_classwxObject) ; return &s_typeInfo ; }
+ { static wxClassTypeInfo s_typeInfo(wxT_OBJECT_PTR , &wxObject::sm_classwxObject) ; return &s_typeInfo ; }
+ template<> const wxTypeInfo* wxGetTypeInfo( wxObject * )
+ { static wxClassTypeInfo s_typeInfo(wxT_OBJECT , &wxObject::sm_classwxObject) ; return &s_typeInfo ; }
#else
wxClassInfo wxObject::sm_classwxObject( wxT("wxObject"), 0, 0,
(int) sizeof(wxObject),
info = info->m_next;
}
}
-#if wxUSE_XTI
- Unregister( m_className ) ;
-#endif
+ Unregister();
}
wxClassInfo *wxClassInfo::FindClass(const wxChar *className)
}
}
-// a tiny InitializeClasses() helper
-/* static */
-inline wxClassInfo *wxClassInfo::GetBaseByName(const wxChar *name)
-{
- if ( !name )
- return NULL;
-
- wxClassInfo *classInfo = (wxClassInfo *)sm_classTable->Get(name);
-
-#ifdef __WXDEBUG__
- // this must be fixed, other things will work wrongly later if you get this
- if ( !classInfo )
- {
- wxFAIL_MSG( wxString::Format
- (
- _T("base class '%s' is unknown to wxWindows RTTI"),
- name
- ) );
- }
-#endif // __WXDEBUG__
-
- return classInfo;
-}
-
// Set pointers to base class(es) to speed up IsKindOf
void wxClassInfo::InitializeClasses()
{
size_t nClass = 0;
#endif
- sm_classTable = new wxHashTable(wxKEY_STRING);
-
- // Index all class infos by their class name
-
- wxClassInfo *info;
- for(info = sm_first; info; info = info->m_next)
+ // Do this initialization only once, because classes are added
+ // automatically if
+ if ( sm_classTable == NULL )
{
- if (info->m_className)
+ sm_classTable = new wxHashTable(wxKEY_STRING);
+
+ // Index all class infos by their class name:
+ wxClassInfo *info;
+ for(info = sm_first; info; info = info->m_next)
{
- wxASSERT_MSG( ++nClass < nMaxClasses,
- _T("an infinite loop detected - have you used IMPLEMENT_DYNAMIC_CLASS() twice (may be by linking some object module(s) twice)?") );
- sm_classTable->Put(info->m_className, (wxObject *)info);
+ if (info->m_className)
+ {
+ wxASSERT_MSG( ++nClass < nMaxClasses,
+ _T("an infinite loop detected - have you used IMPLEMENT_DYNAMIC_CLASS() twice (may be by linking some object module(s) twice)?") );
+ sm_classTable->Put(info->m_className, (wxObject *)info);
+ }
}
}
+}
-#if wxUSE_XTI == 0
- // Set base pointers for each wxClassInfo
+void wxClassInfo::CleanUpClasses()
+{
+ delete wxClassInfo::sm_classTable;
+ wxClassInfo::sm_classTable = NULL;
+}
- for(info = sm_first; info; info = info->m_next)
+void wxClassInfo::Register()
+{
+ if ( sm_classTable )
{
- info->m_baseInfo1 = GetBaseByName(info->GetBaseClassName1());
- info->m_baseInfo2 = GetBaseByName(info->GetBaseClassName2());
+ sm_classTable->Put(m_className, (wxObject *)this);
}
-#endif
}
-void wxClassInfo::CleanUpClasses()
+void wxClassInfo::Unregister()
{
- delete wxClassInfo::sm_classTable;
- wxClassInfo::sm_classTable = NULL;
+ if ( sm_classTable )
+ {
+ sm_classTable->Delete(m_className);
+ }
}
wxObject *wxCreateDynamicObject(const wxChar *name)