diff options
author | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-21 14:14:52 +0000 |
---|---|---|
committer | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-21 14:14:52 +0000 |
commit | cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c (patch) | |
tree | 30df260fdc5a1b5a7049c2f8cac8b7ef17513d6d /skinengine/src/skin_object.cpp | |
parent | 19b6f534d2e784a1e120bf52c4aa07004798f473 (diff) |
svn.miranda.im is moving to a new home!
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'skinengine/src/skin_object.cpp')
-rw-r--r-- | skinengine/src/skin_object.cpp | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/skinengine/src/skin_object.cpp b/skinengine/src/skin_object.cpp new file mode 100644 index 0000000..3224191 --- /dev/null +++ b/skinengine/src/skin_object.cpp @@ -0,0 +1,116 @@ +#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;
+}
|