#include "headers.h" static int sttParseTextToInt(const TCHAR *str) { if (!str) return 0; if (!lstrcmp(str, _T("auto"))) return -1; return _ttoi(str); } void CSkinObject::LoadFromXml(HXML hXml) { m_width = sttParseTextToInt(xi.getAttrValue(hXml, _T("width"))); m_height = sttParseTextToInt(xi.getAttrValue(hXml, _T("height"))); } void CSkinObject::SetParent(ISkinElement *parent) { if (m_parent) m_parent->RemoveChild(this); m_parent = parent; } void CSkinObject::SetId(const TCHAR *id) { if (m_id) free(m_id); m_id = _tcsdup(id); } void CSkinObject::SetDataSource(ISkinDataSource *ds) { m_ds = ds; } void CSkinObject::Destroy() { delete this; } void CSkinObject::Measure(SkinRenderParams *params) { SetRect(¶ms->rc, 0, 0, m_width, m_height); } void CSkinObject::Layout(SkinRenderParams *params) { m_rcPosition = params->rc; } bool CSkinObject::IsComplexObject() { return false; } ISkinElement *CSkinObject::GetParent() { return m_parent; } int CSkinObject::GetChildCount() { return 0; } ISkinElement *CSkinObject::GetChild(int index) { return NULL; } bool CSkinObject::AppendChild(ISkinElement *child) { return false; } bool CSkinObject::InsertChild(ISkinElement *child, int index) { return false; } void CSkinObject::RemoveChild(ISkinElement *child) { } void CSkinObject::SetPropText(const TCHAR *key, const TCHAR *value) { m_properties.insert(new Property(key, value)); } const TCHAR *CSkinObject::GetPropText(const TCHAR *key, const TCHAR *value) { Property search(key, 0); if (Property *result = m_properties.find(&search)) if (result->m_type == Property::Text) return result->m_valueText; return NULL; } void CSkinObject::SetPropInt(const TCHAR *key, int value) { m_properties.insert(new Property(key, value)); if (!lstrcmp(key, _T("width"))) m_width = value; else if (!lstrcmp(key, _T("height"))) m_height = value; } void CSkinObject::SetPropIntText(const TCHAR *key, const TCHAR *value) { SetPropInt(key, sttParseTextToInt(value)); } int CSkinObject::GetPropInt(const TCHAR *key) { Property search(key, 0); if (Property *result = m_properties.find(&search)) if (result->m_type == Property::Integer) return result->m_valueInt; return 0; }