summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-22 23:02:17 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-22 23:02:17 +0300
commite59016e16e555e1e4d143110c5857274f7b6b98c (patch)
treea7eef4cef27d3bb837a7ebb50b963e5a92b127cb
parent2a964e325985d14cd6fb9ad83d14fb7538072f27 (diff)
downloadmv-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.gz
mv-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.bz2
mv-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.xz
mv-e59016e16e555e1e4d143110c5857274f7b6b98c.zip
add context menu for items in buy/sell dialogs.
-rw-r--r--src/gui/widgets/shoplistbox.cpp15
-rw-r--r--src/gui/widgets/shoplistbox.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index cc622653d..889cf4129 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -224,6 +224,21 @@ void ShopListBox::mouseMoved(gcn::MouseEvent &event)
}
}
+void ShopListBox::mouseReleased(gcn::MouseEvent& mouseEvent)
+{
+ ListBox::mousePressed(mouseEvent);
+ if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT)
+ {
+ setSelected(std::max(0, getSelectionByMouse(mouseEvent.getY())));
+
+ if (mSelected < 0 || mSelected >= mShopItems->getNumberOfElements())
+ return;
+
+ Item *const item = mShopItems->at(mSelected);
+ viewport->showItemPopup(item);
+ }
+}
+
void ShopListBox::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED)
{
if (!mItemPopup)
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 15aff3211..d471f5886 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -82,6 +82,8 @@ class ShopListBox final : public ListBox
void mouseMoved(gcn::MouseEvent &event) override;
+ void mouseReleased(gcn::MouseEvent& mouseEvent) override;
+
void mouseExited(gcn::MouseEvent& mouseEvent) override;
void setProtectItems(bool p)