Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/gui/ObjectTypes/COList.cpp
Show First 20 Lines • Show All 197 Lines • ▼ Show 20 Lines | if (child.GetNodeName() == elmt_item) | ||||
return true; | return true; | ||||
} | } | ||||
else if (child.GetNodeName() == elmt_column) | else if (child.GetNodeName() == elmt_column) | ||||
{ | { | ||||
COListColumn column; | COListColumn column; | ||||
for (XMBAttribute attr : child.GetAttributes()) | for (XMBAttribute attr : child.GetAttributes()) | ||||
{ | { | ||||
CStr attr_name(pFile->GetAttributeString(attr.Name)); | std::string_view attr_name(pFile->GetAttributeStringView(attr.Name)); | ||||
CStr attr_value(attr.Value); | CStr attr_value(attr.Value); | ||||
if (attr_name == "color") | if (attr_name == "color") | ||||
{ | { | ||||
if (!CGUI::ParseString<CGUIColor>(&m_pGUI, attr_value.FromUTF8(), column.m_TextColor)) | if (!CGUI::ParseString<CGUIColor>(&m_pGUI, attr_value.FromUTF8(), column.m_TextColor)) | ||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.data(), attr_value.c_str()); | ||||
} | } | ||||
else if (attr_name == "id") | else if (attr_name == "id") | ||||
{ | { | ||||
column.m_Id = attr_value; | column.m_Id = attr_value; | ||||
} | } | ||||
else if (attr_name == "hidden") | else if (attr_name == "hidden") | ||||
{ | { | ||||
bool hidden = false; | bool hidden = false; | ||||
if (!CGUI::ParseString<bool>(&m_pGUI, attr_value.FromUTF8(), hidden)) | if (!CGUI::ParseString<bool>(&m_pGUI, attr_value.FromUTF8(), hidden)) | ||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.data(), attr_value.c_str()); | ||||
else | else | ||||
column.m_Hidden = hidden; | column.m_Hidden = hidden; | ||||
} | } | ||||
else if (attr_name == "width") | else if (attr_name == "width") | ||||
{ | { | ||||
float width; | float width; | ||||
if (!CGUI::ParseString<float>(&m_pGUI, attr_value.FromUTF8(), width)) | if (!CGUI::ParseString<float>(&m_pGUI, attr_value.FromUTF8(), width)) | ||||
LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.c_str(), attr_value.c_str()); | LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name.data(), attr_value.c_str()); | ||||
else | else | ||||
{ | { | ||||
// Check if it's a relative value, and save as decimal if so. | // Check if it's a relative value, and save as decimal if so. | ||||
if (attr_value.find("%") != std::string::npos) | if (attr_value.find("%") != std::string::npos) | ||||
width = width / 100.f; | width = width / 100.f; | ||||
column.m_Width = width; | column.m_Width = width; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 204 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator