Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2010-11-08 23:33:49 +0000
committerStijn Buys <ingar@osirion.org>2010-11-08 23:33:49 +0000
commitbaf6ad1f48ef08187f50247115c09a3612ebeec3 (patch)
treec3c81f530c09b027f9880c8434df82a033a33323 /src/client/inventory.cc
parent106d0cb0cf884dd7a2920564852c001e13af1568 (diff)
added sorting of listview items
Diffstat (limited to 'src/client/inventory.cc')
-rw-r--r--src/client/inventory.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/client/inventory.cc b/src/client/inventory.cc
index c6e86da..4894d3d 100644
--- a/src/client/inventory.cc
+++ b/src/client/inventory.cc
@@ -100,12 +100,18 @@ void Inventory::update_inventory()
str << item->info()->name().c_str();
if (item->amount() > 0) {
str << " (" << item->amount() << ")";
- }
+ }
+
listitem = new ui::ListItem(menu_listview, str.str().c_str());
listitem->set_height(listitem->font()->height() * 2.0f);
listitem->set_item(item);
listitem->set_info(item->info());
+ std::string sortkey(item->info()->type()->label());
+ sortkey += '.';
+ sortkey += item->info()->label();
+ listitem->set_sortkey(sortkey);
+
// preserve previous selection during update
if (item == selecteditem) {
menu_listview->select(listitem);
@@ -128,6 +134,7 @@ void Inventory::update_inventory()
set_info(0, 0);
}
+ menu_listview->sort();
menu_listview->event_resize();
}