diff options
author | Angelo Castellani <udp.castellani@gmail.com> | 2011-05-22 19:07:41 -0400 |
---|---|---|
committer | Stefan Dombrowski <stefan@uni-bonn.de> | 2011-05-25 19:34:25 +0200 |
commit | b02081c00450d274c23b7198620ee7748756bd72 (patch) | |
tree | aadc24f7ce866f916fb24b940eaf1f1db8ea8e88 /src/gui/inventorywindow.cpp | |
parent | 6d9936d160b197fe68c5bb21972b197fb1b64ba4 (diff) | |
download | mana-b02081c00450d274c23b7198620ee7748756bd72.tar.gz mana-b02081c00450d274c23b7198620ee7748756bd72.tar.bz2 mana-b02081c00450d274c23b7198620ee7748756bd72.tar.xz mana-b02081c00450d274c23b7198620ee7748756bd72.zip |
Added more double clickable actions
- double clicking a do_choice item submits it
- double clicking the npc chat will hit 'next'
- double click to buy/sell a single item
- clicking on no item in the inventory now deselects
- double click to use/activate items in inventory
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r-- | src/gui/inventorywindow.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 6a897700..54215ffc 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -21,6 +21,7 @@ #include "gui/inventorywindow.h" +#include "client.h" #include "inventory.h" #include "item.h" #include "units.h" @@ -240,10 +241,17 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) { Window::mouseClicked(event); - if (event.getButton() == gcn::MouseEvent::RIGHT) + Item *item = mItems->getSelectedItem(); + + if (event.getSource() == mItems && item && isDoubleClick((int)item)) { - Item *item = mItems->getSelectedItem(); + if (isMainInventory() && item->getInfo().getActivatable()) + action(gcn::ActionEvent(mUseButton, mUseButton->getActionEventId())); + } + + if (event.getButton() == gcn::MouseEvent::RIGHT) + { if (!item) return; |