summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-06-17 23:07:29 +0300
committerAndrei Karas <akaras@inbox.ru>2012-06-17 23:07:29 +0300
commit1ec82e44a0ec44a3d342a68b42b318e4413410dc (patch)
treef3010c20fd90440c81921c612267d8a58e4f1ee3 /src/gui/widgets/itemcontainer.cpp
parent1f66ae673801e76f3574944628a7980b9bfbabda (diff)
downloadManaVerse-1ec82e44a0ec44a3d342a68b42b318e4413410dc.tar.gz
ManaVerse-1ec82e44a0ec44a3d342a68b42b318e4413410dc.tar.bz2
ManaVerse-1ec82e44a0ec44a3d342a68b42b318e4413410dc.tar.xz
ManaVerse-1ec82e44a0ec44a3d342a68b42b318e4413410dc.zip
Fix double click support in gui class.
Add double click support to inventory and storage windows.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 5994b1e1a..3f3bbe937 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -30,6 +30,7 @@
#include "logger.h"
#include "gui/chatwindow.h"
+#include "gui/gui.h"
#include "gui/itempopup.h"
#include "gui/outfitwindow.h"
#include "gui/palette.h"
@@ -167,6 +168,7 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity):
mSortType(0),
mItemPopup(new ItemPopup),
mShowMatrix(nullptr),
+ mClicks(1),
mEquipedColor(Theme::getThemeColor(Theme::ITEM_EQUIPPED)),
mUnEquipedColor(Theme::getThemeColor(Theme::ITEM_NOT_EQUIPPED))
{
@@ -347,6 +349,8 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
return;
const int button = event.getButton();
+ mClicks = event.getClickCount();
+
if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT)
{
const int index = getSlotIndex(event.getX(), event.getY());
@@ -359,7 +363,7 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
if (item && mDescItems && chatWindow)
chatWindow->addItemText(item->getInfo().getName());
- if (mSelectedIndex == index)
+ if (mSelectedIndex == index && mClicks != 2)
{
mSelectionStatus = SEL_DESELECTING;
}
@@ -400,6 +404,9 @@ void ItemContainer::mouseDragged(gcn::MouseEvent &event)
void ItemContainer::mouseReleased(gcn::MouseEvent &event)
{
+ if (mClicks == 2)
+ return;
+
switch (mSelectionStatus)
{
case SEL_SELECTING: