summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-05-11 18:39:15 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-01 12:52:16 +0300
commitf45b10598c4a128510d7c469a6fe669587c01a3e (patch)
tree6a35598bcf52ee3e380890dbac3c2d013b83a2d2 /src/gui/widgets
parent9f85b059aff7c54043d85c3422f02be3570d5050 (diff)
downloadmv-f45b10598c4a128510d7c469a6fe669587c01a3e.tar.gz
mv-f45b10598c4a128510d7c469a6fe669587c01a3e.tar.bz2
mv-f45b10598c4a128510d7c469a6fe669587c01a3e.tar.xz
mv-f45b10598c4a128510d7c469a6fe669587c01a3e.zip
add dragdrop between inventory and outfits window.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/itemcontainer.cpp25
1 files changed, 9 insertions, 16 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index f65624eae..2246280fa 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -22,6 +22,7 @@
#include "gui/widgets/itemcontainer.h"
+#include "dragdrop.h"
#include "inventory.h"
#include "item.h"
#include "itemshortcut.h"
@@ -267,18 +268,8 @@ void ItemContainer::draw(gcn::Graphics *graphics)
{
if (mShowMatrix[itemIndex] == mSelectedIndex)
{
- if (mSelectionStatus == SEL_DRAGGING)
- {
- // Reposition the coords to that of the cursor.
- itemX = mDragPosX - (mBoxWidth / 2);
- itemY = mDragPosY - (mBoxHeight / 2);
- }
- else
- {
- // Draw selection border image.
- if (mSelImg)
- g->drawImage(mSelImg, itemX, itemY);
- }
+ if (mSelImg)
+ g->drawImage(mSelImg, itemX, itemY);
}
image->setAlpha(1.0f); // ensure the image if fully drawn...
g->drawImage(image, itemX + mPaddingItemX,
@@ -332,14 +323,16 @@ void ItemContainer::draw(gcn::Graphics *graphics)
void ItemContainer::selectNone()
{
+ dragDrop.clear();
+
setSelectedIndex(-1);
mSelectionStatus = SEL_NONE;
+/*
if (outfitWindow)
outfitWindow->setItemSelected(-1);
if (shopWindow)
shopWindow->setItemSelected(-1);
-// if (skillDialog)
-// skillDialog->setItemSelected(-1);
+*/
}
void ItemContainer::setSelectedIndex(const int newIndex)
@@ -407,10 +400,12 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
if (mSelectedIndex == index && mClicks != 2)
{
+ dragDrop.dragItem(item, DragDropSource::DRAGDROP_SOURCE_INVENTORY);
mSelectionStatus = SEL_DESELECTING;
}
else if (item && item->getId())
{
+ dragDrop.dragItem(item, DragDropSource::DRAGDROP_SOURCE_INVENTORY);
setSelectedIndex(index);
mSelectionStatus = SEL_SELECTING;
@@ -422,8 +417,6 @@ void ItemContainer::mousePressed(gcn::MouseEvent &event)
}
if (dropShortcut)
dropShortcut->setItemSelected(item);
- if (item->isEquipment() && outfitWindow)
- outfitWindow->setItemSelected(item);
if (shopWindow)
shopWindow->setItemSelected(item->getId());
}