Changeset View
Changeset View
Standalone View
Standalone View
source/gui/ObjectTypes/COList.cpp
Show First 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | CRect COList::GetListRect() const | ||||
return m_CachedActualSize + CRect(0, m_HeadingHeight, 0, 0); | return m_CachedActualSize + CRect(0, m_HeadingHeight, 0, 0); | ||||
} | } | ||||
void COList::HandleMessage(SGUIMessage& Message) | void COList::HandleMessage(SGUIMessage& Message) | ||||
{ | { | ||||
CList::HandleMessage(Message); | CList::HandleMessage(Message); | ||||
switch (Message.type) | switch (Message.type) | ||||
{ | { | ||||
Silier: You need to move the check under correct type | |||||
Done Inline ActionsI can't compile with this, seems like ::algorithm is the issue. "must be a class or namespace name". Ended up using a different method (don't know if it's any good though). Grapjas: I can't compile with this, seems like ::algorithm is the issue. "must be a class or namespace… | |||||
// If somebody clicks on the column heading | // If somebody clicks on the column heading | ||||
case GUIM_MOUSE_PRESS_LEFT: | case GUIM_MOUSE_PRESS_LEFT: | ||||
{ | { | ||||
if (!m_Sortable) | if (!m_Sortable) | ||||
return; | return; | ||||
const CVector2D& mouse = m_pGUI.GetMousePos(); | const CVector2D& mouse = m_pGUI.GetMousePos(); | ||||
if (!m_CachedActualSize.PointInside(mouse)) | if (!m_CachedActualSize.PointInside(mouse)) | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | for (XMBAttribute attr : child.GetAttributes()) | ||||
// 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; | ||||
} | } | ||||
} | } | ||||
else if (attr_name == "heading") | else if (attr_name == "heading") | ||||
{ | { | ||||
column.m_Heading = attr_value.FromUTF8(); | column.m_Heading.Set(attr_value.FromUTF8(), false); | ||||
} | } | ||||
} | } | ||||
for (XMBElement grandchild : child.GetChildNodes()) | for (XMBElement grandchild : child.GetChildNodes()) | ||||
{ | { | ||||
if (grandchild.GetNodeName() != elmt_translatableAttribute) | if (grandchild.GetNodeName() != elmt_translatableAttribute) | ||||
continue; | continue; | ||||
CStr attributeName(grandchild.GetAttributes().GetNamedItem(attr_id)); | CStr attributeName(grandchild.GetAttributes().GetNamedItem(attr_id)); | ||||
// only the heading is translatable for list column | // only the heading is translatable for list column | ||||
if (attributeName.empty() || attributeName != "heading") | if (attributeName.empty() || attributeName != "heading") | ||||
{ | { | ||||
LOGERROR("GUI: translatable attribute in olist column that isn't a heading. (object: %s)", this->GetPresentableName().c_str()); | LOGERROR("GUI: translatable attribute in olist column that isn't a heading. (object: %s)", this->GetPresentableName().c_str()); | ||||
continue; | continue; | ||||
} | } | ||||
CStr value(grandchild.GetText()); | CStr value(grandchild.GetText()); | ||||
if (value.empty()) | if (value.empty()) | ||||
continue; | continue; | ||||
CStr context(grandchild.GetAttributes().GetNamedItem(attr_context)); // Read the context if any. | CStr context(grandchild.GetAttributes().GetNamedItem(attr_context)); // Read the context if any. | ||||
if (!context.empty()) | if (!context.empty()) | ||||
{ | { | ||||
CStr translatedValue(g_L10n.TranslateWithContext(context, value)); | CStr translatedValue(g_L10n.TranslateWithContext(context, value)); | ||||
column.m_Heading = translatedValue.FromUTF8(); | column.m_Heading.Set(translatedValue.FromUTF8(), false); | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
CStr translatedValue(g_L10n.Translate(value)); | CStr translatedValue(g_L10n.Translate(value)); | ||||
column.m_Heading = translatedValue.FromUTF8(); | column.m_Heading.Set(translatedValue.FromUTF8(), false); | ||||
} | } | ||||
} | } | ||||
m_Columns.emplace_back(std::move(column)); | m_Columns.emplace_back(std::move(column)); | ||||
return true; | return true; | ||||
} | } | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
You need to move the check under correct type