Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/client')
-rw-r--r--src/client/Makefile.am4
-rw-r--r--src/client/inventorylistview.cc39
-rw-r--r--src/client/inventorylistview.h27
3 files changed, 68 insertions, 2 deletions
diff --git a/src/client/Makefile.am b/src/client/Makefile.am
index 741f5a3..ddc78a6 100644
--- a/src/client/Makefile.am
+++ b/src/client/Makefile.am
@@ -8,7 +8,7 @@ noinst_LTLIBRARIES = libclient.la
endif
libclient_la_SOURCES = action.cc buymenu.cc chat.cc client.cc clientext.cc \
- entitymenu.cc hud.cc infowidget.cc input.cc inventorymenu.cc joystick.cc key.cc \
+ entitymenu.cc hud.cc infowidget.cc input.cc inventorylistview.cc inventorymenu.cc joystick.cc key.cc \
keyboard.cc map.cc notifications.cc playerview.cc soundext.cc targeticonbutton.cc \
targets.cc trademenu.cc video.cc worldview.cc
@@ -17,7 +17,7 @@ libclient_la_CFLAGS = $(LIBSDL_CFLAGS) $(GL_CFLAGS)
libclient_la_LDFLAGS = -avoid-version -no-undefined $(GL_LIBS) $(LIBSDL_LIBS)
noinst_HEADERS = action.h chat.h client.h clientext.h hud.h entitymenu.h \
- input.h inventorymenu.h joystick.h key.h keyboard.h map.h notifications.h soundext.h \
+ input.h inventorylistview.h inventorymenu.h joystick.h key.h keyboard.h map.h notifications.h soundext.h \
targets.h video.h infowidget.h playerview.h worldview.h trademenu.h buymenu.h \
targeticonbutton.h
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
diff --git a/src/client/inventorylistview.h b/src/client/inventorylistview.h
new file mode 100644
index 0000000..82a9cc4
--- /dev/null
+++ b/src/client/inventorylistview.h
@@ -0,0 +1,27 @@
+/*
+ client/inventorylistview.h
+ This file is part of the Osirion project and is distributed under
+ the terms and conditions of the GNU General Public License version 2
+*/
+
+#ifndef __INCLUDED_CLIENT_INVENTORYLISTVIEW_H__
+#define __INCLUDED_CLIENT_INVENTORYLISTVIEW_H__
+
+#include "core/info.h"
+#include "core/inventory.h"
+#include "ui/listview.h"
+
+
+namespace client {
+
+class InventoryListView : public ui::ListView {
+public:
+ InventoryListView(ui::Widget *parent = 0);
+ ~InventoryListView();
+
+ void set_inventory(core::Inventory *inventory, core::InfoType *info_type);
+};
+
+} // namespace client
+
+#endif //__INCLUDED_CLIENT_INVENTORYLISTVIEW_H__ \ No newline at end of file