diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-10-22 23:02:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-10-22 23:02:17 +0300 |
commit | e59016e16e555e1e4d143110c5857274f7b6b98c (patch) | |
tree | a7eef4cef27d3bb837a7ebb50b963e5a92b127cb /src/gui/widgets/shoplistbox.cpp | |
parent | 2a964e325985d14cd6fb9ad83d14fb7538072f27 (diff) | |
download | manaplus-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.gz manaplus-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.bz2 manaplus-e59016e16e555e1e4d143110c5857274f7b6b98c.tar.xz manaplus-e59016e16e555e1e4d143110c5857274f7b6b98c.zip |
add context menu for items in buy/sell dialogs.
Diffstat (limited to 'src/gui/widgets/shoplistbox.cpp')
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 15 |
1 files changed, 15 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) |