diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-30 20:51:36 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-08-30 20:51:36 +0200 |
commit | ebe29a9410458abac19c4ba10d5dce476e7ca34b (patch) | |
tree | bd8d2e2d3fb57822562d5b253a1cfd2057061e39 /src/gui/equipmentwindow.cpp | |
parent | 005a76ce5d539666022c80eb5b0c1dd760db19e7 (diff) | |
download | mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.gz mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.bz2 mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.tar.xz mana-ebe29a9410458abac19c4ba10d5dce476e7ca34b.zip |
Made the popup-menu work again for equip/unequip processes.
I disabled the drop from equipment window since it was more
simple to implement, and because it seemed useless or even bad
for the user experience to me.
Diffstat (limited to 'src/gui/equipmentwindow.cpp')
-rw-r--r-- | src/gui/equipmentwindow.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 212dcd2b..4b269325 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -211,30 +211,32 @@ void EquipmentWindow::mousePressed(gcn::MouseEvent& mouseEvent) const int x = mouseEvent.getX(); const int y = mouseEvent.getY(); + Item *item = 0; - if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) + // Checks if any of the presses were in the equip boxes. + for (int i = 0; i < mBoxesNumber; ++i) { - // Checks if any of the presses were in the equip boxes. - for (int i = 0; i < mBoxesNumber; ++i) - { - Item *item = mEquipment->getEquipment(i); - gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY, - BOX_WIDTH, BOX_HEIGHT); + item = mEquipment->getEquipment(i); + gcn::Rectangle tRect(mEquipBox[i].posX, mEquipBox[i].posY, + BOX_WIDTH, BOX_HEIGHT); - if (tRect.isPointInRect(x, y) && item) - setSelected(i); + if (tRect.isPointInRect(x, y) && item) + { + setSelected(i); + break; } } - else if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) + + if (mouseEvent.getButton() == gcn::MouseEvent::RIGHT) { - if (Item *item = getItem(x, y)) + if (item) { /* Convert relative to the window coordinates to absolute screen * coordinates. */ const int mx = x + getX(); const int my = y + getY(); - viewport->showPopup(this, mx, my, item, true); + viewport->showPopup(this, mx, my, item, true, false); } } } |