summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp13
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp5
-rw-r--r--src/gui/widgets/itemshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/popup.cpp11
-rw-r--r--src/gui/widgets/shoplistbox.cpp4
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp5
-rw-r--r--src/gui/widgets/textfield.cpp23
-rw-r--r--src/gui/widgets/window.cpp12
9 files changed, 41 insertions, 42 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 80bcba94c..6369efce8 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -28,6 +28,7 @@
#include "being/localplayer.h"
#include "gui/gui.h"
+#include "gui/popupmanager.h"
#include "gui/skin.h"
#include "gui/viewport.h"
@@ -335,7 +336,7 @@ void AvatarListBox::draw(Graphics *graphics)
void AvatarListBox::mousePressed(MouseEvent &event)
{
- if (!actorManager || !localPlayer || !viewport
+ if (!actorManager || !localPlayer || !popupManager
|| !getFont()->getHeight())
{
return;
@@ -385,9 +386,9 @@ void AvatarListBox::mousePressed(MouseEvent &event)
const Being *const being = actorManager->findBeingByName(
avatar->getName(), ActorType::PLAYER);
if (being)
- viewport->showPopup(being);
+ popupManager->showPopup(being);
else
- viewport->showPlayerPopup(avatar->getName());
+ popupManager->showPlayerPopup(avatar->getName());
}
break;
}
@@ -401,7 +402,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
else
name = model->getAvatarAt(selected)->getName();
- viewport->showAttackMonsterPopup(name,
+ popupManager->showAttackMonsterPopup(name,
model->getAvatarAt(selected)->getType());
break;
}
@@ -414,7 +415,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
else
name = model->getAvatarAt(selected)->getName();
- viewport->showPickupItemPopup(name);
+ popupManager->showPickupItemPopup(name);
break;
}
default:
@@ -425,7 +426,7 @@ void AvatarListBox::mousePressed(MouseEvent &event)
{
MapItem *const mapItem = map->findPortalXY(
ava->getX(), ava->getY());
- viewport->showPopup(mapItem);
+ popupManager->showPopup(mapItem);
}
break;
}
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index f1434aa23..5ec847922 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -28,6 +28,7 @@
#include "being/playerinfo.h"
+#include "gui/popupmanager.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -214,8 +215,8 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
Item *const item = inv->findItem(dropShortcut->getItem(index),
dropShortcut->getItemColor(index));
- if (viewport)
- viewport->showDropPopup(item);
+ if (popupManager)
+ popupManager->showDropPopup(item);
}
}
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index 50e99a24c..e8976da67 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -22,6 +22,7 @@
#include "gui/widgets/itemlinkhandler.h"
+#include "gui/popupmanager.h"
#include "gui/viewport.h"
#include "gui/popups/itempopup.h"
@@ -78,8 +79,8 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
}
else if (button == MouseButton::RIGHT)
{
- if (viewport)
- viewport->showLinkPopup(url);
+ if (popupManager)
+ popupManager->showLinkPopup(url);
}
}
else if (!link.empty() && link[0] == '?')
diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp
index 51a1cef13..2d8deeba9 100644
--- a/src/gui/widgets/itemshortcutcontainer.cpp
+++ b/src/gui/widgets/itemshortcutcontainer.cpp
@@ -33,6 +33,7 @@
#include "input/inputmanager.h"
+#include "gui/popupmanager.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -333,9 +334,9 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event)
else if (event.getButton() == MouseButton::RIGHT)
{
event.consume();
- if (viewport && selShortcut)
+ if (popupManager && selShortcut)
{
- viewport->showItemPopup(selShortcut->getItem(index),
+ popupManager->showItemPopup(selShortcut->getItem(index),
selShortcut->getItemColor(index));
}
}
diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp
index 506b0f050..96faf19c4 100644
--- a/src/gui/widgets/popup.cpp
+++ b/src/gui/widgets/popup.cpp
@@ -25,8 +25,10 @@
#include "graphicsvertexes.h"
+#include "gui/popupmanager.h"
#include "gui/skin.h"
-#include "gui/viewport.h"
+
+#include "gui/widgets/windowcontainer.h"
#include "utils/delete2.h"
@@ -229,8 +231,11 @@ void Popup::position(const int x, const int y)
void Popup::mouseMoved(MouseEvent &event A_UNUSED)
{
- if (viewport)
- viewport->hideBeingPopup();
+ if (popupManager)
+ {
+ popupManager->hideBeingPopup();
+ popupManager->hideTextPopup();
+ }
mRedraw = true;
}
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index 4c7242866..019fd3e63 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -27,6 +27,7 @@
#include "being/playerinfo.h"
+#include "gui/popupmanager.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -233,7 +234,8 @@ void ShopListBox::mouseReleased(MouseEvent& event)
return;
Item *const item = mShopItems->at(mSelected);
- viewport->showItemPopup(item);
+ if (popupManager)
+ popupManager->showItemPopup(item);
}
}
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 419b63181..33579b5a9 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -27,6 +27,7 @@
#include "settings.h"
#include "spellshortcut.h"
+#include "gui/popupmanager.h"
#include "gui/viewport.h"
#include "gui/fonts/font.h"
@@ -259,8 +260,8 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
if (itemId >= 0)
spell = spellManager->getSpell(itemId);
- if (spell && viewport)
- viewport->showSpellPopup(spell);
+ if (spell && popupManager)
+ popupManager->showSpellPopup(spell);
}
}
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index fb1bcc1db..cdfbac68a 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -70,8 +70,8 @@
#include "input/inputmanager.h"
#include "gui/gui.h"
+#include "gui/popupmanager.h"
#include "gui/skin.h"
-#include "gui/viewport.h"
#ifdef ANDROID
#include "gui/windowmanager.h"
#endif
@@ -709,25 +709,8 @@ void TextField::mousePressed(MouseEvent &event)
event.consume();
if (event.getButton() == MouseButton::RIGHT)
{
- if (viewport)
- {
- viewport->showTextFieldPopup(this);
- }
- else
- {
- if (!mPopupMenu)
- {
- mPopupMenu = new PopupMenu();
- mPopupMenu->postInit();
- }
- if (gui)
- {
- int x = 0;
- int y = 0;
- Gui::getMouseState(&x, &y);
- mPopupMenu->showTextFieldPopup(x, y, this);
- }
- }
+ if (popupManager)
+ popupManager->showTextFieldPopup(this);
}
else if (event.getButton() == MouseButton::LEFT)
{
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index f2f7c1dd1..a4fb2d57f 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -74,6 +74,7 @@
#include "gui/focushandler.h"
#include "gui/gui.h"
+#include "gui/popupmanager.h"
#include "gui/skin.h"
#include "gui/viewport.h"
@@ -763,10 +764,10 @@ void Window::mousePressed(MouseEvent &event)
}
else if (button == MouseButton::RIGHT)
{
- if (viewport)
+ if (popupManager)
{
event.consume();
- viewport->showWindowPopup(this);
+ popupManager->showWindowPopup(this);
}
}
}
@@ -837,8 +838,11 @@ void Window::updateResizeHandler(MouseEvent &event)
void Window::mouseMoved(MouseEvent &event)
{
updateResizeHandler(event);
- if (viewport)
- viewport->hideBeingPopup();
+ if (popupManager)
+ {
+ popupManager->hideBeingPopup();
+ popupManager->hideTextPopup();
+ }
}
bool Window::canMove() const