+ wxxVariantArray data ;
+ pi->GetAccessor()->GetPropertyCollection(obj, data) ;
+ const wxTypeInfo * elementType = dynamic_cast< const wxCollectionTypeInfo* >( pi->GetTypeInfo() )->GetElementType() ;
+ for ( size_t i = 0 ; i < data.GetCount() ; ++i )
+ {
+ if ( i == 0 )
+ DoBeginWriteProperty( pi ) ;
+
+ DoBeginWriteElement() ;
+ wxxVariant value = data[i] ;
+ if ( persister->BeforeWriteProperty( this , obj, pi , value ) )
+ {
+ const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( elementType ) ;
+ if ( cti )
+ {
+ const wxClassInfo* pci = cti->GetClassInfo() ;
+ wxObject *vobj = pci->VariantToInstance( value ) ;
+ wxxVariantArray md ;
+ WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md ) ;
+ }
+ else
+ {
+ DoWriteSimpleType( value ) ;
+ }
+ }
+ DoEndWriteElement() ;
+ if ( i == data.GetCount() - 1 )
+ DoEndWriteProperty( pi ) ;
+ }
+ }
+ else
+ {
+ const wxDelegateTypeInfo* dti = dynamic_cast< const wxDelegateTypeInfo* > ( pi->GetTypeInfo() ) ;
+ if ( dti )
+ {
+ const wxObject* sink = NULL ;
+ const wxHandlerInfo *handler = NULL ;
+
+ const wxEvtHandler * evSource = dynamic_cast<const wxEvtHandler *>(obj) ;
+ if ( evSource )
+ {
+ FindConnectEntry( evSource , dti , sink , handler ) ;
+ if ( persister->BeforeWriteDelegate( this , obj , ci , pi , sink , handler ) )
+ {
+ if ( sink != NULL && handler != NULL )
+ {
+ DoBeginWriteProperty( 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
+ {
+ wxxVariant value ;
+ pi->GetAccessor()->GetProperty(obj, value) ;
+
+ // avoid streaming out void objects
+ if( value.IsEmpty() )
+ return ;
+
+ if ( pi->GetFlags() & wxPROP_ENUM_STORE_LONG )
+ {
+ const wxEnumTypeInfo *eti = dynamic_cast<const wxEnumTypeInfo*>( pi->GetTypeInfo() ) ;
+ if ( eti )
+ {
+ eti->ConvertFromLong( value.wxTEMPLATED_MEMBER_CALL(Get , long) , value ) ;
+ }
+ else
+ {
+ wxLogError( _("Type must have enum - long conversion") ) ;
+ }
+ }
+
+ // avoid streaming out default values
+ if ( pi->GetTypeInfo()->HasStringConverters() && !pi->GetDefaultValue().IsEmpty() )
+ {
+ if ( value.GetAsString() == pi->GetDefaultValue().GetAsString() )
+ return ;
+ }
+
+ // avoid streaming out null objects
+ const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( pi->GetTypeInfo() ) ;
+
+ if ( cti && value.GetAsObject() == NULL )
+ return ;
+
+ if ( persister->BeforeWriteProperty( this , obj, pi , value ) )
+ {
+ DoBeginWriteProperty( pi ) ;
+ if ( cti )
+ {
+ const wxClassInfo* pci = cti->GetClassInfo() ;
+ wxObject *vobj = pci->VariantToInstance( value ) ;
+ if ( vobj && pi->GetTypeInfo()->HasStringConverters() )
+ {
+ wxString stringValue ;
+ cti->ConvertToString( value , stringValue ) ;
+ wxxVariant convertedValue(stringValue) ;
+ DoWriteSimpleType( convertedValue ) ;
+ }
+ else
+ {
+ wxxVariantArray md ;
+ WriteObject( vobj , (vobj ? vobj->GetClassInfo() : pci ) , persister , cti->GetKind()== wxT_OBJECT , md) ;
+ }
+ }
+ else
+ {
+ DoWriteSimpleType( value ) ;
+ }
+ DoEndWriteProperty( pi ) ;
+ }
+ }