From 9e4161f7324331498630fb25e72ff6d08c2db76f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 3 Jul 2013 00:27:27 +0300 Subject: add support for drag skill from skills window. --- src/dragdrop.h | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/dragdrop.h') 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) -- cgit v1.2.3-60-g2f50