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-09-17 23:05:58 +0000
committerStijn Buys <ingar@osirion.org>2010-09-17 23:05:58 +0000
commita85c3ca1ff34775f2fc93013306dec21b34b0359 (patch)
treedc45be555858f53413d2477680247c8758b98d2a /src/client/inventorylistview.cc
parent417eeaa34b8374de18358cc64511d7298bc33756 (diff)
Initial inventory loading, ships docking ships
Diffstat (limited to 'src/client/inventorylistview.cc')
-rw-r--r--src/client/inventorylistview.cc39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/client/inventorylistview.cc b/src/client/inventorylistview.cc
new file mode 100644
index 0000000..656adfb
--- /dev/null
+++ b/src/client/inventorylistview.cc
@@ -0,0 +1,39 @@
+/*
+ client/inventorylistview.cc
+ This file is part of the Osirion project and is distributed under
+ the terms and conditions of the GNU General Public License version 2
+*/
+
+#include "client/inventorylistview.h"
+#include "ui/listitem.h"
+
+namespace client {
+
+InventoryListView::InventoryListView(ui::Widget *parent) : ui::ListView (parent)
+{
+ set_inventory(0, 0);
+}
+
+void InventoryListView::set_inventory(core::Inventory *inventory, core::InfoType *info_type)
+{
+ remove_children();
+
+ if (!inventory || !info_type) {
+ return;
+ }
+
+ for (core::Inventory::Items::const_iterator it = inventory->items().begin(); it != inventory->items().end(); it++) {
+ core::Item *item = (*it);
+
+ if (item->info() && item->info()->type() == info_type) {
+ ui::ListItem *listitem = 0;
+ listitem = new ui::ListItem(this, item->info()->name().c_str());
+ listitem->set_height(listitem->font()->height() * 2.0f);
+ listitem->set_info(item->info());
+ }
+ }
+
+ event_resize();
+}
+
+} // namespace client \ No newline at end of file