Add list_data property to GUI list controls, to associate extra data with the human-readable list item names.
This was SVN commit r7869.
This commit is contained in:
parent
95edc4ea4b
commit
2b6f11e834
@ -49,7 +49,9 @@ CList::CList()
|
|||||||
AddSetting(GUIST_int, "selected"); // Index selected. -1 is none.
|
AddSetting(GUIST_int, "selected"); // Index selected. -1 is none.
|
||||||
AddSetting(GUIST_CStr, "tooltip");
|
AddSetting(GUIST_CStr, "tooltip");
|
||||||
AddSetting(GUIST_CStr, "tooltip_style");
|
AddSetting(GUIST_CStr, "tooltip_style");
|
||||||
|
// Each list item has both a name (in 'list') and an associated data string (in 'list_data')
|
||||||
AddSetting(GUIST_CGUIList, "list");
|
AddSetting(GUIST_CGUIList, "list");
|
||||||
|
AddSetting(GUIST_CGUIList, "list_data"); // TODO: this should be a list of raw strings, not of CGUIStrings
|
||||||
|
|
||||||
GUI<bool>::SetSetting(this, "scrollbar", false);
|
GUI<bool>::SetSetting(this, "scrollbar", false);
|
||||||
|
|
||||||
@ -404,15 +406,20 @@ void CList::DrawList(const int &selected,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CList::AddItem(const CStr& str)
|
void CList::AddItem(const CStrW& str, const CStrW& data)
|
||||||
{
|
{
|
||||||
CGUIList *pList;
|
CGUIList *pList, *pListData;
|
||||||
GUI<CGUIList>::GetSettingPointer(this, "list", pList);
|
GUI<CGUIList>::GetSettingPointer(this, "list", pList);
|
||||||
|
GUI<CGUIList>::GetSettingPointer(this, "list_data", pListData);
|
||||||
|
|
||||||
CGUIString gui_string;
|
CGUIString gui_string;
|
||||||
gui_string.SetValue(str);
|
gui_string.SetValue(str);
|
||||||
pList->m_Items.push_back( gui_string );
|
pList->m_Items.push_back( gui_string );
|
||||||
|
|
||||||
|
CGUIString data_string;
|
||||||
|
data_string.SetValue(data);
|
||||||
|
pListData->m_Items.push_back( data_string );
|
||||||
|
|
||||||
// TODO Temp
|
// TODO Temp
|
||||||
SetupText();
|
SetupText();
|
||||||
}
|
}
|
||||||
@ -423,7 +430,7 @@ bool CList::HandleAdditionalChildren(const XMBElement& child, CXeromyces* pFile)
|
|||||||
|
|
||||||
if (child.GetNodeName() == elmt_item)
|
if (child.GetNodeName() == elmt_item)
|
||||||
{
|
{
|
||||||
AddItem(CStr(child.GetText()));
|
AddItem(CStrW(child.GetText()), CStrW(child.GetText()));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Adds an item last to the list.
|
* Adds an item last to the list.
|
||||||
*/
|
*/
|
||||||
virtual void AddItem(const CStr& str);
|
virtual void AddItem(const CStrW& str, const CStrW& data);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user