From 2cb9f5c3d47077a459fabf15800b1c45cfdacb3a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 17 Aug 2014 13:40:14 +0300 Subject: Remove proxy methods used for access popup menu. --- src/gui/widgets/avatarlistbox.cpp | 26 +++++++++++++++++++++----- src/gui/widgets/dropshortcutcontainer.cpp | 9 +++++++-- src/gui/widgets/itemlinkhandler.cpp | 9 +++++++-- src/gui/widgets/itemshortcutcontainer.cpp | 7 +++++-- src/gui/widgets/shoplistbox.cpp | 9 +++++++-- src/gui/widgets/spellshortcutcontainer.cpp | 9 +++++++-- src/gui/widgets/textfield.cpp | 12 +++++++++--- src/gui/widgets/window.cpp | 8 ++++++-- 8 files changed, 69 insertions(+), 20 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 4968393b2..21689311a 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -34,6 +34,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/models/avatarlistmodel.h" #include "gui/windows/chatwindow.h" @@ -392,9 +394,17 @@ void AvatarListBox::mousePressed(MouseEvent &event) const Being *const being = actorManager->findBeingByName( avatar->getName(), ActorType::PLAYER); if (being) - popupManager->showPopup(being); + { + popupMenu->showPopup(viewport->getMouseX(), + viewport->getMouseY(), + being); + } else - popupManager->showPlayerPopup(avatar->getName()); + { + popupMenu->showPlayerPopup(viewport->getMouseX(), + viewport->getMouseY(), + avatar->getName()); + } } break; } @@ -408,7 +418,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) else name = model->getAvatarAt(selected)->getName(); - popupManager->showAttackMonsterPopup(name, + popupMenu->showAttackMonsterPopup(viewport->getMouseX(), + viewport->getMouseY(), + name, static_cast(model->getAvatarAt( selected)->getType())); break; @@ -422,7 +434,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) else name = model->getAvatarAt(selected)->getName(); - popupManager->showPickupItemPopup(name); + popupMenu->showPickupItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + name); break; } case MapItemType::HOME: @@ -446,7 +460,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) { MapItem *const mapItem = map->findPortalXY( ava->getX(), ava->getY()); - popupManager->showPopup(mapItem); + popupMenu->showPopup(viewport->getMouseX(), + viewport->getMouseY(), + mapItem); } break; } diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index b57c98273..8fe3a8b2b 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -34,6 +34,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/windows/inventorywindow.h" @@ -215,8 +216,12 @@ void DropShortcutContainer::mousePressed(MouseEvent &event) Item *const item = inv->findItem(dropShortcut->getItem(index), dropShortcut->getItemColor(index)); - if (popupManager) - popupManager->showDropPopup(item); + if (popupMenu) + { + popupMenu->showDropPopup(viewport->getMouseX(), + viewport->getMouseY(), + item); + } } } diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index 2217b051f..f63991f8d 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -26,6 +26,7 @@ #include "gui/viewport.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/windows/confirmdialog.h" #include "gui/windows/helpwindow.h" @@ -79,8 +80,12 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event) } else if (button == MouseButton::RIGHT) { - if (popupManager) - popupManager->showLinkPopup(url); + if (popupMenu) + { + popupMenu->showLinkPopup(viewport->getMouseX(), + viewport->getMouseY(), + url); + } } } else if (!link.empty() && link[0] == '?') diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index 2d8deeba9..84b7bc249 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -39,6 +39,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/spellpopup.h" #include "gui/windows/inventorywindow.h" @@ -334,9 +335,11 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event) else if (event.getButton() == MouseButton::RIGHT) { event.consume(); - if (popupManager && selShortcut) + if (popupMenu && selShortcut && viewport) { - popupManager->showItemPopup(selShortcut->getItem(index), + popupMenu->showItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + selShortcut->getItem(index), selShortcut->getItemColor(index)); } } diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 019fd3e63..8efc5241f 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -33,6 +33,7 @@ #include "gui/fonts/font.h" #include "gui/popups/itempopup.h" +#include "gui/popups/popupmenu.h" #include "gui/models/shopitems.h" @@ -234,8 +235,12 @@ void ShopListBox::mouseReleased(MouseEvent& event) return; Item *const item = mShopItems->at(mSelected); - if (popupManager) - popupManager->showItemPopup(item); + if (popupMenu && viewport) + { + popupMenu->showItemPopup(viewport->getMouseX(), + viewport->getMouseY(), + item); + } } } diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 8960725d5..164513d73 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -32,6 +32,7 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" #include "gui/popups/spellpopup.h" #include "gui/windows/shortcutwindow.h" @@ -260,8 +261,12 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event) if (itemId >= 0) spell = spellManager->getSpell(itemId); - if (spell && popupManager) - popupManager->showSpellPopup(spell); + if (spell && popupMenu) + { + popupMenu->showSpellPopup(viewport->getMouseX(), + viewport->getMouseY(), + spell); + } } } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index adb455432..0810b9395 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -70,14 +70,16 @@ #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 #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "resources/image.h" #include "resources/imagerect.h" @@ -703,8 +705,12 @@ void TextField::mousePressed(MouseEvent &event) event.consume(); if (event.getButton() == MouseButton::RIGHT) { - if (popupManager) - popupManager->showTextFieldPopup(this); + if (popupMenu) + { + popupMenu->showTextFieldPopup(viewport->getMouseX(), + viewport->getMouseY(), + this); + } } else if (event.getButton() == MouseButton::LEFT) { diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 2078c4cef..7a85d5352 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -80,6 +80,8 @@ #include "gui/fonts/font.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/setupwindow.h" #include "gui/widgets/containerplacer.h" @@ -764,10 +766,12 @@ void Window::mousePressed(MouseEvent &event) } else if (button == MouseButton::RIGHT) { - if (popupManager) + if (popupMenu) { event.consume(); - popupManager->showWindowPopup(this); + popupMenu->showWindowPopup(this, + viewport->getMouseX(), + viewport->getMouseY()); } } } -- cgit v1.2.3-70-g09d2