gui: introduce virtual RenderItem method in ScrollList
- so derived lists can draw whatever they want (multi-line etc.)
- replace GetListItem with RenderItem
- minor cleanup
Change-Id: I062e0a354f1c18ce0a5232b7542c4987b480e232
diff --git a/gui/listbox.cpp b/gui/listbox.cpp
index 625b4b7..a607699 100644
--- a/gui/listbox.cpp
+++ b/gui/listbox.cpp
@@ -141,14 +141,14 @@
return mList.size();
}
-int GUIListBox::GetListItem(size_t item_index, ImageResource*& icon, std::string &text)
+void GUIListBox::RenderItem(size_t itemindex, int yPos, bool selected)
{
- text = mList.at(item_index).displayName;
- if (mList.at(item_index).selected)
- icon = mIconSelected;
- else
- icon = mIconUnselected;
- return 0;
+ // note: the "selected" parameter above is for the currently touched item
+ // don't confuse it with the more persistent "selected" flag per list item used below
+ ImageResource* icon = mList.at(itemindex).selected ? mIconSelected : mIconUnselected;
+ const std::string& text = mList.at(itemindex).displayName;
+
+ RenderStdItem(yPos, selected, icon, text.c_str());
}
void GUIListBox::NotifySelect(size_t item_selected)