From 4c7a11b639ec94c8a32a9a52e99652c464745037 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Oct 2012 02:07:55 +0300 Subject: Add palette inheritance to other shortcutcontainer classes. --- src/gui/widgets/dropshortcutcontainer.cpp | 7 +++++++ src/gui/widgets/dropshortcutcontainer.h | 2 ++ src/gui/widgets/emoteshortcutcontainer.cpp | 6 ++++++ src/gui/widgets/emoteshortcutcontainer.h | 2 ++ src/gui/widgets/itemshortcutcontainer.cpp | 8 ++++++++ src/gui/widgets/itemshortcutcontainer.h | 2 ++ src/gui/widgets/spellshortcutcontainer.cpp | 6 ++++++ src/gui/widgets/spellshortcutcontainer.h | 2 ++ src/gui/widgets/widget2.h | 4 ++-- 9 files changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index 8fde755c1..732b94454 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -81,6 +81,13 @@ DropShortcutContainer::~DropShortcutContainer() mItemPopup = nullptr; } +void DropShortcutContainer::setWidget2(const Widget2 *const widget) +{ + Widget2::setWidget2(widget); + mEquipedColor = getThemeColor(Theme::ITEM_EQUIPPED); + mUnEquipedColor = getThemeColor(Theme::ITEM_NOT_EQUIPPED); +} + void DropShortcutContainer::draw(gcn::Graphics *graphics) { if (!dropShortcut) diff --git a/src/gui/widgets/dropshortcutcontainer.h b/src/gui/widgets/dropshortcutcontainer.h index 74f76fdaa..6d3c18674 100644 --- a/src/gui/widgets/dropshortcutcontainer.h +++ b/src/gui/widgets/dropshortcutcontainer.h @@ -77,6 +77,8 @@ class DropShortcutContainer final : public ShortcutContainer void mouseMoved(gcn::MouseEvent &event) override; + void setWidget2(const Widget2 *const widget); + private: bool mItemClicked; Item *mItemMoved; diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index a2a6b5f22..87719b775 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -95,6 +95,12 @@ EmoteShortcutContainer::~EmoteShortcutContainer() } } +void EmoteShortcutContainer::setWidget2(const Widget2 *const widget) +{ + Widget2::setWidget2(widget); + mForegroundColor = getThemeColor(Theme::TEXT); +} + void EmoteShortcutContainer::draw(gcn::Graphics *graphics) { if (!emoteShortcut) diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 05fa737a4..db4bcd138 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -78,6 +78,8 @@ class EmoteShortcutContainer final : public ShortcutContainer void widgetHidden(const gcn::Event &event) override; + void setWidget2(const Widget2 *const widget); + private: std::vector mEmoteImg; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 9a53b5b17..041a9e8dc 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -92,6 +92,14 @@ ItemShortcutContainer::~ItemShortcutContainer() mSpellPopup = nullptr; } +void ItemShortcutContainer::setWidget2(const Widget2 *const widget) +{ + Widget2::setWidget2(widget); + mEquipedColor = getThemeColor(Theme::ITEM_EQUIPPED); + mUnEquipedColor = getThemeColor(Theme::ITEM_NOT_EQUIPPED); + mForegroundColor = getThemeColor(Theme::TEXT); +} + void ItemShortcutContainer::draw(gcn::Graphics *graphics) { const ItemShortcut *const selShortcut = itemShortcut[mNumber]; diff --git a/src/gui/widgets/itemshortcutcontainer.h b/src/gui/widgets/itemshortcutcontainer.h index 18a5c020f..001ddf05e 100644 --- a/src/gui/widgets/itemshortcutcontainer.h +++ b/src/gui/widgets/itemshortcutcontainer.h @@ -78,6 +78,8 @@ class ItemShortcutContainer final : public ShortcutContainer void mouseMoved(gcn::MouseEvent &event) override; + void setWidget2(const Widget2 *const widget); + private: bool mItemClicked; Item *mItemMoved; diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 22ed8d6b5..061e12b73 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -84,6 +84,12 @@ SpellShortcutContainer::~SpellShortcutContainer() mSpellPopup = nullptr; } +void SpellShortcutContainer::setWidget2(const Widget2 *const widget) +{ + Widget2::setWidget2(widget); + mForegroundColor = getThemeColor(Theme::TEXT); +} + void SpellShortcutContainer::draw(gcn::Graphics *graphics) { if (!spellShortcut) diff --git a/src/gui/widgets/spellshortcutcontainer.h b/src/gui/widgets/spellshortcutcontainer.h index 6e0de1c6a..ee95dbd3d 100644 --- a/src/gui/widgets/spellshortcutcontainer.h +++ b/src/gui/widgets/spellshortcutcontainer.h @@ -77,6 +77,8 @@ class SpellShortcutContainer final : public ShortcutContainer void mouseMoved(gcn::MouseEvent &event) override; + void setWidget2(const Widget2 *const widget); + private: bool mSpellClicked; TextCommand *mSpellMoved; diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h index 02107b3c1..9911d48f6 100644 --- a/src/gui/widgets/widget2.h +++ b/src/gui/widgets/widget2.h @@ -36,7 +36,7 @@ class Widget2 { } - ~Widget2() + virtual ~Widget2() { } @@ -56,7 +56,7 @@ class Widget2 return Palette::BLACK; } - void setWidget2(const Widget2 *const widget) + virtual void setWidget2(const Widget2 *const widget) { mPalette = widget ? widget->mPalette : 1; } -- cgit v1.2.3-70-g09d2