diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-05-05 21:00:06 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-05-05 21:00:49 -0600 |
commit | 99dbfa9e84ea30993d44d2a39bd5d06ae553c849 (patch) | |
tree | 504f8b35ef76f7fb67a5a21f136a20b8d1566dea /src/gui | |
parent | c305c76f82d832cb3db9e1edb805d24522a90c3f (diff) | |
download | mana-client-99dbfa9e84ea30993d44d2a39bd5d06ae553c849.tar.gz mana-client-99dbfa9e84ea30993d44d2a39bd5d06ae553c849.tar.bz2 mana-client-99dbfa9e84ea30993d44d2a39bd5d06ae553c849.tar.xz mana-client-99dbfa9e84ea30993d44d2a39bd5d06ae553c849.zip |
Fix the context menu for the storage window
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/popupmenu.cpp | 56 | ||||
-rw-r--r-- | src/gui/popupmenu.h | 2 | ||||
-rw-r--r-- | src/gui/storagewindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 4 | ||||
-rw-r--r-- | src/gui/viewport.h | 2 |
5 files changed, 46 insertions, 20 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index b02e6f2a..c46f673c 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -23,6 +23,7 @@ #include "gui/chat.h" #include "gui/inventorywindow.h" +#include "gui/storagewindow.h" #include "gui/itemamount.h" #include "gui/widgets/browserbox.h" @@ -290,6 +291,18 @@ void PopupMenu::handleLink(const std::string &link) inventoryWindow, mItem); } + else if (link == "store") + { + new ItemAmountWindow(ItemAmountWindow::StoreAdd, + inventoryWindow, mItem); + } + + else if (link == "retrieve") + { + new ItemAmountWindow(ItemAmountWindow::StoreRemove, + storageWindow, mItem); + } + else if (link == "party" && being && being->getType() == Being::PLAYER) { player_node->inviteToParty(dynamic_cast<Player*>(being)); @@ -324,31 +337,44 @@ void PopupMenu::handleLink(const std::string &link) mItem = NULL; } -void PopupMenu::showPopup(int x, int y, Item *item) +void PopupMenu::showPopup(int x, int y, Item *item, bool isInventory) { assert(item); mItem = item; mBrowserBox->clearRows(); - if (item->isEquipment()) + if (isInventory) { -#ifdef TMWSERV_SUPPORT - mBrowserBox->addRow(_("@@use|Equip@@")); -#else - if (item->isEquipped()) - mBrowserBox->addRow(_("@@use|Unequip@@")); + if (item->isEquipment()) + { + if (item->isEquipped()) + mBrowserBox->addRow(_("@@use|Unequip@@")); + else + mBrowserBox->addRow(_("@@use|Equip@@")); + } else - mBrowserBox->addRow(_("@@use|Equip@@")); -#endif - } - else - mBrowserBox->addRow(_("@@use|Use@@")); + mBrowserBox->addRow(_("@@use|Use@@")); + + mBrowserBox->addRow(_("@@drop|Drop@@")); - mBrowserBox->addRow(_("@@drop|Drop@@")); #ifdef TMWSERV_SUPPORT - if (!item->isEquipment()) - mBrowserBox->addRow(_("@@split|Split@@")); + if (!item->isEquipment()) + { + mBrowserBox->addRow(_("@@split|Split@@")); + } #endif + + if (player_node->getInStorage()) + { + mBrowserBox->addRow(_("@@store|Store@@")); + } + } + // Assume in storage for now + // TODO: make this whole system more flexible, if needed + else + { + mBrowserBox->addRow(_("@@retrieve|Retrieve@@")); + } mBrowserBox->addRow(_("@@chat|Add to chat@@")); mBrowserBox->addRow("##3---"); mBrowserBox->addRow(_("@@cancel|Cancel@@")); diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 1caa00af..cd5ddbed 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -56,7 +56,7 @@ class PopupMenu : public Popup, public LinkHandler * Shows the related popup menu when right click on the inventory * at the specified mouse coordinates. */ - void showPopup(int x, int y, Item *item); + void showPopup(int x, int y, Item *item, bool isInventory); /** * Handles link action. diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index d779800b..f3558830 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -178,7 +178,7 @@ void StorageWindow::mouseClicked(gcn::MouseEvent &event) */ const int mx = event.getX() + getX(); const int my = event.getY() + getY(); - viewport->showPopup(mx, my, item); + viewport->showPopup(mx, my, item, false); } } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 041794c2..f92a81b8 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -449,9 +449,9 @@ void Viewport::mouseReleased(gcn::MouseEvent &event) mPlayerFollowMouse = false; } -void Viewport::showPopup(int x, int y, Item *item) +void Viewport::showPopup(int x, int y, Item *item, bool isInventory) { - mPopupMenu->showPopup(x, y, item); + mPopupMenu->showPopup(x, y, item, isInventory); } void Viewport::closePopupMenu() diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 3dae5a2a..33a2d837 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -106,7 +106,7 @@ class Viewport : public WindowContainer, public gcn::MouseListener, * Shows a popup for an item. * TODO Find some way to get rid of Item here */ - void showPopup(int x, int y, Item *item); + void showPopup(int x, int y, Item *item, bool isInventory = true); /** * Closes the popup menu. Needed for when the player dies or switching |