From 311783bebbe2bed366dca5097697ce34c690292d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 4 Jan 2011 00:31:44 +0200 Subject: Add draw filter (incomplete) --- src/gui/inventorywindow.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/gui/inventorywindow.cpp') 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 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(); -- cgit v1.2.3-60-g2f50