diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 15 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 2 |
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) |