summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-04 00:31:44 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-04 00:31:44 +0200
commit311783bebbe2bed366dca5097697ce34c690292d (patch)
tree0533581ca605f773a67739efccf75472a4d35dd7 /src/gui/inventorywindow.cpp
parent76bc1a5c994b46d8a4486a1226f681f7a4982f1c (diff)
downloadplus-311783bebbe2bed366dca5097697ce34c690292d.tar.gz
plus-311783bebbe2bed366dca5097697ce34c690292d.tar.bz2
plus-311783bebbe2bed366dca5097697ce34c690292d.tar.xz
plus-311783bebbe2bed366dca5097697ce34c690292d.zip
Add draw filter (incomplete)
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 3930ef207..a02fab4e6 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -93,15 +93,15 @@ InventoryWindow::InventoryWindow(Inventory *inventory):
mSlotsBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_INVY_SLOTS);
mFilter = new InventoryFilter(getWindowName(), 20, 10);
+ mFilter->addActionListener(this);
+ mFilter->setActionEventId("tags");
mFilterLabel = new Label(_("Filter:"));
std::vector<std::string> tags = ItemDB::getTags();
- for (int f = 0; f < tags.size(); f ++)
+ for (unsigned f = 0; f < tags.size(); f ++)
mFilter->add(tags[f]);
-// mFilter->add("All");
-
if (isMainInventory())
{
std::string equip = _("Equip");
@@ -207,8 +207,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
outfitWindow->requestMoveToTop();
}
}
-
- if (event.getId() == "shop")
+ else if (event.getId() == "shop")
{
if (shopWindow)
{
@@ -233,6 +232,12 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
ItemAmountWindow::showWindow(ItemAmountWindow::StoreAdd, this, item);
}
+ else if (!event.getId().find("tag_") && mItems)
+ {
+ std::string tagName = event.getId().substr(4);
+ mItems->setFilter(ItemDB::getTagId(tagName));
+// logger->log("eventid: %s", tagName.c_str());
+ }
Item *item = mItems->getSelectedItem();