if GetStringHelper is set in Menu<std::string>, invoke it
previously it always returned raw string and ignored this helper function, but there might be cases when one would want to use its own function e.g. to parse the string somehow.
This commit is contained in:
11
src/menu.cpp
11
src/menu.cpp
@@ -47,5 +47,14 @@ bool List::Deselect()
|
|||||||
|
|
||||||
template <> std::string Menu<std::string>::GetOption(size_t pos)
|
template <> std::string Menu<std::string>::GetOption(size_t pos)
|
||||||
{
|
{
|
||||||
return itsOptionsPtr->at(pos) ? (*itsOptionsPtr)[pos]->Item : "";
|
if (itsOptionsPtr->at(pos))
|
||||||
|
{
|
||||||
|
if (itsGetStringFunction)
|
||||||
|
return itsGetStringFunction((*itsOptionsPtr)[pos]->Item, itsGetStringFunctionUserData);
|
||||||
|
else
|
||||||
|
return (*itsOptionsPtr)[pos]->Item;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user