diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-06 14:49:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-06 14:49:47 +0300 |
commit | c649cf883480071c9b93909c4ea4ee5ec98155b2 (patch) | |
tree | 71022fd2db59c643c19c78c5524ffcd038e35a7f /src/gui/widgets/shortcutcontainer.cpp | |
parent | 4cab6fc78e19799f223d951d5ccc9afb303b65f2 (diff) | |
download | manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.gz manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.bz2 manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.tar.xz manaverse-c649cf883480071c9b93909c4ea4ee5ec98155b2.zip |
Remove some duplicate code.
Diffstat (limited to 'src/gui/widgets/shortcutcontainer.cpp')
-rw-r--r-- | src/gui/widgets/shortcutcontainer.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index e789c863d..313e37262 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -23,9 +23,12 @@ #include "gui/widgets/shortcutcontainer.h" #include "graphicsvertexes.h" +#include "settings.h" #include "gui/gui.h" +#include "resources/image.h" + #include "utils/delete2.h" #include "debug.h" @@ -45,10 +48,37 @@ ShortcutContainer::ShortcutContainer(Widget2 *const widget) : mVertexes(new ImageCollection) { mAllowLogic = false; + + addMouseListener(this); + addWidgetListener(this); + + mForegroundColor = getThemeColor(Theme::TEXT); + mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); + + mBackgroundImg = Theme::getImageFromThemeXml( + "item_shortcut_background.xml", "background.xml"); + + if (mBackgroundImg) + { + mBackgroundImg->setAlpha(settings.guiAlpha); + mBoxHeight = mBackgroundImg->getHeight(); + mBoxWidth = mBackgroundImg->getWidth(); + } + else + { + mBoxHeight = 1; + mBoxWidth = 1; + } } ShortcutContainer::~ShortcutContainer() { + if (mBackgroundImg) + { + mBackgroundImg->decRef(); + mBackgroundImg = nullptr; + } + if (gui) gui->removeDragged(this); |