diff options
author | Chuck Miller <shadowmil@gmail.com> | 2009-05-05 18:38:44 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2009-05-05 18:38:44 -0400 |
commit | 2ab5dd8b3183f228a4f2038d378ad7100ed241a2 (patch) | |
tree | 0a67225590b88f856ee92868676d0f1ba01e2dbe | |
parent | bff134a0803f68a7bf69cf2f1121824137d4b2fb (diff) | |
parent | 45296672d98ca04cd2e659d5a733bff906342d80 (diff) | |
download | mana-2ab5dd8b3183f228a4f2038d378ad7100ed241a2.tar.gz mana-2ab5dd8b3183f228a4f2038d378ad7100ed241a2.tar.bz2 mana-2ab5dd8b3183f228a4f2038d378ad7100ed241a2.tar.xz mana-2ab5dd8b3183f228a4f2038d378ad7100ed241a2.zip |
Merge branch 'master' of git://gitorious.org/tmw/mainline
-rw-r--r-- | src/gui/itempopup.cpp | 8 | ||||
-rw-r--r-- | src/gui/itempopup.h | 7 | ||||
-rw-r--r-- | src/gui/sell.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/popup.h | 14 |
4 files changed, 25 insertions, 9 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 2a45a06a..e1822e03 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -66,6 +66,8 @@ ItemPopup::ItemPopup(): add(mItemEffect); add(mItemWeight); + addMouseListener(this); + loadPopupConfiguration(); } @@ -178,3 +180,9 @@ void ItemPopup::view(int x, int y) setVisible(true); requestMoveToTop(); } + +void ItemPopup::mouseMoved(gcn::MouseEvent &event) +{ + // When the mouse moved on top of the popup, hide it + setVisible(false); +} diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 6140e4dd..e4bef371 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -27,12 +27,15 @@ #include "resources/iteminfo.h" +#include <guichan/mouselistener.hpp> + class TextBox; /** * A popup that displays information about an item. */ -class ItemPopup : public Popup +class ItemPopup : public Popup, + public gcn::MouseListener { public: /** @@ -55,6 +58,8 @@ class ItemPopup : public Popup */ void view(int x, int y); + void mouseMoved(gcn::MouseEvent &mouseEvent); + private: gcn::Label *mItemName; TextBox *mItemDesc; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index c9b9d649..28288ef4 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -182,16 +182,17 @@ void SellDialog::action(const gcn::ActionEvent &event) { // Attempt sell ShopItem *item = mShopItems->at(selectedItem); - int sellCount; + int sellCount, itemIndex; mPlayerMoney += mAmountItems * mShopItems->at(selectedItem)->getPrice(); mMaxItems -= mAmountItems; while (mAmountItems > 0) { // This order is important, item->getCurrentInvIndex() would return // the inventory index of the next Duplicate otherwise. + itemIndex = item->getCurrentInvIndex(); sellCount = item->sellCurrentDuplicate(mAmountItems); + Net::getNpcHandler()->sellItem(current_npc, itemIndex, sellCount); mAmountItems -= sellCount; - Net::getNpcHandler()->sellItem(current_npc, item->getCurrentInvIndex(), sellCount); } mPlayerMoney += diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index 895484b0..119ed841 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -32,12 +32,14 @@ class Skin; class WindowContainer; /** - * A rather reduced down version of the Window class that is particularly suited - * for popup type functionality that doesn't need to be resized or moved around - * by the mouse once created, but only needs to display some simple content, - * like a static message. Popups, in general, shouldn't also need to update - * their content once created, although this is not an explicit requirement to - * use the popup class. + * A light version of the Window class. Particularly suited for popup type + * functionality that doesn't need to be resized or moved around by the mouse + * once created, but only needs to display some simple content, like a static + * message. + * + * Popups, in general, shouldn't also need to update their content once + * created, although this is not an explicit requirement to use the popup + * class. * * \ingroup GUI */ |