GUI: Support styles in xml to reduce xml file size
Also allow sliders to have their own text label instead of
requiring a whole separate text object for the label in the xml.
Change-Id: I6e314efb4bb454d496555ff7e003d743063a1308
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
index 8d9ab42..4b772d4 100644
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -65,18 +65,9 @@
mLastHeaderValue = gui_parse_text(mHeaderText);
mHeaderIsStatic = (mLastHeaderValue == mHeaderText);
- memset(&mHighlightColor, 0, sizeof(COLOR));
- child = node->first_node("highlight");
- if (child) {
- attr = child->first_attribute("color");
- if (attr) {
- hasHighlightColor = true;
- std::string color = attr->value();
- ConvertStrToColor(color, &mHighlightColor);
- }
- }
+ mHighlightColor = LoadAttrColor(FindNode(node, "highlight"), "color", &hasHighlightColor);
- child = node->first_node("background");
+ child = FindNode(node, "background");
if (child)
{
mBackground = LoadAttrImage(child, "resource");
@@ -84,11 +75,11 @@
}
// Load the placement
- LoadPlacement(node->first_node("placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH);
+ LoadPlacement(FindNode(node, "placement"), &mRenderX, &mRenderY, &mRenderW, &mRenderH);
SetActionPos(mRenderX, mRenderY, mRenderW, mRenderH);
// Load the font, and possibly override the color
- child = node->first_node("font");
+ child = FindNode(node, "font");
if (child)
{
mFont = LoadAttrFont(child, "resource");
@@ -98,7 +89,7 @@
}
// Load the separator if it exists
- child = node->first_node("separator");
+ child = FindNode(node, "separator");
if (child)
{
mSeparatorColor = LoadAttrColor(child, "color");
@@ -106,7 +97,7 @@
}
// Fast scroll
- child = node->first_node("fastscroll");
+ child = FindNode(node, "fastscroll");
if (child)
{
mFastScrollLineColor = LoadAttrColor(child, "linecolor");
@@ -123,7 +114,7 @@
actualItemHeight = mFontHeight + mItemSpacing + mSeparatorH;
// Load the header if it exists
- child = node->first_node("header");
+ child = FindNode(node, "header");
if (child)
{
mHeaderH = mFontHeight;