summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
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();