-
-// ----------------------------------------------------------------------------
-// wxIMPLEMENT class macros for concrete classes
-// ----------------------------------------------------------------------------
-
-// Single inheritance with one base class
-
-#define _TYPEINFO_CLASSES(n, toString, fromString ) \
- wxClassTypeInfo s_typeInfo##n(wxT_OBJECT, &n::ms_classInfo, \
- toString, fromString, typeid(n).name()); \
- wxClassTypeInfo s_typeInfoPtr##n(wxT_OBJECT_PTR, &n::ms_classInfo, \
- toString, fromString, typeid(n*).name());
-
-#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit, callback) \
- wxObject* wxConstructorFor##name() \
- { return new name; } \
- wxObject* wxVariantOfPtrToObjectConverter##name ( wxVariantBase &data ) \
- { return data.wxTEMPLATED_MEMBER_CALL(Get, name*); } \
- wxVariantBase wxObjectToVariantConverter##name ( wxObject *data ) \
- { return wxVariantBase( wx_dynamic_cast(name*, data) ); } \
- \
- const wxClassInfo* name::ms_classParents[] = \
- { &basename::ms_classInfo, NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
- name::GetPropertiesStatic(), name::GetHandlersStatic(), name::ms_constructor, \
- name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
- wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \
- callback);
-
-#define _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY(name, basename, unit, callback ) \
- wxObject* wxConstructorFor##name() \
- { return new name; } \
- wxObject* wxVariantToObjectConverter##name ( wxVariantBase &data ) \
- { return &data.wxTEMPLATED_MEMBER_CALL(Get, name); } \
- wxObject* wxVariantOfPtrToObjectConverter##name ( wxVariantBase &data ) \
- { return data.wxTEMPLATED_MEMBER_CALL(Get, name*); } \
- wxVariantBase wxObjectToVariantConverter##name ( wxObject *data ) \
- { return wxVariantBase( wx_dynamic_cast(name*, data) ); } \
- \
- const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo,NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor, \
- name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
- wxVariantOfPtrToObjectConverter##name, wxVariantToObjectConverter##name, \
- wxObjectToVariantConverter##name, callback);
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename ) \
- _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, "", NULL ) \
- _TYPEINFO_CLASSES(name, NULL, NULL) \
- const wxPropertyInfo *name::GetPropertiesStatic() \
- { return (wxPropertyInfo*) NULL; } \
- const wxHandlerInfo *name::GetHandlersStatic() \
- { return (wxHandlerInfo*) NULL; } \
- wxCONSTRUCTOR_DUMMY( name )
-
-#define wxIMPLEMENT_DYNAMIC_CLASS( name, basename ) \
- _IMPLEMENT_DYNAMIC_CLASS( name, basename, "", NULL ) \
- _TYPEINFO_CLASSES(name, NULL, NULL) \
- wxPropertyInfo *name::GetPropertiesStatic() \
- { return (wxPropertyInfo*) NULL; } \
- wxHandlerInfo *name::GetHandlersStatic() \
- { return (wxHandlerInfo*) NULL; } \
- wxCONSTRUCTOR_DUMMY( name )
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_XTI( name, basename, unit ) \
- _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, NULL ) \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_XTI_CALLBACK( name, basename, unit, callback )\
- _IMPLEMENT_DYNAMIC_CLASS( name, basename, unit, &callback ) \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_XTI( name, basename, unit ) \
- _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_WITH_COPY_AND_STREAMERS_XTI( name, basename, \
- unit, toString, \
- fromString ) \
- _IMPLEMENT_DYNAMIC_CLASS_WITH_COPY( name, basename, unit, NULL ) \
- _TYPEINFO_CLASSES(name, toString, fromString)
-
-// this is for classes that do not derive from wxObject, there are no creators for these
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name, unit ) \
- const wxClassInfo* name::ms_classParents[] = { NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
- name::GetPropertiesStatic(),name::GetHandlersStatic(), 0, 0, \
- 0, 0, 0 ); \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-// this is for subclasses that still do not derive from wxObject
-
-#define wxIMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name, basename, unit ) \
- const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo, NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
- name::GetPropertiesStatic(),name::GetHandlersStatic(), 0, 0, \
- 0, 0, 0 ); \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-
-// Multiple inheritance with two base classes
-
-#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit, callback) \
- wxObject* wxConstructorFor##name() { return new name; } \
- wxObject* wxVariantOfPtrToObjectConverter##name ( wxVariantBase &data ) \
- { return data.wxTEMPLATED_MEMBER_CALL(Get, name*); } \
- wxVariantBase wxObjectToVariantConverter##name ( wxObject *data ) \
- { return wxVariantBase( wx_dynamic_cast(name*, data) ); } \
- \
- const wxClassInfo* name::ms_classParents[] = \
- { &basename::ms_classInfo,&basename2::ms_classInfo, NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxT(unit), \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) wxConstructorFor##name, \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),name::ms_constructor, \
- name::ms_constructorProperties, name::ms_constructorPropertiesCount, \
- wxVariantOfPtrToObjectConverter##name, NULL, wxObjectToVariantConverter##name, \
- callback);
-
-#define wxIMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2) \
- _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, "", NULL) \
- _TYPEINFO_CLASSES(name, NULL, NULL) \
- wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; } \
- wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \
- wxCONSTRUCTOR_DUMMY( name )
-
-#define wxIMPLEMENT_DYNAMIC_CLASS2_XTI( name, basename, basename2, unit) \
- _IMPLEMENT_DYNAMIC_CLASS2( name, basename, basename2, unit, NULL) \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-
-
-// ----------------------------------------------------------------------------
-// wxIMPLEMENT class macros for abstract classes
-// ----------------------------------------------------------------------------
-
-// Single inheritance with one base class
-
-#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \
- wxObject* wxVariantToObjectConverter##name ( wxVariantBase &data ) \
- { return data.wxTEMPLATED_MEMBER_CALL(Get, name*); } \
- wxObject* wxVariantOfPtrToObjectConverter##name ( wxVariantBase &data ) \
- { return data.wxTEMPLATED_MEMBER_CALL(Get, name*); } \
- wxVariantBase wxObjectToVariantConverter##name ( wxObject *data ) \
- { return wxVariantBase( wx_dynamic_cast(name*, data) ); } \
- \
- const wxClassInfo* name::ms_classParents[] = \
- { &basename::ms_classInfo,NULL }; \
- wxClassInfo name::ms_classInfo(name::ms_classParents, wxEmptyString, \
- wxT(#name), (int) sizeof(name), (wxObjectConstructorFn) 0, \
- name::GetPropertiesStatic(),name::GetHandlersStatic(), 0, 0, \
- 0, wxVariantOfPtrToObjectConverter##name,wxVariantToObjectConverter##name, \
- wxObjectToVariantConverter##name); \
- _TYPEINFO_CLASSES(name, NULL, NULL)
-
-#define wxIMPLEMENT_ABSTRACT_CLASS( name, basename ) \
- _IMPLEMENT_ABSTRACT_CLASS( name, basename ) \
- wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL; } \
- wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL; }
-
-// Multiple inheritance with two base classes
-
-#define wxIMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
- wxClassInfo name::ms_classInfo(wxT(#name), wxT(#basename1), \
- wxT(#basename2), (int) sizeof(name), \
- (wxObjectConstructorFn) 0);
-
-
-
-// --------------------------------------------------------------------------
-// Collection Support
-// --------------------------------------------------------------------------
-
-template<typename iter, typename collection_t > void wxListCollectionToVariantArray(
- const collection_t& coll, wxVariantBaseArray &value )
-{
- iter current = coll.GetFirst();
- while (current)
- {
- value.Add( new wxVariantBase(current->GetData()) );
- current = current->GetNext();
- }
-}
-
-template<typename collection_t> void wxArrayCollectionToVariantArray(
- const collection_t& coll, wxVariantBaseArray &value )
-{
- for( size_t i = 0; i < coll.GetCount(); i++ )
- {
- value.Add( new wxVariantBase(coll[i]) );
- }
-}
-