-wxxVariant wxReader::ReadPropertyValueNoAssign(wxXmlNode *Node,
- wxClassInfo *ClassInfo,
- const wxPropertyInfo * &pi ,
- wxIDepersist *Callbacks)
-{
- wxxVariant res;
- int ChildID;
-
- // form is:
- // <propname type=foo>value</propname>
-
- //ISSUE: NULL component references are streamed out as "null" text
- // node. This is not in keeping with the XML mindset.
-
- pi = ClassInfo->FindPropertyInfo(Node->GetName());
- if (!pi)
- {
- // error handling, please
- assert(!"Property not found in extended class info");
- }
-
- const wxClassTypeInfo* cti = dynamic_cast< const wxClassTypeInfo* > ( pi->GetTypeInfo() ) ;
- if ( cti )
- {
- const wxClassInfo* eci = cti->GetClassInfo() ;
-
- ChildID = ReadComponent(Node , Callbacks);
- if (ChildID != -1)
- {
- if (genCode)
- res = wxxVariant(GetObjectName(ChildID));
- else
- res = eci->InstanceToVariant(GetObject(ChildID));
- }
- else
- {
- if (genCode)
- res = wxxVariant(wxString("NULL"));
- else
- res = eci->InstanceToVariant(NULL);
- }
- }
- else
- {
- const wxDelegateTypeInfo* dti = dynamic_cast< const wxDelegateTypeInfo* > ( pi->GetTypeInfo() ) ;
- if ( dti )
- {
- if (genCode)
- {
- // in which form should we code these ?
- res = wxxVariant( wxXmlGetContentFromNode(Node) ) ;
- }
- else
- {
- res = wxxVariant( wxXmlGetContentFromNode(Node) ) ;
- }
- }
- else
- {
- if (genCode)
- {
- if ( pi->GetTypeInfo()->GetKind() == wxT_STRING )
- res = wxxVariant( wxString::Format("wxString(\"%s\")",wxXmlGetContentFromNode(Node)));
- else
- res = wxxVariant( wxString::Format("%s(%s)",pi->GetTypeName(),wxXmlGetContentFromNode(Node) ) );
- }
- else
- res = pi->GetAccessor()->ReadValue(Node) ;
- }
- }
- return res ;
-}
-
-void wxReader::ReadPropertyValue(wxXmlNode *Node,
- wxClassInfo *ClassInfo,
- int ObjectID ,
- wxIDepersist *Callbacks)
-{
- const wxPropertyInfo *pi;
- wxxVariant res = ReadPropertyValueNoAssign( Node , ClassInfo, pi , Callbacks ) ;
-
- const wxDelegateTypeInfo* dti = dynamic_cast< const wxDelegateTypeInfo* > ( pi->GetTypeInfo() ) ;
-
- if ( dti )
- {
- wxString resstring = res.Get<wxString>() ;
- wxInt32 pos = resstring.Find('.') ;
- assert( pos != wxNOT_FOUND ) ;
- int handlerOid = atol(resstring.Left(pos)) ;
- wxString handlerName = resstring.Mid(pos+1) ;
-
- if (Callbacks)
- Callbacks->SetConnect( ObjectID , ClassInfo , dti->GetEventType() , handlerName , handlerOid ) ;
- }
- else
- {
- if (Callbacks)
- Callbacks->SetProperty(ObjectID, ClassInfo, pi , res);
- }
-}
-