summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-05-22 23:29:25 +0300
committerAndrei Karas <akaras@inbox.ru>2018-05-22 23:29:25 +0300
commitf1dfe88c7a0c30de14439277c4ba7d69bd495fbf (patch)
tree2bfa5831dc055db21b21930b162dd39e6921e86f /src
parent6dff7bd4ebf3c1718ac18f756c5f65acbd83ebe9 (diff)
downloadplus-f1dfe88c7a0c30de14439277c4ba7d69bd495fbf.tar.gz
plus-f1dfe88c7a0c30de14439277c4ba7d69bd495fbf.tar.bz2
plus-f1dfe88c7a0c30de14439277c4ba7d69bd495fbf.tar.xz
plus-f1dfe88c7a0c30de14439277c4ba7d69bd495fbf.zip
Set skin object in shortcut containers for future usage.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.cpp6
-rw-r--r--src/gui/widgets/emoteshortcutcontainer.h4
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/itemshortcutcontainer.h3
-rw-r--r--src/gui/widgets/shortcutcontainer.cpp8
-rw-r--r--src/gui/widgets/shortcutcontainer.h5
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/spellshortcutcontainer.h3
-rw-r--r--src/gui/widgets/virtshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/virtshortcutcontainer.h3
-rw-r--r--src/gui/windows/shortcutwindow.cpp4
11 files changed, 35 insertions, 16 deletions
diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp
index 6b9cc5396..caa9150c1 100644
--- a/src/gui/widgets/emoteshortcutcontainer.cpp
+++ b/src/gui/widgets/emoteshortcutcontainer.cpp
@@ -75,10 +75,10 @@ EmoteShortcutContainer::~EmoteShortcutContainer()
{
}
-void EmoteShortcutContainer::setWidget2(const Widget2 *restrict const widget)
- restrict2
+void EmoteShortcutContainer::setSkin(const Widget2 *const widget,
+ Skin *const skin)
{
- Widget2::setWidget2(widget);
+ ShortcutContainer::setSkin(widget, skin);
mForegroundColor = getThemeColor(ThemeColorId::TEXT, 255U);
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE, 255U);
}
diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h
index 2665bfebc..cfc18e7e6 100644
--- a/src/gui/widgets/emoteshortcutcontainer.h
+++ b/src/gui/widgets/emoteshortcutcontainer.h
@@ -79,8 +79,8 @@ class EmoteShortcutContainer final : public ShortcutContainer
void widgetHidden(const Event &restrict event)
restrict2 override final;
- void setWidget2(const Widget2 *restrict const widget)
- restrict2 override final;
+ void setSkin(const Widget2 *const widget,
+ Skin *const skin) override final;
private:
STD_VECTOR<const EmoteSprite*> mEmoteImg;
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 9b83e7863..81ccf4ab5 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -71,9 +71,10 @@ ItemShortcutContainer::~ItemShortcutContainer()
{
}
-void ItemShortcutContainer::setWidget2(const Widget2 *const widget)
+void ItemShortcutContainer::setSkin(const Widget2 *const widget,
+ Skin *const skin)
{
- Widget2::setWidget2(widget);
+ ShortcutContainer::setSkin(widget, skin);
mEquipedColor = getThemeColor(ThemeColorId::ITEM_EQUIPPED, 255U);
mEquipedColor2 = getThemeColor(ThemeColorId::ITEM_EQUIPPED_OUTLINE, 255U);
mUnEquipedColor = getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED, 255U);
diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h
index 9bcef6508..73f599add 100644
--- a/src/gui/widgets/itemshortcutcontainer.h
+++ b/src/gui/widgets/itemshortcutcontainer.h
@@ -74,7 +74,8 @@ class ItemShortcutContainer final : public ShortcutContainer
void mouseMoved(MouseEvent &event) override final;
- void setWidget2(const Widget2 *const widget) override final;
+ void setSkin(const Widget2 *const widget,
+ Skin *const skin) override final;
private:
bool mItemClicked;
diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp
index d4321440f..f1e9c8a18 100644
--- a/src/gui/widgets/shortcutcontainer.cpp
+++ b/src/gui/widgets/shortcutcontainer.cpp
@@ -43,6 +43,7 @@ ShortcutContainer::ShortcutContainer(Widget2 *const widget) :
WidgetListener(),
MouseListener(),
mBackgroundImg(nullptr),
+ mSkin(nullptr),
mMaxItems(0),
mBoxWidth(1),
mBoxHeight(1),
@@ -157,3 +158,10 @@ void ShortcutContainer::widgetMoved(const Event& event A_UNUSED)
{
mRedraw = true;
}
+
+void ShortcutContainer::setSkin(const Widget2 *const widget,
+ Skin *const skin)
+{
+ setWidget2(widget);
+ mSkin = skin;
+}
diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h
index 2b3646755..fd64827ea 100644
--- a/src/gui/widgets/shortcutcontainer.h
+++ b/src/gui/widgets/shortcutcontainer.h
@@ -30,6 +30,7 @@
class Image;
class ImageCollection;
+class Skin;
/**
* A generic shortcut container.
@@ -90,6 +91,9 @@ class ShortcutContainer notfinal : public Widget,
void safeDrawBackground(Graphics *const g) A_NONNULL(2);
+ virtual void setSkin(const Widget2 *const widget,
+ Skin *const skin);
+
protected:
/**
* Constructor. Initializes the shortcut container.
@@ -107,6 +111,7 @@ class ShortcutContainer notfinal : public Widget,
const int pointY) const A_WARN_UNUSED;
Image *mBackgroundImg;
+ Skin *mSkin;
static float mAlpha;
unsigned mMaxItems;
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index e00c3bffd..4d53e8190 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -56,9 +56,10 @@ SpellShortcutContainer::~SpellShortcutContainer()
{
}
-void SpellShortcutContainer::setWidget2(const Widget2 *const widget)
+void SpellShortcutContainer::setSkin(const Widget2 *const widget,
+ Skin *const skin)
{
- Widget2::setWidget2(widget);
+ ShortcutContainer::setSkin(widget, skin);
mForegroundColor = getThemeColor(ThemeColorId::TEXT, 255U);
mForegroundColor2 = getThemeColor(ThemeColorId::TEXT_OUTLINE, 255U);
}
diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h
index d1f9d92a5..925c294f6 100644
--- a/src/gui/widgets/spellshortcutcontainer.h
+++ b/src/gui/widgets/spellshortcutcontainer.h
@@ -74,7 +74,8 @@ class SpellShortcutContainer final : public ShortcutContainer
void mouseMoved(MouseEvent &event) override final;
- void setWidget2(const Widget2 *const widget) override final;
+ void setSkin(const Widget2 *const widget,
+ Skin *const skin) override final;
int getItemByIndex(const int index) const A_WARN_UNUSED;
diff --git a/src/gui/widgets/virtshortcutcontainer.cpp b/src/gui/widgets/virtshortcutcontainer.cpp
index d0400980f..cac320d54 100644
--- a/src/gui/widgets/virtshortcutcontainer.cpp
+++ b/src/gui/widgets/virtshortcutcontainer.cpp
@@ -63,9 +63,10 @@ VirtShortcutContainer::~VirtShortcutContainer()
{
}
-void VirtShortcutContainer::setWidget2(const Widget2 *const widget)
+void VirtShortcutContainer::setSkin(const Widget2 *const widget,
+ Skin *const skin)
{
- Widget2::setWidget2(widget);
+ ShortcutContainer::setSkin(widget, skin);
mEquipedColor = getThemeColor(ThemeColorId::ITEM_EQUIPPED, 255U);
mEquipedColor2 = getThemeColor(ThemeColorId::ITEM_EQUIPPED_OUTLINE, 255U);
mUnEquipedColor = getThemeColor(ThemeColorId::ITEM_NOT_EQUIPPED, 255U);
diff --git a/src/gui/widgets/virtshortcutcontainer.h b/src/gui/widgets/virtshortcutcontainer.h
index 821211b02..2a849ce26 100644
--- a/src/gui/widgets/virtshortcutcontainer.h
+++ b/src/gui/widgets/virtshortcutcontainer.h
@@ -76,7 +76,8 @@ class VirtShortcutContainer final : public ShortcutContainer
void mouseMoved(MouseEvent &event) override final;
- void setWidget2(const Widget2 *const widget) override final;
+ void setSkin(const Widget2 *const widget,
+ Skin *const skin) override final;
private:
bool mItemClicked;
diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp
index 1b53ad455..6d431c37c 100644
--- a/src/gui/windows/shortcutwindow.cpp
+++ b/src/gui/windows/shortcutwindow.cpp
@@ -72,7 +72,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title,
mDragOffsetY = 0;
if (content != nullptr)
- content->setWidget2(this);
+ content->setSkin(this, mSkin);
if (setupWindow != nullptr)
setupWindow->registerWindowForReset(this);
@@ -181,7 +181,7 @@ void ShortcutWindow::addTab(const std::string &name,
std::string());
scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING);
scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER);
- content->setWidget2(this);
+ content->setSkin(this, mSkin);
Tab *const tab = new ShortcutTab(this, name, content);
mTabs->addTab(tab, scroll);
mPages.push_back(content);