summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-06-01 14:20:24 +0300
committerAndrei Karas <akaras@inbox.ru>2013-06-01 14:24:08 +0300
commit69108c8a2892cf87a3d425b5e82e0eadbb5f7fa9 (patch)
treea9c8835f20ef4f118181f97166bc7a52a1e48314
parentc65c2a8130c7748a2b8eee03ff716bd9db699d79 (diff)
downloadmanaplus-69108c8a2892cf87a3d425b5e82e0eadbb5f7fa9.tar.gz
manaplus-69108c8a2892cf87a3d425b5e82e0eadbb5f7fa9.tar.bz2
manaplus-69108c8a2892cf87a3d425b5e82e0eadbb5f7fa9.tar.xz
manaplus-69108c8a2892cf87a3d425b5e82e0eadbb5f7fa9.zip
clear drag selection if selected item removed.
-rw-r--r--src/dragdrop.h8
-rw-r--r--src/item.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/src/dragdrop.h b/src/dragdrop.h
index 5630f9248..a2c94facf 100644
--- a/src/dragdrop.h
+++ b/src/dragdrop.h
@@ -80,6 +80,14 @@ class DragDrop
Item *getSelected()
{ return mSelItem; }
+ void clearItem(const Item *const item)
+ {
+ if (mItem == item)
+ clear();
+ if (mSelItem == item)
+ mSelItem = nullptr;
+ }
+
private:
Item *mItem;
Item *mSelItem;
diff --git a/src/item.cpp b/src/item.cpp
index 90ca9ea35..f686f5cf6 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -68,6 +68,7 @@ Item::~Item()
mDrawImage->decRef();
mDrawImage = nullptr;
}
+ dragDrop.clearItem(this);
}
void Item::setId(const int id, const unsigned char color)