summaryrefslogtreecommitdiff
path: root/src/gui/shoplistbox.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-01-10 22:09:42 +0000
committerJared Adams <jaxad0127@gmail.com>2010-01-10 22:37:27 +0000
commitada99b0ff2395e4d0853016306564f471bfc1bc8 (patch)
tree40333b3df190bb314bd98b8a46f48dd415548146 /src/gui/shoplistbox.cpp
parent34917f8ff44b0224f7199e7f1ffd55ba588a9cf7 (diff)
downloadMana-ada99b0ff2395e4d0853016306564f471bfc1bc8.tar.gz
Mana-ada99b0ff2395e4d0853016306564f471bfc1bc8.tar.bz2
Mana-ada99b0ff2395e4d0853016306564f471bfc1bc8.tar.xz
Mana-ada99b0ff2395e4d0853016306564f471bfc1bc8.zip
Change Buy and Sell dialogs to use ItemPopups
Diffstat (limited to 'src/gui/shoplistbox.cpp')
-rw-r--r--src/gui/shoplistbox.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp
index 6581a82d..fbdc22ce 100644
--- a/src/gui/shoplistbox.cpp
+++ b/src/gui/shoplistbox.cpp
@@ -19,9 +19,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include "gui/widgets/shoplistbox.h"
+
+#include "gui/itempopup.h"
#include "gui/palette.h"
#include "gui/shop.h"
-#include "gui/shoplistbox.h"
+#include "gui/viewport.h"
#include "configuration.h"
#include "graphics.h"
@@ -41,6 +44,8 @@ ShopListBox::ShopListBox(gcn::ListModel *listModel):
{
mRowHeight = getFont()->getHeight();
mPriceCheck = true;
+
+ mItemPopup = new ItemPopup;
}
ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel):
@@ -50,6 +55,8 @@ ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel):
{
mRowHeight = std::max(getFont()->getHeight(), ITEM_ICON_SIZE);
mPriceCheck = true;
+
+ mItemPopup = new ItemPopup;
}
void ShopListBox::setPlayersMoney(int money)
@@ -128,3 +135,21 @@ void ShopListBox::setPriceCheck(bool check)
{
mPriceCheck = check;
}
+
+void ShopListBox::mouseMoved(gcn::MouseEvent &event)
+{
+ if (!mShopItems)
+ return;
+
+ Item *item = mShopItems->at(event.getY() / mRowHeight);
+
+ if (item)
+ {
+ mItemPopup->setItem(item->getInfo());
+ mItemPopup->view(viewport->getMouseX(), viewport->getMouseY());
+ }
+ else
+ {
+ mItemPopup->setVisible(false);
+ }
+}