diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-07-03 00:27:27 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-07-03 00:52:12 +0300 |
commit | 9e4161f7324331498630fb25e72ff6d08c2db76f (patch) | |
tree | f903c8ba7c4d8c42e1327a673a9e42cafb5c42af /src/dragdrop.h | |
parent | 1cafda1147c06a647e3d3f1e3f986d7296ccbd08 (diff) | |
download | mv-9e4161f7324331498630fb25e72ff6d08c2db76f.tar.gz mv-9e4161f7324331498630fb25e72ff6d08c2db76f.tar.bz2 mv-9e4161f7324331498630fb25e72ff6d08c2db76f.tar.xz mv-9e4161f7324331498630fb25e72ff6d08c2db76f.zip |
add support for drag skill from skills window.
Diffstat (limited to 'src/dragdrop.h')
-rw-r--r-- | src/dragdrop.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/dragdrop.h b/src/dragdrop.h index 845420968..2405b151e 100644 --- a/src/dragdrop.h +++ b/src/dragdrop.h @@ -24,6 +24,8 @@ #include "item.h" #include "textcommand.h" +#include "gui/widgets/skillinfo.h" + #include "resources/image.h" #include "localconsts.h" @@ -37,6 +39,7 @@ enum DragDropSource DRAGDROP_SOURCE_TRADE, DRAGDROP_SOURCE_OUTFIT, DRAGDROP_SOURCE_SPELLS, + DRAGDROP_SOURCE_SKILLS, DRAGDROP_SOURCE_GROUND, DRAGDROP_SOURCE_DROP, DRAGDROP_SOURCE_SHORTCUTS, @@ -127,7 +130,7 @@ class DragDrop } else if (mText.empty()) { - mSource = DRAGDROP_SOURCE_EMPTY; + mSource = source; mTag = 0; return; } @@ -141,6 +144,33 @@ class DragDrop mTag = tag; } + void dragSkill(const SkillInfo *const info, + const DragDropSource source, + const int tag = 0) + { + if (mItemImage) + mItemImage->decRef(); + mItem = 0; + mItemColor = 1; + mText.clear(); + mItemImage = nullptr; + mSource = DRAGDROP_SOURCE_EMPTY; + mTag = 0; + if (info) + { + const SkillData *const data = info->data; + if (data) + { + mText = data->name; + mItemImage = data->icon; + if (mItemImage) + mItemImage->incRef(); + mSource = source; + mTag = tag; + } + } + } + void clear() { if (mItemImage) |