From dbe4b0a70a8ccf4c3be329f168d4388ba4b029b5 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 22 Jul 2012 18:46:20 +0300 Subject: Add equipment button to inventory window. --- src/gui/inventorywindow.cpp | 18 +++++++++++++++--- src/gui/inventorywindow.h | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/gui') diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index b2c92a32c..e4a318d69 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -31,6 +31,7 @@ #include "playerinfo.h" #include "units.h" +#include "gui/equipmentwindow.h" #include "gui/gui.h" #include "gui/itemamountwindow.h" #include "gui/outfitwindow.h" @@ -176,6 +177,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): mSplitButton = new Button(_("Split"), "split", this); mOutfitButton = new Button(_("Outfits"), "outfit", this); mShopButton = new Button(_("Shop"), "shop", this); + mEquipmentButton = new Button(_("Equipment"), "equipment", this); mWeightLabel = new Label(_("Weight:")); mWeightBar = new ProgressBar(0.0f, 100, 20, Theme::PROG_WEIGHT); @@ -193,9 +195,10 @@ InventoryWindow::InventoryWindow(Inventory *inventory): place(0, 2, invenScroll, 11).setPadding(3); place(0, 3, mUseButton); place(1, 3, mDropButton); - place(8, 3, mSplitButton); - place(9, 3, mShopButton); - place(10, 3, mOutfitButton); + place(8, 2, mSplitButton); + place(8, 3, mShopButton); + place(9, 3, mOutfitButton); + place(10, 3, mEquipmentButton); updateWeight(); } @@ -274,6 +277,15 @@ void InventoryWindow::action(const gcn::ActionEvent &event) shopWindow->requestMoveToTop(); } } + else if (event.getId() == "equipment") + { + if (equipmentWindow) + { + equipmentWindow->setVisible(!equipmentWindow->isVisible()); + if (equipmentWindow->isVisible()) + equipmentWindow->requestMoveToTop(); + } + } else if (event.getId() == "close") { close(); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 0aecaa81c..7829c40b6 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -162,8 +162,8 @@ class InventoryWindow : public Window, std::string mWeight, mSlots; - gcn::Button *mUseButton, *mDropButton, - *mSplitButton, *mOutfitButton, *mShopButton, + gcn::Button *mUseButton, *mDropButton, *mSplitButton, + *mOutfitButton, *mShopButton, *mEquipmentButton, *mStoreButton, *mRetrieveButton, *mCloseButton; gcn::Label *mWeightLabel, *mSlotsLabel, *mFilterLabel; -- cgit v1.2.3-60-g2f50