void ObjectBase::SerializeObject( ticpp::Element* serializedElement ) { ticpp::Element element( "object" ); element.SetAttribute( "class", _STDSTR( GetClassName() ) ); element.SetAttribute( "expanded", GetExpanded() ); for ( unsigned int i = 0; i < GetPropertyCount(); i++ ) { PProperty prop = GetProperty( i ); ticpp::Element prop_element( "property" ); prop_element.SetAttribute( "name", _STDSTR( prop->GetName() ) ); prop_element.SetText( _STDSTR( prop->GetValue() ) ); element.LinkEndChild( &prop_element ); } for ( unsigned int i = 0; i < GetEventCount(); i++ ) { PEvent event = GetEvent( i ); ticpp::Element event_element( "event" ); event_element.SetAttribute( "name", _STDSTR( event->GetName() ) ); event_element.SetText( _STDSTR( event->GetValue() ) ); element.LinkEndChild( &event_element ); } for ( unsigned int i = 0 ; i < GetChildCount(); i++ ) { PObjectBase child = GetChild( i ); ticpp::Element child_element; child->SerializeObject( &child_element ); element.LinkEndChild( &child_element ); } *serializedElement = element; }
void PropEnumEditor::HandleEdit(int32 value) { PObject *obj = GetObject(); PProperty *prop = obj->FindProperty(fPropName->String()); obj->SetIntProperty(fPropName->String(),value); BMessage *editMsg = new BMessage(M_PROPERTY_EDITED); if (obj && prop) { editMsg->AddPointer("object",obj); editMsg->AddPointer("property",prop); editMsg->AddInt64("objectid",obj->GetID()); editMsg->AddString("name",prop->GetName()); *fPropName = prop->GetName(); } fMsgr->SendMessage(editMsg); }
void ObjectBase::AddProperty (PProperty prop) { m_properties.insert( PropertyMap::value_type( prop->GetName(), prop ) ); }