void AttributeContainer::unserialize(Unserializer *unserializer) { // m_attributes.unserialize(unserializer); if(unserializer->key("attributes")) //need to fire off callbacks { if(unserializer->type()==Type::OBJECT) { unserializer->openObject(); std::vector<std::string> keys=m_attributes.keys(); for(auto &pair:m_attributes) { SharedAttribute &attribute=pair.second; if(unserializer->key(attribute->name())) { attribute->unserialize(unserializer); onAttributeChanged(attribute->name(), attribute); } } unserializer->closeObject(); } } }
void XUIObject::setAttribute(const char *attributeName, const char *attributeValue) { XUIAttribute *attrib = m_attributes.getAttribute(attributeName); if (attrib) { attrib->setValue(attributeValue); } else { m_attributes.addAttribute(attributeName, attributeValue, attrib); } onAttributeChanged(attributeName, attributeValue); eventSource_onAttributeChanged(attributeName, attributeValue); }
void AttributeContainer::attributeChanged(std::string name) { SharedAttribute localAttribute=attribute(name); if(localAttribute) { onAttributeChanged(name, localAttribute); if(!m_changeListners.empty()) { for(auto &listener:m_changeListners) listener->attributeChanged(this, name); } } }