- // Initializes parent pointers and hash table for fast searching.
- // this is going to be removed by Register/Unregister calls
- // in Constructor / Destructor together with making the hash map private
-
- static void InitializeClasses();
-
- // Cleans up hash table used for fast searching.
-
- static void CleanUpClasses();
-
- // returns the first property
- const wxPropertyInfo* GetFirstProperty() const { return m_firstProperty ; }
-
- // returns the first handler
- const wxHandlerInfo* GetFirstHandler() const { return m_firstHandler ; }
-
- // Call the Create method for a class
- virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params)
- {
- wxASSERT( ParamCount == m_constructorPropertiesCount ) ;
- m_constructor->Create( object , Params ) ;
- }
-
- // get number of parameters for constructor
- virtual int GetCreateParamCount() const { return m_constructorPropertiesCount; }
-
- // get i-th constructor parameter
- virtual const wxChar* GetCreateParamName(int i) const { return m_constructorProperties[i] ; }
-
- // Runtime access to objects by property name, and variant data
- virtual void SetProperty (wxObject *object, const wxChar *PropertyName, const wxxVariant &Value);
- virtual wxxVariant GetProperty (wxObject *object, const wxChar *PropertyName);
-
- // we must be able to cast variants to wxObject pointers, templates seem not to be suitable
- wxObject* VariantToInstance( const wxxVariant &data ) const { return m_variantToObjectConverter( data ) ; }
- wxxVariant InstanceToVariant( wxObject *object ) const { return m_objectToVariantConverter( object ) ; }
-
- // find property by name
- virtual const wxPropertyInfo *FindPropertyInfo (const wxChar *PropertyName) const ;
-
- // find handler by name
- virtual const wxHandlerInfo *FindHandlerInfo (const wxChar *PropertyName) const ;
-
-public:
- const wxChar *m_className;
- int m_objectSize;
- wxObjectConstructorFn m_objectConstructor;
-
- // class info object live in a linked list:
- // pointers to its head and the next element in it
-
- static wxClassInfo *sm_first;
- wxClassInfo *m_next;
-
- // FIXME: this should be private (currently used directly by way too
- // many clients)
- static wxHashTable *sm_classTable;
-
-private:
- const wxClassInfo** m_parents ;
- const wxPropertyInfo * m_firstProperty ;
- const wxHandlerInfo * m_firstHandler ;
- const wxChar* m_unitName;
-
- wxConstructorBridge* m_constructor ;
- const wxChar ** m_constructorProperties ;
- const int m_constructorPropertiesCount ;
- wxVariantToObjectConverter m_variantToObjectConverter ;
- wxObjectToVariantConverter m_objectToVariantConverter ;
-
- const wxPropertyAccessor *FindAccessor (const wxChar *propertyName);
-
- // registers the class
- static void Register(const wxChar *name, wxClassInfo *info);
-
- static void Unregister(const wxChar *name);
-
- // InitializeClasses() helper
- static wxClassInfo *GetBaseByName(const wxChar *name);
-
- DECLARE_NO_COPY_CLASS(wxClassInfo)
-};
-
-WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name);
-
-// ----------------------------------------------------------------------------
-// Dynamic class macros
-// ----------------------------------------------------------------------------
-
-#define _DECLARE_DYNAMIC_CLASS(name) \
- public: \
- static wxClassInfo sm_class##name; \
- static const wxClassInfo* sm_classParents##name[] ; \
- static const wxPropertyInfo* GetPropertiesStatic() ; \
- static const wxHandlerInfo* GetHandlersStatic() ; \
- virtual wxClassInfo *GetClassInfo() const \
- { return &name::sm_class##name; }
-
-#define DECLARE_DYNAMIC_CLASS(name) \
- _DECLARE_DYNAMIC_CLASS(name) \
- static wxConstructorBridge* sm_constructor##name ; \
- static const wxChar * sm_constructorProperties##name[] ; \
- static const int sm_constructorPropertiesCount##name ;
-
-#define DECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
- DECLARE_NO_ASSIGN_CLASS(name) \
- DECLARE_DYNAMIC_CLASS(name)
-
-#define DECLARE_DYNAMIC_CLASS_NO_COPY(name) \
- DECLARE_NO_COPY_CLASS(name) \
- DECLARE_DYNAMIC_CLASS(name)
-
-#define DECLARE_ABSTRACT_CLASS(name) _DECLARE_DYNAMIC_CLASS(name)
-#define DECLARE_CLASS(name) DECLARE_DYNAMIC_CLASS(name)
-
-// -----------------------------------
-// for concrete classes
-// -----------------------------------
-
- // Single inheritance with one base class
-
-#define _IMPLEMENT_DYNAMIC_CLASS(name, basename, unit) \
- wxObject* wxConstructorFor##name() \
- { return new name; } \
- const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
- wxObject* wxVariantToObjectConverter##name ( const wxxVariant &data ) { return data.Get<name*>() ; } \
- wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
- wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \
- (int) sizeof(name), \
- (wxObjectConstructorFn) wxConstructorFor##name , \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \
- name::sm_constructorPropertiesCount##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
- template<> void wxStringReadValue(const wxString & , name * & ){assert(0) ;}\
- template<> void wxStringWriteValue(wxString & , name* const & ){assert(0) ;}\
- template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(&name::sm_class##name) ; return &s_typeInfo ; }
-
-#define IMPLEMENT_DYNAMIC_CLASS( name , basename ) \
-_IMPLEMENT_DYNAMIC_CLASS( name , basename , "" ) \
-const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \
-const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
-WX_CONSTRUCTOR_DUMMY( name )
-
-#define IMPLEMENT_DYNAMIC_CLASS_XTI( name , basename , unit ) \
-_IMPLEMENT_DYNAMIC_CLASS( name , basename , unit )
-
-// this is for classes that do not derive from wxobject, there are no creators for these
-
-#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_NO_BASE_XTI( name , unit ) \
- const wxClassInfo* name::sm_classParents##name[] = { NULL } ; \
- wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
- (int) sizeof(name), \
- (wxObjectConstructorFn) 0 , \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
- 0 , 0 , 0 ); \
- template<> void wxStringReadValue(const wxString & , name * & ){assert(0) ;}\
- template<> void wxStringWriteValue(wxString & , name* const & ){assert(0) ;}\
- template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(&name::sm_class##name) ; return &s_typeInfo ; }
-
-// this is for subclasses that still do not derive from wxobject
-
-#define IMPLEMENT_DYNAMIC_CLASS_NO_WXOBJECT_XTI( name , basename, unit ) \
- const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
- wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
- (int) sizeof(name), \
- (wxObjectConstructorFn) 0 , \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
- 0 , 0 , 0 ); \
- template<> void wxStringReadValue(const wxString & , name * & ){assert(0) ;}\
- template<> void wxStringWriteValue(wxString & , name* const & ){assert(0) ;}\
- template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(&name::sm_class##name) ; return &s_typeInfo ; }
-
- // Multiple inheritance with two base classes
-
-#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \
- wxObject* wxConstructorFor##name() \
- { return new name; } \
- const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,&basename2::sm_class##basename2 , NULL } ; \
- wxObject* wxVariantToObjectConverter##name ( const wxxVariant &data ) { return data.Get<name*>() ; } \
- wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
- wxClassInfo name::sm_class##name(sm_classParents##name , wxT(unit) , wxT(#name), \
- (int) sizeof(name), \
- (wxObjectConstructorFn) wxConstructorFor##name , \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),name::sm_constructor##name , name::sm_constructorProperties##name , \
- name::sm_constructorPropertiesCount##name , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
- template<> void wxStringReadValue(const wxString & , name * & ){assert(0) ;}\
- template<> void wxStringWriteValue(wxString & , name* const & ){assert(0) ;}\
- template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(&name::sm_class##name) ; return &s_typeInfo ; }
-
-#define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \
-_IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , "") \
-const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; } \
-const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
-WX_CONSTRUCTOR_DUMMY( name )
-
-#define IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \
- _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit)
-
-// -----------------------------------
-// for abstract classes
-// -----------------------------------
-
- // Single inheritance with one base class
-
-#define _IMPLEMENT_ABSTRACT_CLASS(name, basename) \
- const wxClassInfo* name::sm_classParents##name[] = { &basename::sm_class##basename ,NULL } ; \
- wxObject* wxVariantToObjectConverter##name ( const wxxVariant &data ) { return data.Get<name*>() ; } \
- wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast<name*> (data) ) ; } \
- wxClassInfo name::sm_class##name(sm_classParents##name , wxT("") , wxT(#name), \
- (int) sizeof(name), \
- (wxObjectConstructorFn) 0 , \
- name::GetPropertiesStatic(),name::GetHandlersStatic(),0 , 0 , \
- 0 , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \
- template<> void wxStringReadValue(const wxString & , name * & ){assert(0) ;}\
- template<> void wxStringWriteValue(wxString & , name* const & ){assert(0) ;}\
- template<> const wxTypeInfo* wxGetTypeInfo( name ** ){ static wxClassTypeInfo s_typeInfo(&name::sm_class##name) ; return &s_typeInfo ; }
-
-#define IMPLEMENT_ABSTRACT_CLASS( name , basename ) \
-_IMPLEMENT_ABSTRACT_CLASS( name , basename ) \
-const wxHandlerInfo *name::GetHandlersStatic() { return (wxHandlerInfo*) NULL ; } \
-const wxPropertyInfo *name::GetPropertiesStatic() { return (wxPropertyInfo*) NULL ; }
-
- // Multiple inheritance with two base classes
-
-#define IMPLEMENT_ABSTRACT_CLASS2(name, basename1, basename2) \
- wxClassInfo name::sm_class##name(wxT(#name), wxT(#basename1), \
- wxT(#basename2), (int) sizeof(name), \
- (wxObjectConstructorFn) 0);
-
-#define IMPLEMENT_CLASS IMPLEMENT_ABSTRACT_CLASS
-#define IMPLEMENT_CLASS2 IMPLEMENT_ABSTRACT_CLASS2
-
-#endif
\ No newline at end of file