From 5613e19f91676fddbdedb371a6fe07786268bb92 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 14:30:53 +0300 Subject: Use public text popup in characterdisplay. --- src/gui/widgets/characterdisplay.cpp | 16 ++++++---------- src/gui/widgets/characterdisplay.h | 1 - 2 files changed, 6 insertions(+), 11 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index b56d77f09..7429c9782 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -50,11 +50,8 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, WidgetListener(), mCharacter(nullptr), mPlayerBox(new PlayerBox(nullptr)), - mName(new Label(this, "wwwwwwwwwwwwwwwwwwwwwwww")), - mPopup(new TextPopup) + mName(new Label(this, "wwwwwwwwwwwwwwwwwwwwwwww")) { - mPopup->postInit(); - mPlayerBox->setActionEventId("select"); mPlayerBox->addActionListener(charSelectDialog); setActionEventId("use"); @@ -82,7 +79,6 @@ CharacterDisplay::CharacterDisplay(const Widget2 *const widget, CharacterDisplay::~CharacterDisplay() { - delete2(mPopup); } void CharacterDisplay::setCharacter(Net::Character *const character) @@ -117,17 +113,17 @@ void CharacterDisplay::update() void CharacterDisplay::widgetHidden(const Event &event A_UNUSED) { - mPopup->setVisible(false); + textPopup->setVisible(false); } void CharacterDisplay::mouseExited(MouseEvent &event A_UNUSED) { - mPopup->setVisible(false); + textPopup->setVisible(false); } void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) { - if (!gui) + if (!gui || !textPopup) return; int mouseX = 0; @@ -136,7 +132,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) const std::string &name = mName->getCaption(); if (!name.empty()) { - mPopup->show(mouseX, mouseY, name, strprintf(_("Level: %u"), + textPopup->show(mouseX, mouseY, name, strprintf(_("Level: %u"), static_cast( mCharacter->data.mAttributes[Attributes::LEVEL])), strprintf(_("Money: %s"), Units::formatCurrency( @@ -144,7 +140,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) } else { - mPopup->setVisible(false); + textPopup->setVisible(false); } } diff --git a/src/gui/widgets/characterdisplay.h b/src/gui/widgets/characterdisplay.h index 8f9acf462..47959e365 100644 --- a/src/gui/widgets/characterdisplay.h +++ b/src/gui/widgets/characterdisplay.h @@ -89,7 +89,6 @@ class CharacterDisplay final : public Container, Net::Character *mCharacter; PlayerBox *mPlayerBox; Label *mName; - TextPopup *mPopup; }; #endif // GUI_WIDGETS_CHARACTERDISPLAY_H -- cgit v1.2.3-70-g09d2