From 28072bc9da91582e5a0caec64fba880f51e5d639 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 15:49:46 +0300 Subject: Use public item popup in equipmentwindow. --- src/gui/windows/equipmentwindow.cpp | 23 ++++++++++------------- src/gui/windows/equipmentwindow.h | 1 - 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 5600de741..a3f3d103f 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -63,7 +63,6 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, Window(_("Equipment"), false, nullptr, "equipment.xml"), ActionListener(), mEquipment(equipment), - mItemPopup(new ItemPopup), mPlayerBox(new PlayerBox(this, "equipment_playerbox.xml", "equipment_selectedplayerbox.xml")), @@ -89,7 +88,6 @@ EquipmentWindow::EquipmentWindow(Equipment *const equipment, mMaxY(0), mForing(foring) { - mItemPopup->postInit(); if (setupWindow) setupWindow->registerWindowForReset(this); @@ -137,7 +135,6 @@ void EquipmentWindow::postInit() EquipmentWindow::~EquipmentWindow() { - delete2(mItemPopup); if (this == beingEquipmentWindow) { if (mEquipment) @@ -349,8 +346,8 @@ void EquipmentWindow::mousePressed(MouseEvent& event) { if (Item *const item = getItem(x, y)) { - if (mItemPopup) - mItemPopup->setVisible(false); + if (itemPopup) + itemPopup->setVisible(false); /* Convert relative to the window coordinates to absolute screen * coordinates. @@ -430,7 +427,7 @@ void EquipmentWindow::mouseMoved(MouseEvent &event) { Window::mouseMoved(event); - if (!mItemPopup) + if (!itemPopup) return; const int x = event.getX(); @@ -440,20 +437,20 @@ void EquipmentWindow::mouseMoved(MouseEvent &event) if (item) { - mItemPopup->setItem(item); - mItemPopup->position(x + getX(), y + getY()); + itemPopup->setItem(item); + itemPopup->position(x + getX(), y + getY()); } else { - mItemPopup->setVisible(false); + itemPopup->setVisible(false); } } // Hide ItemTooltip void EquipmentWindow::mouseExited(MouseEvent &event A_UNUSED) { - if (mItemPopup) - mItemPopup->setVisible(false); + if (itemPopup) + itemPopup->setVisible(false); } void EquipmentWindow::setSelected(const int index) @@ -462,8 +459,8 @@ void EquipmentWindow::setSelected(const int index) mRedraw = true; if (mUnequip) mUnequip->setEnabled(mSelected != -1); - if (mItemPopup) - mItemPopup->setVisible(false); + if (itemPopup) + itemPopup->setVisible(false); } void EquipmentWindow::setBeing(Being *const being) diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index 1f9dbcbcd..b90c39d81 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -116,7 +116,6 @@ class EquipmentWindow final : public Window, Equipment *mEquipment; - ItemPopup *mItemPopup; PlayerBox *mPlayerBox; Button *mUnequip; -- cgit v1.2.3-70-g09d2