diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/dropshortcutcontainer.cpp | 22 | ||||
-rw-r--r-- | src/gui/widgets/emoteshortcutcontainer.cpp | 28 | ||||
-rw-r--r-- | src/gui/widgets/itemshortcutcontainer.cpp | 24 | ||||
-rw-r--r-- | src/gui/widgets/shortcutcontainer.cpp | 30 | ||||
-rw-r--r-- | src/gui/widgets/spellshortcutcontainer.cpp | 23 |
5 files changed, 32 insertions, 95 deletions
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 087f4b372..f1434aa23 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -54,36 +54,14 @@ DropShortcutContainer::DropShortcutContainer(Widget2 *const widget) : { mItemPopup->postInit(); - addMouseListener(this); - addWidgetListener(this); - - mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml", "background.xml"); if (dropShortcut) mMaxItems = dropShortcut->getItemCount(); else mMaxItems = 0; - - if (mBackgroundImg) - { - mBackgroundImg->setAlpha(settings.guiAlpha); - mBoxHeight = mBackgroundImg->getHeight(); - mBoxWidth = mBackgroundImg->getWidth(); - } - else - { - mBoxHeight = 1; - mBoxWidth = 1; - } } DropShortcutContainer::~DropShortcutContainer() { - if (mBackgroundImg) - { - mBackgroundImg->decRef(); - mBackgroundImg = nullptr; - } delete2(mItemPopup); } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 85e07e2b7..0d802034e 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -39,6 +39,7 @@ #include "resources/db/emotedb.h" #include "utils/stringutils.h" +#include "utils/delete2.h" #include "debug.h" @@ -53,13 +54,6 @@ EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : { mEmotePopup->postInit(); - addMouseListener(this); - addWidgetListener(this); - - mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); - mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml", "background.xml"); - if (mBackgroundImg) mBackgroundImg->setAlpha(settings.guiAlpha); @@ -72,29 +66,11 @@ EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : } mMaxItems = MAX_ITEMS; - - if (mBackgroundImg) - { - mBoxHeight = mBackgroundImg->getHeight(); - mBoxWidth = mBackgroundImg->getWidth(); - } - else - { - mBoxHeight = 1; - mBoxWidth = 1; - } - mForegroundColor = getThemeColor(Theme::TEXT); } EmoteShortcutContainer::~EmoteShortcutContainer() { - delete mEmotePopup; - - if (mBackgroundImg) - { - mBackgroundImg->decRef(); - mBackgroundImg = nullptr; - } + delete2(mEmotePopup); } void EmoteShortcutContainer::setWidget2(const Widget2 *const widget) diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 670807ed5..51a1cef13 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -68,38 +68,14 @@ ItemShortcutContainer::ItemShortcutContainer(Widget2 *const widget, mItemPopup->postInit(); mSpellPopup->postInit(); - addMouseListener(this); - addWidgetListener(this); - - mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); - mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml", "background.xml"); if (itemShortcut[mNumber]) mMaxItems = itemShortcut[mNumber]->getItemCount(); else mMaxItems = 0; - - if (mBackgroundImg) - { - mBackgroundImg->setAlpha(settings.guiAlpha); - mBoxHeight = mBackgroundImg->getHeight(); - mBoxWidth = mBackgroundImg->getWidth(); - } - else - { - mBoxHeight = 1; - mBoxWidth = 1; - } - mForegroundColor = getThemeColor(Theme::TEXT); } ItemShortcutContainer::~ItemShortcutContainer() { - if (mBackgroundImg) - { - mBackgroundImg->decRef(); - mBackgroundImg = nullptr; - } delete2(mItemPopup); delete2(mSpellPopup); } 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); diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 014fa4354..08e22ee98 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -50,37 +50,14 @@ SpellShortcutContainer::SpellShortcutContainer(Widget2 *const widget, { mSpellPopup->postInit(); - addMouseListener(this); - addWidgetListener(this); - - mForegroundColor2 = getThemeColor(Theme::TEXT_OUTLINE); - - mBackgroundImg = Theme::getImageFromThemeXml( - "item_shortcut_background.xml", "background.xml"); if (spellShortcut) mMaxItems = spellShortcut->getSpellsCount(); else mMaxItems = 0; - - if (mBackgroundImg) - { - mBackgroundImg->setAlpha(settings.guiAlpha); - mBoxHeight = mBackgroundImg->getHeight(); - mBoxWidth = mBackgroundImg->getWidth(); - } - else - { - mBoxHeight = 1; - mBoxWidth = 1; - } - mForegroundColor = getThemeColor(Theme::TEXT); } SpellShortcutContainer::~SpellShortcutContainer() { - if (mBackgroundImg) - mBackgroundImg->decRef(); - mBackgroundImg = nullptr; delete2(mSpellPopup); } |