log changes
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -537,13 +537,14 @@ inline wxObject *wxCheckDynamicCast(wxObject *obj, wxClassInfo *classInfo)
|
|||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
|
class WXDLLIMPEXP_BASE wxDynamicObject : public wxObject
|
||||||
{
|
{
|
||||||
|
friend class WXDLLIMPEXP_BASE wxDynamicClassInfo ;
|
||||||
public:
|
public:
|
||||||
// instantiates this object with an instance of its superclass
|
// instantiates this object with an instance of its superclass
|
||||||
wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
|
wxDynamicObject(wxObject* superClassInstance, const wxDynamicClassInfo *info) ;
|
||||||
~wxDynamicObject();
|
~wxDynamicObject();
|
||||||
|
|
||||||
void SetProperty (const wxChar *PropertyName, const wxxVariant &Value);
|
void SetProperty (const wxChar *propertyName, const wxxVariant &value);
|
||||||
wxxVariant GetProperty (const wxChar *PropertyName) const ;
|
wxxVariant GetProperty (const wxChar *propertyName) const ;
|
||||||
|
|
||||||
// get the runtime identity of this object
|
// get the runtime identity of this object
|
||||||
wxClassInfo *GetClassInfo() const
|
wxClassInfo *GetClassInfo() const
|
||||||
@@ -556,6 +557,12 @@ public:
|
|||||||
return m_superClassInstance ;
|
return m_superClassInstance ;
|
||||||
}
|
}
|
||||||
private :
|
private :
|
||||||
|
// removes an existing runtime-property
|
||||||
|
void RemoveProperty( const wxChar *propertyName ) ;
|
||||||
|
|
||||||
|
// renames an existing runtime-property
|
||||||
|
void RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName ) ;
|
||||||
|
|
||||||
wxObject *m_superClassInstance ;
|
wxObject *m_superClassInstance ;
|
||||||
const wxDynamicClassInfo *m_classInfo;
|
const wxDynamicClassInfo *m_classInfo;
|
||||||
struct wxDynamicObjectInternal;
|
struct wxDynamicObjectInternal;
|
||||||
|
@@ -42,6 +42,8 @@
|
|||||||
#include "wx/string.h"
|
#include "wx/string.h"
|
||||||
#include "wx/arrstr.h"
|
#include "wx/arrstr.h"
|
||||||
#include "wx/hashmap.h"
|
#include "wx/hashmap.h"
|
||||||
|
#include "wx/log.h"
|
||||||
|
#include "wx/intl.h"
|
||||||
|
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
@@ -391,11 +393,11 @@ public :
|
|||||||
// convert a wxxVariant holding data of this type into a string
|
// convert a wxxVariant holding data of this type into a string
|
||||||
void ConvertToString( const wxxVariant& data , wxString &result ) const
|
void ConvertToString( const wxxVariant& data , wxString &result ) const
|
||||||
|
|
||||||
{ wxASSERT_MSG( m_toString , wxT("String conversions not supported") ) ; (*m_toString)( data , result ) ; }
|
{ if ( m_toString ) (*m_toString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; }
|
||||||
|
|
||||||
// convert a string into a wxxVariant holding the corresponding data in this type
|
// convert a string into a wxxVariant holding the corresponding data in this type
|
||||||
void ConvertFromString( const wxString& data , wxxVariant &result ) const
|
void ConvertFromString( const wxString& data , wxxVariant &result ) const
|
||||||
{ wxASSERT_MSG( m_fromString , wxT("String conversions not supported") ) ; (*m_fromString)( data , result ) ; }
|
{ if( m_fromString ) (*m_fromString)( data , result ) ; else wxLogError( _("String conversions not supported") ) ; }
|
||||||
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; }
|
static wxTypeInfo *FindType(const char *typeName) { return FindType( wxString::FromAscii(typeName) ) ; }
|
||||||
@@ -464,11 +466,11 @@ public :
|
|||||||
// convert a wxxVariant holding data of this type into a long
|
// convert a wxxVariant holding data of this type into a long
|
||||||
void ConvertToLong( const wxxVariant& data , long &result ) const
|
void ConvertToLong( const wxxVariant& data , long &result ) const
|
||||||
|
|
||||||
{ wxASSERT_MSG( m_toLong , wxT("Long conversions not supported") ) ; (*m_toLong)( data , result ) ; }
|
{ if( m_toLong ) (*m_toLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ; }
|
||||||
|
|
||||||
// convert a long into a wxxVariant holding the corresponding data in this type
|
// convert a long into a wxxVariant holding the corresponding data in this type
|
||||||
void ConvertFromLong( long data , wxxVariant &result ) const
|
void ConvertFromLong( long data , wxxVariant &result ) const
|
||||||
{ wxASSERT_MSG( m_fromLong , wxT("Long conversions not supported") ) ; (*m_fromLong)( data , result ) ; }
|
{ if( m_fromLong ) (*m_fromLong)( data , result ) ; else wxLogError( _("Long Conversions not supported") ) ;}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
converterToLong_t m_toLong ;
|
converterToLong_t m_toLong ;
|
||||||
@@ -536,15 +538,10 @@ template<typename T> const wxTypeInfo* wxGetTypeInfo( T * ) { return wxTypeInfo:
|
|||||||
#define wxCOLLECTION_TYPE_INFO( element , collection ) \
|
#define wxCOLLECTION_TYPE_INFO( element , collection ) \
|
||||||
wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ;
|
wxCollectionTypeInfo s_typeInfo##collection( typeid(element).name() , NULL , NULL , typeid(collection).name() ) ;
|
||||||
|
|
||||||
// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs
|
// sometimes a compiler invents specializations that are nowhere called, use this macro to satisfy the refs, currently
|
||||||
|
// we don't have to play tricks, but if we will have to according to the compiler, we will use that macro for that
|
||||||
|
|
||||||
#define wxILLEGAL_TYPE_SPECIALIZATION( a )
|
#define wxILLEGAL_TYPE_SPECIALIZATION( a )
|
||||||
/*
|
|
||||||
template<> const wxTypeInfo* wxGetTypeInfo( a * ) { assert(0) ; \
|
|
||||||
static wxBuiltInTypeInfo s_typeInfo( wxT_VOID ) ; return &s_typeInfo ; } \
|
|
||||||
template<> void wxStringReadValue(const wxString & , a & ) { assert(0) ; }\
|
|
||||||
template<> void wxStringWriteValue(wxString & , a const & ) { assert(0) ; }
|
|
||||||
*/
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxxVariant as typesafe data holder
|
// wxxVariant as typesafe data holder
|
||||||
@@ -798,19 +795,19 @@ public :
|
|||||||
|
|
||||||
// Setting a simple property (non-collection)
|
// Setting a simple property (non-collection)
|
||||||
virtual void SetProperty(wxObject *object, const wxxVariant &value) const
|
virtual void SetProperty(wxObject *object, const wxxVariant &value) const
|
||||||
{ wxASSERT_MSG(m_setter,wxT("SetProperty called w/o valid setter") ) ; m_setter->Set( object , value ) ;}
|
{ if ( m_setter ) m_setter->Set( object , value ) ; wxLogError( _("SetProperty called w/o valid setter") ) ;}
|
||||||
|
|
||||||
// Getting a simple property (non-collection)
|
// Getting a simple property (non-collection)
|
||||||
virtual void GetProperty(const wxObject *object, wxxVariant &result) const
|
virtual void GetProperty(const wxObject *object, wxxVariant &result) const
|
||||||
{ wxASSERT_MSG(m_getter,wxT("GetProperty called w/o valid getter") ) ; m_getter->Get( object , result ) ;}
|
{ if ( m_getter ) m_getter->Get( object , result ) ; else wxLogError( _("GetProperty called w/o valid getter") ) ;}
|
||||||
|
|
||||||
// Adding an element to a collection property
|
// Adding an element to a collection property
|
||||||
virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const
|
virtual void AddToPropertyCollection(wxObject *object, const wxxVariant &value) const
|
||||||
{ wxASSERT_MSG(m_adder,wxT("AddToPropertyCollection called w/o valid adder") ) ; m_adder->Add( object , value ) ;}
|
{ if ( m_adder ) m_adder->Add( object , value ) ; else wxLogError( _("AddToPropertyCollection called w/o valid adder") ) ;}
|
||||||
|
|
||||||
// Getting a collection property
|
// Getting a collection property
|
||||||
virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const
|
virtual void GetPropertyCollection( const wxObject *obj, wxxVariantArray &result) const
|
||||||
{ wxASSERT_MSG(m_collectionGetter,wxT("GetPropertyCollection called w/o valid collection getter") ) ; m_collectionGetter->Get( obj , result) ;}
|
{ if ( m_collectionGetter ) m_collectionGetter->Get( obj , result) ; else wxLogError( _("GetPropertyCollection called w/o valid collection getter") ) ;}
|
||||||
|
|
||||||
virtual bool HasSetter() const { return m_setter != NULL ; }
|
virtual bool HasSetter() const { return m_setter != NULL ; }
|
||||||
virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; }
|
virtual bool HasCollectionGetter() const { return m_collectionGetter != NULL ; }
|
||||||
@@ -858,11 +855,11 @@ public :
|
|||||||
|
|
||||||
// Adding an element to a collection property
|
// Adding an element to a collection property
|
||||||
virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const
|
virtual void AddToPropertyCollection(wxObject *WXUNUSED(object), const wxxVariant &WXUNUSED(value)) const
|
||||||
{ wxASSERT_MSG(0,wxT("AddToPropertyCollection called on a generic accessor") ) ;}
|
{ wxLogError( _("AddToPropertyCollection called on a generic accessor") ) ;}
|
||||||
|
|
||||||
// Getting a collection property
|
// Getting a collection property
|
||||||
virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const
|
virtual void GetPropertyCollection( const wxObject *WXUNUSED(obj), wxxVariantArray &WXUNUSED(result)) const
|
||||||
{ wxASSERT_MSG(0,wxT("GetPropertyCollection called on a generic accessor") ) ;}
|
{ wxLogError ( _("GetPropertyCollection called on a generic accessor") ) ;}
|
||||||
private :
|
private :
|
||||||
struct wxGenericPropertyAccessorInternal ;
|
struct wxGenericPropertyAccessorInternal ;
|
||||||
wxGenericPropertyAccessorInternal* m_data ;
|
wxGenericPropertyAccessorInternal* m_data ;
|
||||||
@@ -1604,7 +1601,11 @@ public:
|
|||||||
// direct construction call for classes that cannot construct instances via alloc/create
|
// direct construction call for classes that cannot construct instances via alloc/create
|
||||||
wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const
|
wxObject *ConstructObject(int ParamCount, wxxVariant *Params) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( ParamCount == m_constructorPropertiesCount , wxT("Illegal Parameter Count for ConstructObject Method")) ;
|
if ( ParamCount != m_constructorPropertiesCount )
|
||||||
|
{
|
||||||
|
wxLogError( _("Illegal Parameter Count for ConstructObject Method") ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
wxObject *object = NULL ;
|
wxObject *object = NULL ;
|
||||||
m_constructor->Create( object , Params ) ;
|
m_constructor->Create( object , Params ) ;
|
||||||
return object ;
|
return object ;
|
||||||
@@ -1673,7 +1674,11 @@ public:
|
|||||||
// initialized
|
// initialized
|
||||||
virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const
|
virtual void Create (wxObject *object, int ParamCount, wxxVariant *Params) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( ParamCount == m_constructorPropertiesCount , wxT("Illegal Parameter Count for Create Method")) ;
|
if ( ParamCount != m_constructorPropertiesCount )
|
||||||
|
{
|
||||||
|
wxLogError( _("Illegal Parameter Count for Create Method") ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
m_constructor->Create( object , Params ) ;
|
m_constructor->Create( object , Params ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1770,6 +1775,7 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxChar *name);
|
|||||||
|
|
||||||
class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo
|
class WXDLLIMPEXP_BASE wxDynamicClassInfo : public wxClassInfo
|
||||||
{
|
{
|
||||||
|
friend class WXDLLIMPEXP_BASE wxDynamicObject ;
|
||||||
public :
|
public :
|
||||||
wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ;
|
wxDynamicClassInfo( const wxChar *_UnitName, const wxChar *_ClassName , const wxClassInfo* superClass ) ;
|
||||||
virtual ~wxDynamicClassInfo() ;
|
virtual ~wxDynamicClassInfo() ;
|
||||||
@@ -1807,6 +1813,9 @@ public :
|
|||||||
|
|
||||||
// renames an existing runtime-handler
|
// renames an existing runtime-handler
|
||||||
void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ;
|
void RenameHandler( const wxChar *oldHandlerName , const wxChar *newHandlerName ) ;
|
||||||
|
private :
|
||||||
|
struct wxDynamicClassInfoInternal ;
|
||||||
|
wxDynamicClassInfoInternal* m_data ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
#if wxUSE_EXTENDED_RTTI
|
#if wxUSE_EXTENDED_RTTI
|
||||||
|
|
||||||
const int wxInvalidObjectID = -2 ;
|
const int wxInvalidObjectID = -2 ;
|
||||||
const int wxNullObjectID = -1 ;
|
const int wxNullObjectID = -3 ;
|
||||||
|
|
||||||
// Filer contains the interfaces for streaming objects in and out of XML,
|
// Filer contains the interfaces for streaming objects in and out of XML,
|
||||||
// rendering them either to objects in memory, or to code. Note: We
|
// rendering them either to objects in memory, or to code. Note: We
|
||||||
@@ -173,6 +173,8 @@ public :
|
|||||||
// Reads the component the reader is pointed at from the underlying format.
|
// Reads the component the reader is pointed at from the underlying format.
|
||||||
// The return value is the root object ID, which can
|
// The return value is the root object ID, which can
|
||||||
// then be used to ask the depersister about that object
|
// then be used to ask the depersister about that object
|
||||||
|
// if there was a problem you will get back wxInvalidObjectID and the current
|
||||||
|
// error log will carry the problems encoutered
|
||||||
virtual int ReadObject( const wxString &name , wxDepersister *depersist ) = 0 ;
|
virtual int ReadObject( const wxString &name , wxDepersister *depersist ) = 0 ;
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
@@ -37,6 +37,7 @@
|
|||||||
#include "wx/beforestd.h"
|
#include "wx/beforestd.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <list>
|
||||||
#include "wx/afterstd.h"
|
#include "wx/afterstd.h"
|
||||||
|
|
||||||
using namespace std ;
|
using namespace std ;
|
||||||
@@ -546,31 +547,22 @@ wxObject* wxxVariant::GetAsObject()
|
|||||||
// own attributes in a hash map. Like this it is possible to create the objects and
|
// own attributes in a hash map. Like this it is possible to create the objects and
|
||||||
// stream them, as if their class information was already available from compiled data
|
// stream them, as if their class information was already available from compiled data
|
||||||
|
|
||||||
// can't keep the attributes in a hash map, because if someone renames a property in
|
|
||||||
// the class info, then things go potty later on when we try to iterate through
|
|
||||||
// the property values by name.
|
|
||||||
struct wxDynamicProperty__
|
|
||||||
{
|
|
||||||
#if wxUSE_UNICODE
|
|
||||||
wstring name;
|
|
||||||
#else
|
|
||||||
string name;
|
|
||||||
#endif
|
|
||||||
wxxVariant value;
|
|
||||||
wxDynamicProperty__ *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct wxDynamicObject::wxDynamicObjectInternal
|
struct wxDynamicObject::wxDynamicObjectInternal
|
||||||
{
|
{
|
||||||
wxDynamicObjectInternal() : m_properties(NULL) {}
|
wxDynamicObjectInternal() {}
|
||||||
wxDynamicProperty__ *m_properties;
|
|
||||||
#if 0
|
|
||||||
#if wxUSE_UNICODE
|
#if wxUSE_UNICODE
|
||||||
map<wstring,wxxVariant> m_properties ;
|
map<wstring,wxxVariant> m_properties ;
|
||||||
#else
|
#else
|
||||||
map<string,wxxVariant> m_properties ;
|
map<string,wxxVariant> m_properties ;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
} ;
|
||||||
|
|
||||||
|
typedef list< wxDynamicObject* > wxDynamicObjectList ;
|
||||||
|
|
||||||
|
struct wxDynamicClassInfo::wxDynamicClassInfoInternal
|
||||||
|
{
|
||||||
|
wxDynamicObjectList m_dynamicObjects ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
// instantiates this object with an instance of its superclass
|
// instantiates this object with an instance of its superclass
|
||||||
@@ -583,6 +575,7 @@ wxDynamicObject::wxDynamicObject(wxObject* superClassInstance, const wxDynamicCl
|
|||||||
|
|
||||||
wxDynamicObject::~wxDynamicObject()
|
wxDynamicObject::~wxDynamicObject()
|
||||||
{
|
{
|
||||||
|
dynamic_cast<const wxDynamicClassInfo*>(m_classInfo)->m_data->m_dynamicObjects.remove( this ) ;
|
||||||
delete m_data ;
|
delete m_data ;
|
||||||
delete m_superClassInstance ;
|
delete m_superClassInstance ;
|
||||||
}
|
}
|
||||||
@@ -590,41 +583,30 @@ wxDynamicObject::~wxDynamicObject()
|
|||||||
void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant &value)
|
void wxDynamicObject::SetProperty (const wxChar *propertyName, const wxxVariant &value)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
|
||||||
wxDynamicProperty__ *prop;
|
m_data->m_properties[propertyName] = value ;
|
||||||
prop = m_data->m_properties;
|
|
||||||
while (prop)
|
|
||||||
{
|
|
||||||
if (!strcmp(prop->name.c_str(), propertyName))
|
|
||||||
{
|
|
||||||
prop->value = value;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
prop = prop->next;
|
|
||||||
}
|
|
||||||
prop = new wxDynamicProperty__;
|
|
||||||
prop->name = propertyName;
|
|
||||||
prop->value = value;
|
|
||||||
prop->next = m_data->m_properties;
|
|
||||||
m_data->m_properties = prop;
|
|
||||||
// m_data->m_properties[propertyName] = value ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const
|
wxxVariant wxDynamicObject::GetProperty (const wxChar *propertyName) const
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Accessing Unknown Property in a Dynamic Object") ) ;
|
||||||
wxDynamicProperty__ *prop;
|
return m_data->m_properties[propertyName] ;
|
||||||
prop = m_data->m_properties;
|
|
||||||
while (prop)
|
|
||||||
{
|
|
||||||
if (!strcmp(prop->name.c_str(), propertyName))
|
|
||||||
return prop->value;
|
|
||||||
prop = prop->next;
|
|
||||||
}
|
|
||||||
// FIXME: needs to return something a little more sane here.
|
|
||||||
return wxxVariant();
|
|
||||||
// return m_data->m_properties[propertyName] ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxDynamicObject::RemoveProperty( const wxChar *propertyName )
|
||||||
|
{
|
||||||
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(propertyName),wxT("Removing Unknown Property in a Dynamic Object") ) ;
|
||||||
|
m_data->m_properties.erase( propertyName ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxDynamicObject::RenameProperty( const wxChar *oldPropertyName , const wxChar *newPropertyName )
|
||||||
|
{
|
||||||
|
wxASSERT_MSG(m_classInfo->FindPropertyInfoInThisClass(oldPropertyName),wxT("Renaming Unknown Property in a Dynamic Object") ) ;
|
||||||
|
wxxVariant value = m_data->m_properties[oldPropertyName] ;
|
||||||
|
m_data->m_properties.erase( oldPropertyName ) ;
|
||||||
|
m_data->m_properties[newPropertyName] = value ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxDynamiClassInfo
|
// wxDynamiClassInfo
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -634,17 +616,21 @@ wxClassInfo( unitName, className , new const wxClassInfo*[2])
|
|||||||
{
|
{
|
||||||
GetParents()[0] = superClass ;
|
GetParents()[0] = superClass ;
|
||||||
GetParents()[1] = NULL ;
|
GetParents()[1] = NULL ;
|
||||||
|
m_data = new wxDynamicClassInfoInternal ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDynamicClassInfo::~wxDynamicClassInfo()
|
wxDynamicClassInfo::~wxDynamicClassInfo()
|
||||||
{
|
{
|
||||||
delete[] GetParents() ;
|
delete[] GetParents() ;
|
||||||
|
delete m_data ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxObject *wxDynamicClassInfo::AllocateObject() const
|
wxObject *wxDynamicClassInfo::AllocateObject() const
|
||||||
{
|
{
|
||||||
wxObject* parent = GetParents()[0]->AllocateObject() ;
|
wxObject* parent = GetParents()[0]->AllocateObject() ;
|
||||||
return new wxDynamicObject( parent , this ) ;
|
wxDynamicObject *obj = new wxDynamicObject( parent , this ) ;
|
||||||
|
m_data->m_dynamicObjects.push_back( obj ) ;
|
||||||
|
return obj ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxxVariant *params) const
|
void wxDynamicClassInfo::Create (wxObject *object, int paramCount, wxxVariant *params) const
|
||||||
@@ -699,6 +685,8 @@ void wxDynamicClassInfo::AddHandler( const wxChar *handlerName , wxObjectEventFu
|
|||||||
// removes an existing runtime-property
|
// removes an existing runtime-property
|
||||||
void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName )
|
void wxDynamicClassInfo::RemoveProperty( const wxChar *propertyName )
|
||||||
{
|
{
|
||||||
|
for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter )
|
||||||
|
(*iter)->RemoveProperty( propertyName ) ;
|
||||||
delete FindPropertyInfoInThisClass(propertyName) ;
|
delete FindPropertyInfoInThisClass(propertyName) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -715,6 +703,8 @@ void wxDynamicClassInfo::RenameProperty( const wxChar *oldPropertyName , const w
|
|||||||
wxASSERT_MSG( pi ,wxT("not existing property") ) ;
|
wxASSERT_MSG( pi ,wxT("not existing property") ) ;
|
||||||
pi->m_name = newPropertyName ;
|
pi->m_name = newPropertyName ;
|
||||||
dynamic_cast<wxGenericPropertyAccessor*>(pi->GetAccessor())->RenameProperty( oldPropertyName , newPropertyName ) ;
|
dynamic_cast<wxGenericPropertyAccessor*>(pi->GetAccessor())->RenameProperty( oldPropertyName , newPropertyName ) ;
|
||||||
|
for ( wxDynamicObjectList::iterator iter = m_data->m_dynamicObjects.begin() ; iter != m_data->m_dynamicObjects.end() ; ++iter )
|
||||||
|
(*iter)->RenameProperty( oldPropertyName , newPropertyName ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// renames an existing runtime-handler
|
// renames an existing runtime-handler
|
||||||
|
@@ -152,8 +152,14 @@ void wxWriter::WriteAllProperties( const wxObject * obj , const wxClassInfo* ci
|
|||||||
{
|
{
|
||||||
wxString name = ci->GetCreateParamName(i) ;
|
wxString name = ci->GetCreateParamName(i) ;
|
||||||
const wxPropertyInfo* prop = map.find(name)->second ;
|
const wxPropertyInfo* prop = map.find(name)->second ;
|
||||||
wxASSERT_MSG( prop , wxT("Create Parameter not found in declared RTTI Parameters") ) ;
|
if ( prop )
|
||||||
WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ;
|
{
|
||||||
|
WriteOneProperty( obj , prop->GetDeclaringClass() , prop , persister , data ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Create Parameter not found in declared RTTI Parameters") ) ;
|
||||||
|
}
|
||||||
map.erase( name ) ;
|
map.erase( name ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,19 +233,30 @@ void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , c
|
|||||||
const wxHandlerInfo *handler = NULL ;
|
const wxHandlerInfo *handler = NULL ;
|
||||||
|
|
||||||
const wxEvtHandler * evSource = dynamic_cast<const wxEvtHandler *>(obj) ;
|
const wxEvtHandler * evSource = dynamic_cast<const wxEvtHandler *>(obj) ;
|
||||||
wxASSERT_MSG( evSource , wxT("Illegal Object Class (Non-wxEvtHandler) as Event Source") ) ;
|
if ( evSource )
|
||||||
|
|
||||||
FindConnectEntry( evSource , dti , sink , handler ) ;
|
|
||||||
if ( persister->BeforeWriteDelegate( this , obj , ci , pi , sink , handler ) )
|
|
||||||
{
|
{
|
||||||
if ( sink != NULL && handler != NULL )
|
FindConnectEntry( evSource , dti , sink , handler ) ;
|
||||||
|
if ( persister->BeforeWriteDelegate( this , obj , ci , pi , sink , handler ) )
|
||||||
{
|
{
|
||||||
DoBeginWriteProperty( pi ) ;
|
if ( sink != NULL && handler != NULL )
|
||||||
wxASSERT_MSG( IsObjectKnown( sink ) , wxT("Streaming delegates for not already streamed objects not yet supported") ) ;
|
{
|
||||||
DoWriteDelegate( obj , ci , pi , sink , GetObjectID( sink ) , sink->GetClassInfo() , handler ) ;
|
DoBeginWriteProperty( pi ) ;
|
||||||
DoEndWriteProperty( pi ) ;
|
if ( IsObjectKnown( sink ) )
|
||||||
|
{
|
||||||
|
DoWriteDelegate( obj , ci , pi , sink , GetObjectID( sink ) , sink->GetClassInfo() , handler ) ;
|
||||||
|
DoEndWriteProperty( pi ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Streaming delegates for not already streamed objects not yet supported") ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError(_("Illegal Object Class (Non-wxEvtHandler) as Event Source") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -253,8 +270,14 @@ void wxWriter::WriteOneProperty( const wxObject *obj , const wxClassInfo* ci , c
|
|||||||
if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
||||||
{
|
{
|
||||||
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
||||||
wxASSERT_MSG( eti , wxT("Type must have enum - long conversion") ) ;
|
if ( eti )
|
||||||
eti->ConvertFromLong( value.Get<long>() , value ) ;
|
{
|
||||||
|
eti->ConvertFromLong( value.Get<long>() , value ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Type must have enum - long conversion") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// avoid streaming out default values
|
// avoid streaming out default values
|
||||||
@@ -335,18 +358,41 @@ wxReader::~wxReader()
|
|||||||
|
|
||||||
wxClassInfo* wxReader::GetObjectClassInfo(int objectID)
|
wxClassInfo* wxReader::GetObjectClassInfo(int objectID)
|
||||||
{
|
{
|
||||||
assert( m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() );
|
if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID )
|
||||||
|
{
|
||||||
|
wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
if ( m_data->m_classInfos.find(objectID) == m_data->m_classInfos.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Unknown Object passed to GetObjectClassInfo" ) ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
return m_data->m_classInfos[objectID] ;
|
return m_data->m_classInfos[objectID] ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo )
|
void wxReader::SetObjectClassInfo(int objectID, wxClassInfo *classInfo )
|
||||||
{
|
{
|
||||||
assert( m_data->m_classInfos.find(objectID) == m_data->m_classInfos.end() ) ;
|
if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID )
|
||||||
|
{
|
||||||
|
wxLogError( _("Invalid or Null Object ID passed to GetObjectClassInfo" ) ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
if ( m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Already Registered Object passed to SetObjectClassInfo" ) ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
m_data->m_classInfos[objectID] = classInfo ;
|
m_data->m_classInfos[objectID] = classInfo ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxReader::HasObjectClassInfo( int objectID )
|
bool wxReader::HasObjectClassInfo( int objectID )
|
||||||
{
|
{
|
||||||
|
if ( objectID == wxNullObjectID || objectID == wxInvalidObjectID )
|
||||||
|
{
|
||||||
|
wxLogError( _("Invalid or Null Object ID passed to HasObjectClassInfo" ) ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ;
|
return m_data->m_classInfos.find(objectID) != m_data->m_classInfos.end() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,15 +418,23 @@ struct wxRuntimeDepersister::wxRuntimeDepersisterInternal
|
|||||||
|
|
||||||
void SetObject(int objectID, wxObject *obj )
|
void SetObject(int objectID, wxObject *obj )
|
||||||
{
|
{
|
||||||
assert( m_objects.find(objectID) == m_objects.end() ) ;
|
if ( m_objects.find(objectID) != m_objects.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Passing a already registered object to SetObject") ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
m_objects[objectID] = obj ;
|
m_objects[objectID] = obj ;
|
||||||
}
|
}
|
||||||
wxObject* GetObject( int objectID )
|
wxObject* GetObject( int objectID )
|
||||||
{
|
{
|
||||||
if ( objectID == wxNullObjectID )
|
if ( objectID == wxNullObjectID )
|
||||||
return NULL ;
|
return NULL ;
|
||||||
|
if ( m_objects.find(objectID) == m_objects.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Passing an unkown object to GetObject") ) ;
|
||||||
|
return NULL ;
|
||||||
|
}
|
||||||
|
|
||||||
assert( m_objects.find(objectID) != m_objects.end() ) ;
|
|
||||||
return m_objects[objectID] ;
|
return m_objects[objectID] ;
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
@@ -582,15 +636,24 @@ struct wxCodeDepersister::wxCodeDepersisterInternal
|
|||||||
|
|
||||||
void SetObjectName(int objectID, const wxString &name )
|
void SetObjectName(int objectID, const wxString &name )
|
||||||
{
|
{
|
||||||
assert( m_objectNames.find(objectID) == m_objectNames.end() ) ;
|
if ( m_objectNames.find(objectID) != m_objectNames.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Passing a already registered object to SetObjectName") ) ;
|
||||||
|
return ;
|
||||||
|
}
|
||||||
m_objectNames[objectID] = (const wxChar *)name;
|
m_objectNames[objectID] = (const wxChar *)name;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetObjectName( int objectID )
|
wxString GetObjectName( int objectID )
|
||||||
{
|
{
|
||||||
if ( objectID == wxNullObjectID )
|
if ( objectID == wxNullObjectID )
|
||||||
return wxT("NULL") ;
|
return wxT("NULL") ;
|
||||||
|
|
||||||
assert( m_objectNames.find(objectID) != m_objectNames.end() ) ;
|
if ( m_objectNames.find(objectID) == m_objectNames.end() )
|
||||||
|
{
|
||||||
|
wxLogError( _("Passing an unkown object to GetObject") ) ;
|
||||||
|
return wxEmptyString ;
|
||||||
|
}
|
||||||
return wxString( m_objectNames[objectID].c_str() ) ;
|
return wxString( m_objectNames[objectID].c_str() ) ;
|
||||||
}
|
}
|
||||||
} ;
|
} ;
|
||||||
@@ -630,8 +693,14 @@ wxString wxCodeDepersister::ValueAsCode( const wxxVariant ¶m )
|
|||||||
if ( type->GetKind() == wxT_CUSTOM )
|
if ( type->GetKind() == wxT_CUSTOM )
|
||||||
{
|
{
|
||||||
const wxCustomTypeInfo* cti = dynamic_cast<const wxCustomTypeInfo*>(type) ;
|
const wxCustomTypeInfo* cti = dynamic_cast<const wxCustomTypeInfo*>(type) ;
|
||||||
wxASSERT_MSG( cti , wxT("Internal error, illegal wxCustomTypeInfo") ) ;
|
if ( cti )
|
||||||
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),param.GetAsString().c_str() );
|
{
|
||||||
|
value.Printf( wxT("%s(%s)"), cti->GetTypeName().c_str(),param.GetAsString().c_str() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError ( _("Internal error, illegal wxCustomTypeInfo") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( type->GetKind() == wxT_STRING )
|
else if ( type->GetKind() == wxT_STRING )
|
||||||
{
|
{
|
||||||
@@ -759,12 +828,18 @@ void wxCodeDepersister::SetConnect(int eventSourceObjectID,
|
|||||||
wxString ehsink = m_data->GetObjectName(eventSinkObjectID) ;
|
wxString ehsink = m_data->GetObjectName(eventSinkObjectID) ;
|
||||||
wxString ehsinkClass = eventSinkClassInfo->GetClassName() ;
|
wxString ehsinkClass = eventSinkClassInfo->GetClassName() ;
|
||||||
const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast<const wxDelegateTypeInfo*>(delegateInfo->GetTypeInfo());
|
const wxDelegateTypeInfo *delegateTypeInfo = dynamic_cast<const wxDelegateTypeInfo*>(delegateInfo->GetTypeInfo());
|
||||||
wxASSERT_MSG(delegateTypeInfo, "delegate has no type info");
|
if ( delegateTypeInfo )
|
||||||
int eventType = delegateTypeInfo->GetEventType() ;
|
{
|
||||||
wxString handlerName = handlerInfo->GetName() ;
|
int eventType = delegateTypeInfo->GetEventType() ;
|
||||||
|
wxString handlerName = handlerInfo->GetName() ;
|
||||||
|
|
||||||
m_fp->WriteString( wxString::Format( wxT("\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;") ,
|
m_fp->WriteString( wxString::Format( wxT("\t%s->Connect( %s->GetId() , %d , (wxObjectEventFunction)(wxEventFunction) & %s::%s , NULL , %s ) ;") ,
|
||||||
ehsource.c_str() , ehsource.c_str() , eventType , ehsinkClass.c_str() , handlerName.c_str() , ehsink.c_str() ) );
|
ehsource.c_str() , ehsource.c_str() , eventType , ehsinkClass.c_str() , handlerName.c_str() , ehsink.c_str() ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError(_("delegate has no type info"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <wx/arrimpl.cpp>
|
#include <wx/arrimpl.cpp>
|
||||||
|
@@ -226,8 +226,15 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
if (node->GetPropVal(wxT("href") , &ObjectIdString ) )
|
if (node->GetPropVal(wxT("href") , &ObjectIdString ) )
|
||||||
{
|
{
|
||||||
objectID = atoi( ObjectIdString.ToAscii() ) ;
|
objectID = atoi( ObjectIdString.ToAscii() ) ;
|
||||||
wxASSERT_MSG( HasObjectClassInfo( objectID ) , wxT("Forward hrefs are not supported") ) ;
|
if ( HasObjectClassInfo( objectID ) )
|
||||||
return objectID ;
|
{
|
||||||
|
return objectID ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Forward hrefs are not supported") ) ;
|
||||||
|
return wxInvalidObjectID ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( !node->GetPropVal(wxT("id") , &ObjectIdString ) )
|
if ( !node->GetPropVal(wxT("id") , &ObjectIdString ) )
|
||||||
{
|
{
|
||||||
@@ -240,17 +247,30 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
return wxInvalidObjectID;
|
return wxInvalidObjectID;
|
||||||
}
|
}
|
||||||
classInfo = wxClassInfo::FindClass(className);
|
classInfo = wxClassInfo::FindClass(className);
|
||||||
wxASSERT_MSG( classInfo , wxString::Format(wxT("unknown class %s"),className ) ) ;
|
if ( classInfo == NULL )
|
||||||
wxASSERT_MSG( !children || children->GetType() != wxXML_TEXT_NODE , wxT("objects cannot have XML Text Nodes") ) ;
|
{
|
||||||
|
wxLogError( wxString::Format(_("unknown class %s"),className ) ) ;
|
||||||
|
return wxInvalidObjectID ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( children != NULL && children->GetType() == wxXML_TEXT_NODE )
|
||||||
|
{
|
||||||
|
wxLogError(_("objects cannot have XML Text Nodes") ) ;
|
||||||
|
return wxInvalidObjectID;
|
||||||
|
}
|
||||||
if (!node->GetPropVal(wxT("id"), &ObjectIdString))
|
if (!node->GetPropVal(wxT("id"), &ObjectIdString))
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(0,wxT("Objects must have an id attribute") ) ;
|
wxLogError(_("Objects must have an id attribute") ) ;
|
||||||
// No object id. Eek. FIXME: error handling
|
// No object id. Eek. FIXME: error handling
|
||||||
return wxInvalidObjectID;
|
return wxInvalidObjectID;
|
||||||
}
|
}
|
||||||
objectID = atoi( ObjectIdString.ToAscii() ) ;
|
objectID = atoi( ObjectIdString.ToAscii() ) ;
|
||||||
// is this object already has been streamed in, return it here
|
// is this object already has been streamed in, return it here
|
||||||
wxASSERT_MSG( !HasObjectClassInfo( objectID ) , wxString::Format(wxT("Doubly used id : %d"), objectID ) ) ;
|
if ( HasObjectClassInfo( objectID ) )
|
||||||
|
{
|
||||||
|
wxLogError ( wxString::Format(_("Doubly used id : %d"), objectID ) ) ;
|
||||||
|
return wxInvalidObjectID ;
|
||||||
|
}
|
||||||
|
|
||||||
// new object, start with allocation
|
// new object, start with allocation
|
||||||
// first make the object know to our internal registry
|
// first make the object know to our internal registry
|
||||||
@@ -299,7 +319,10 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
const wxChar* paramName = classInfo->GetCreateParamName(i) ;
|
const wxChar* paramName = classInfo->GetCreateParamName(i) ;
|
||||||
PropertyNodes::iterator propiter = propertyNodes.find( paramName ) ;
|
PropertyNodes::iterator propiter = propertyNodes.find( paramName ) ;
|
||||||
const wxPropertyInfo* pi = classInfo->FindPropertyInfo( paramName ) ;
|
const wxPropertyInfo* pi = classInfo->FindPropertyInfo( paramName ) ;
|
||||||
wxASSERT_MSG(pi,wxString::Format(wxT("Unkown Property %s"),paramName) ) ;
|
if ( pi == 0 )
|
||||||
|
{
|
||||||
|
wxLogError( wxString::Format(_("Unkown Property %s"),paramName) ) ;
|
||||||
|
}
|
||||||
// if we don't have the value of a create param set in the xml
|
// if we don't have the value of a create param set in the xml
|
||||||
// we use the default value
|
// we use the default value
|
||||||
if ( propiter != propertyNodes.end() )
|
if ( propiter != propertyNodes.end() )
|
||||||
@@ -317,11 +340,16 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
||||||
{
|
{
|
||||||
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
||||||
wxASSERT_MSG( eti , wxT("Type must have enum - long conversion") ) ;
|
if ( eti )
|
||||||
|
{
|
||||||
long realval ;
|
long realval ;
|
||||||
eti->ConvertToLong( createParams[i] , realval ) ;
|
eti->ConvertToLong( createParams[i] , realval ) ;
|
||||||
createParams[i] = wxxVariant( realval ) ;
|
createParams[i] = wxxVariant( realval ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Type must have enum - long conversion") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
createClassInfos[i] = NULL ;
|
createClassInfos[i] = NULL ;
|
||||||
}
|
}
|
||||||
@@ -376,7 +404,11 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
const wxTypeInfo * elementType = collType->GetElementType() ;
|
const wxTypeInfo * elementType = collType->GetElementType() ;
|
||||||
while( prop )
|
while( prop )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG(prop->GetName() == wxT("element") , wxT("A non empty collection must consist of 'element' nodes")) ;
|
if ( prop->GetName() != wxT("element") )
|
||||||
|
{
|
||||||
|
wxLogError( _("A non empty collection must consist of 'element' nodes" ) ) ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
wxXmlNode* elementContent = prop->GetChildren() ;
|
wxXmlNode* elementContent = prop->GetChildren() ;
|
||||||
if ( elementContent )
|
if ( elementContent )
|
||||||
{
|
{
|
||||||
@@ -433,13 +465,19 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
{
|
{
|
||||||
wxString resstring = prop->GetContent() ;
|
wxString resstring = prop->GetContent() ;
|
||||||
wxInt32 pos = resstring.Find('.') ;
|
wxInt32 pos = resstring.Find('.') ;
|
||||||
assert( pos != wxNOT_FOUND ) ;
|
if ( pos != wxNOT_FOUND )
|
||||||
int sinkOid = atol(resstring.Left(pos).ToAscii()) ;
|
{
|
||||||
wxString handlerName = resstring.Mid(pos+1) ;
|
int sinkOid = atol(resstring.Left(pos).ToAscii()) ;
|
||||||
wxClassInfo* sinkClassInfo = GetObjectClassInfo( sinkOid ) ;
|
wxString handlerName = resstring.Mid(pos+1) ;
|
||||||
|
wxClassInfo* sinkClassInfo = GetObjectClassInfo( sinkOid ) ;
|
||||||
|
|
||||||
callbacks->SetConnect( objectID , classInfo , pi , sinkClassInfo ,
|
callbacks->SetConnect( objectID , classInfo , pi , sinkClassInfo ,
|
||||||
sinkClassInfo->FindHandlerInfo(handlerName) , sinkOid ) ;
|
sinkClassInfo->FindHandlerInfo(handlerName) , sinkOid ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("incorrect event handler string, missing dot") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -449,11 +487,16 @@ int wxXmlReader::ReadComponent(wxXmlNode *node, wxDepersister *callbacks)
|
|||||||
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
if( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
|
||||||
{
|
{
|
||||||
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
|
||||||
wxASSERT_MSG( eti , wxT("Type must have enum - long conversion") ) ;
|
if ( eti )
|
||||||
|
{
|
||||||
long realval ;
|
long realval ;
|
||||||
eti->ConvertToLong( nodeval , realval ) ;
|
eti->ConvertToLong( nodeval , realval ) ;
|
||||||
nodeval = wxxVariant( realval ) ;
|
nodeval = wxxVariant( realval ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogError( _("Type must have enum - long conversion") ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
callbacks->SetProperty( objectID, classInfo ,pi , nodeval ) ;
|
callbacks->SetProperty( objectID, classInfo ,pi , nodeval ) ;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user