X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1125dc3f5cd23453ac8d321817436e5e7f1da923..5458b18a18a506e478bf2c4de1fb23ec1b0a33d4:/include/wx/xti.h diff --git a/include/wx/xti.h b/include/wx/xti.h index 7b2be4c003..659f26c6d2 100644 --- a/include/wx/xti.h +++ b/include/wx/xti.h @@ -84,6 +84,7 @@ class WXDLLIMPEXP_BASE wxObject; class WXDLLIMPEXP_BASE wxClassInfo; class WXDLLIMPEXP_BASE wxDynamicClassInfo; class WXDLLIMPEXP_BASE wxHashTable; +class WXDLLIMPEXP_BASE wxHashTable_Node; class WXDLLIMPEXP_BASE wxObjectRefData; class WXDLLIMPEXP_BASE wxEvent; class WXDLLIMPEXP_BASE wxEvtHandler; @@ -421,16 +422,24 @@ public : // convert a wxxVariant holding data of this type into a string void ConvertToString( const wxxVariant& data , wxString &result ) const - { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + { if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( wxGetTranslation(_T("String conversions not supported")) ) ; } // convert a string into a wxxVariant holding the corresponding data in this type void ConvertFromString( const wxString& data , wxxVariant &result ) const - { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; } + { if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( wxGetTranslation(_T("String conversions not supported")) ) ; } #if wxUSE_UNICODE static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; } #endif static wxTypeInfo *FindType(const wxChar *typeName); + static wxTypeInfo *FindType(const wxString typeName) + { +#if wxUSE_UNICODE + return FindType( typeName.wchar_str() ); +#else + return FindType( typeName.char_str() ); +#endif + } private : @@ -494,11 +503,11 @@ public : // convert a wxxVariant holding data of this type into a long void ConvertToLong( const wxxVariant& data , long &result ) const - { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; } + { if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ) ; } // convert a long into a wxxVariant holding the corresponding data in this type void ConvertFromLong( long data , wxxVariant &result ) const - { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;} + { if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( wxGetTranslation(_T("Long Conversions not supported")) ) ;} private : converterToLong_t m_toLong ; @@ -834,19 +843,19 @@ public : // Setting a simple property (non-collection) virtual void SetProperty(wxObject *object, const wxxVariant &value) const - { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( _("SetProperty called w/o valid setter") ) ;} + { if ( m_setter ) m_setter->Set( object , value ) ; else wxLogError( wxGetTranslation(_T("SetProperty called w/o valid setter")) ) ;} // Getting a simple property (non-collection) virtual void GetProperty(const wxObject *object, wxxVariant &result) const - { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;} + { if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( wxGetTranslation(_T("GetProperty called w/o valid getter")) ) ;} // Adding an element to a collection property virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const - { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;} + { if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( wxGetTranslation(_T("AddToPropertyCollection called w/o valid adder")) ) ;} // Getting a collection property virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const - { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;} + { if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( wxGetTranslation(_T("GetPropertyCollection called w/o valid collection getter")) ) ;} virtual bool HasSetter() const { return m_setter != NULL ; } virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; } @@ -895,11 +904,11 @@ public : // Adding an element to a collection property virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const - { wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;} + { wxLogError( wxGetTranslation(_T("AddToPropertyCollection called on a generic accessor")) ) ;} // Getting a collection property virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const - { wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;} + { wxLogError ( wxGetTranslation(_T("GetPropertyCollection called on a generic accessor")) ) ;} private : struct wxGenericPropertyAccessorInternal ; wxGenericPropertyAccessorInternal* m_data ; @@ -1267,6 +1276,7 @@ private : class WXDLLIMPEXP_BASE wxConstructorBridge { public : + virtual ~wxConstructorBridge() {}; virtual void Create(wxObject * &o, wxxVariant *args) = 0; }; @@ -1592,6 +1602,7 @@ class WXDLLIMPEXP_BASE wxClassInfo { friend class WXDLLIMPEXP_BASE wxPropertyInfo ; friend class WXDLLIMPEXP_BASE wxHandlerInfo ; + friend wxObject *wxCreateDynamicObject(const wxString& name); public: wxClassInfo(const wxClassInfo **_Parents, const wxChar *_UnitName, @@ -1665,7 +1676,7 @@ public: { if ( ParamCount != m_constructorPropertiesCount ) { - wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ; + wxLogError( wxGetTranslation(_T("Illegal Parameter Count for ConstructObject Method")) ) ; return NULL ; } wxObject *object = NULL ; @@ -1688,7 +1699,7 @@ public: wxObjectConstructorFn GetConstructor() const { return m_objectConstructor; } static const wxClassInfo *GetFirst() { return sm_first; } const wxClassInfo *GetNext() const { return m_next; } - static wxClassInfo *FindClass(const wxChar *className); + static wxClassInfo *FindClass(const wxString& className); // Climb upwards through inheritance hierarchy. // Dual inheritance is catered for. @@ -1709,6 +1720,8 @@ public: return false ; } + DECLARE_CLASS_INFO_ITERATORS() + // if there is a callback registered with that class it will be called // before this object will be written to disk, it can veto streaming out // this object by returning false, if this class has not registered a @@ -1733,7 +1746,7 @@ public: { if ( ParamCount != m_constructorPropertiesCount ) { - wxLogError( _("Illegal Parameter Count for Create Method") ) ; + wxLogError( wxGetTranslation(_T("Illegal Parameter Count for Create Method")) ) ; return ; } m_constructor->Create( object , Params ) ; @@ -1779,7 +1792,7 @@ public: // puts all the properties of this class and its superclasses in the map, as long as there is not yet // an entry with the same name (overriding mechanism) void GetProperties( wxPropertyInfoMap &map ) const ; -public: +private: const wxChar *m_className; int m_objectSize; wxObjectConstructorFn m_objectConstructor; @@ -1790,8 +1803,6 @@ public: static wxClassInfo *sm_first; wxClassInfo *m_next; - // FIXME: this should be private (currently used directly by way too - // many clients) static wxHashTable *sm_classTable; protected : @@ -1819,7 +1830,7 @@ protected: }; -WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name); +WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); // ---------------------------------------------------------------------------- // wxDynamicObject @@ -2006,27 +2017,27 @@ private : // Multiple inheritance with two base classes -#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit) \ +#define _IMPLEMENT_DYNAMIC_CLASS2(name, basename, basename2, unit, callback) \ wxObject* wxConstructorFor##name() \ { return new name; } \ const wxClassInfo* name::ms_classParents[] = { &basename::ms_classInfo ,&basename2::ms_classInfo , NULL } ; \ - wxObject* wxVariantToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ + wxObject* wxVariantOfPtrToObjectConverter##name ( wxxVariant &data ) { return data.wxTEMPLATED_MEMBER_CALL(Get , name*) ; } \ wxxVariant wxObjectToVariantConverter##name ( wxObject *data ) { return wxxVariant( dynamic_cast (data) ) ; } \ 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 , wxVariantToObjectConverter##name , wxObjectToVariantConverter##name); \ + name::ms_constructorPropertiesCount , wxVariantOfPtrToObjectConverter##name , NULL , wxObjectToVariantConverter##name , callback); #define IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2) \ - _IMPLEMENT_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 IMPLEMENT_DYNAMIC_CLASS2_XTI( name , basename , basename2, unit) \ - _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit) \ + _IMPLEMENT_DYNAMIC_CLASS2( name , basename , basename2 , unit, NULL) \ _TYPEINFO_CLASSES(name, NULL , NULL)