From 26c97eda5cb85b253706d49afff55580ace9e5bf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 14:24:14 +0300 Subject: Use public text popup in emoteshortcutcontainer. --- src/gui/widgets/emoteshortcutcontainer.cpp | 18 +++++++----------- src/gui/widgets/emoteshortcutcontainer.h | 1 - 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 1e438f119..a1fee31a2 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -48,12 +48,9 @@ static const int MAX_ITEMS = 48; EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : ShortcutContainer(widget), mEmoteImg(), - mEmotePopup(new TextPopup), mEmoteClicked(false), mEmoteMoved(0) { - mEmotePopup->postInit(); - if (mBackgroundImg) mBackgroundImg->setAlpha(settings.guiAlpha); @@ -70,7 +67,6 @@ EmoteShortcutContainer::EmoteShortcutContainer(Widget2 *const widget) : EmoteShortcutContainer::~EmoteShortcutContainer() { - delete2(mEmotePopup); } void EmoteShortcutContainer::setWidget2(const Widget2 *const widget) @@ -190,7 +186,7 @@ void EmoteShortcutContainer::mouseReleased(MouseEvent &event) void EmoteShortcutContainer::mouseMoved(MouseEvent &event) { - if (!emoteShortcut || !mEmotePopup) + if (!emoteShortcut || !textPopup) return; const int index = getIndexFromGrid(event.getX(), event.getY()); @@ -198,24 +194,24 @@ void EmoteShortcutContainer::mouseMoved(MouseEvent &event) if (index == -1) return; - mEmotePopup->setVisible(false); + textPopup->setVisible(false); if (static_cast(index) < mEmoteImg.size() && mEmoteImg[index]) { const EmoteSprite *const sprite = mEmoteImg[index]; - mEmotePopup->show(viewport->getMouseX(), viewport->getMouseY(), + textPopup->show(viewport->getMouseX(), viewport->getMouseY(), strprintf("%s, %d", sprite->name.c_str(), sprite->id)); } } void EmoteShortcutContainer::mouseExited(MouseEvent &event A_UNUSED) { - if (mEmotePopup) - mEmotePopup->setVisible(false); + if (textPopup) + textPopup->setVisible(false); } void EmoteShortcutContainer::widgetHidden(const Event &event A_UNUSED) { - if (mEmotePopup) - mEmotePopup->setVisible(false); + if (textPopup) + textPopup->setVisible(false); } diff --git a/src/gui/widgets/emoteshortcutcontainer.h b/src/gui/widgets/emoteshortcutcontainer.h index 017929545..8a2ea498e 100644 --- a/src/gui/widgets/emoteshortcutcontainer.h +++ b/src/gui/widgets/emoteshortcutcontainer.h @@ -81,7 +81,6 @@ class EmoteShortcutContainer final : public ShortcutContainer private: std::vector mEmoteImg; - TextPopup *mEmotePopup; bool mEmoteClicked; unsigned char mEmoteMoved; }; -- cgit v1.2.3-70-g09d2