diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-16 19:40:42 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-16 19:40:42 +0300 |
commit | 829cd57e021ea85cffdbd3f3a7b18da835e00b7c (patch) | |
tree | 4dbc5c2eeb9a297697c58f6e45079d968b6350cd /src | |
parent | 31f5f2a630e17fa1a3726e38d1475357feba96ca (diff) | |
download | manaplus-829cd57e021ea85cffdbd3f3a7b18da835e00b7c.tar.gz manaplus-829cd57e021ea85cffdbd3f3a7b18da835e00b7c.tar.bz2 manaplus-829cd57e021ea85cffdbd3f3a7b18da835e00b7c.tar.xz manaplus-829cd57e021ea85cffdbd3f3a7b18da835e00b7c.zip |
Create public variable for popupmenu.
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 3 | ||||
-rw-r--r-- | src/gui/popupmanager.cpp | 75 | ||||
-rw-r--r-- | src/gui/popupmanager.h | 1 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 2 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 2 | ||||
-rw-r--r-- | src/gui/windowmanager.cpp | 4 |
6 files changed, 47 insertions, 40 deletions
diff --git a/src/client.cpp b/src/client.cpp index 75de57bbe..071175f90 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -59,6 +59,8 @@ #include "gui/theme.h" #include "gui/windowmanager.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/changeemaildialog.h" #include "gui/windows/changepassworddialog.h" #include "gui/windows/charselectdialog.h" @@ -602,6 +604,7 @@ void Client::gameClear() delete2(helpWindow); delete2(didYouKnowWindow); delete2(commandHandler); + delete2(popupMenu); stopTimers(); diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index 45899a380..8f5dbdb0c 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -37,18 +37,15 @@ PopupManager *popupManager = nullptr; PopupManager::PopupManager() : - mPopupMenu(new PopupMenu), mBeingPopup(new BeingPopup), mTextPopup(new TextPopup) { mBeingPopup->postInit(); - mPopupMenu->postInit(); mTextPopup->postInit(); } PopupManager::~PopupManager() { - delete2(mPopupMenu); delete2(mBeingPopup); delete2(mTextPopup); } @@ -58,119 +55,119 @@ void PopupManager::showPopup(Window *const parent, Item *const item, const bool isInventory) { - mPopupMenu->showPopup(parent, x, y, item, isInventory); + popupMenu->showPopup(parent, x, y, item, isInventory); } void PopupManager::showPopup(MapItem *const item) { - mPopupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), item); + popupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), item); } void PopupManager::showPopup(Window *const parent, Item *const item, const bool isInventory) { - mPopupMenu->showPopup(parent, viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showPopup(parent, viewport->getMouseX(), viewport->getMouseY(), item, isInventory); } void PopupManager::showPopup(const int x, const int y, const std::vector<ActorSprite*> &beings) { - mPopupMenu->showPopup(x, y, beings); + popupMenu->showPopup(x, y, beings); } void PopupManager::showPopup(const int x, const int y, const FloorItem *const floorItem) { - mPopupMenu->showPopup(x, y, floorItem); + popupMenu->showPopup(x, y, floorItem); } void PopupManager::showPopup(const int x, const int y, MapItem *const mapItem) { - mPopupMenu->showPopup(x, y, mapItem); + popupMenu->showPopup(x, y, mapItem); } void PopupManager::showItemPopup(Item *const item) { - mPopupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), item); } void PopupManager::showItemPopup(const int itemId, const unsigned char color) { - mPopupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showItemPopup(viewport->getMouseX(), viewport->getMouseY(), itemId, color); } void PopupManager::showDropPopup(Item *const item) { - mPopupMenu->showDropPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showDropPopup(viewport->getMouseX(), viewport->getMouseY(), item); } void PopupManager::showOutfitsPopup(const int x, const int y) { - mPopupMenu->showOutfitsPopup(x, y); + popupMenu->showOutfitsPopup(x, y); } void PopupManager::showOutfitsPopup() { - mPopupMenu->showOutfitsPopup(viewport->getMouseX(), viewport->getMouseY()); + popupMenu->showOutfitsPopup(viewport->getMouseX(), viewport->getMouseY()); } void PopupManager::showSpellPopup(TextCommand *const cmd) { - mPopupMenu->showSpellPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showSpellPopup(viewport->getMouseX(), viewport->getMouseY(), cmd); } void PopupManager::showChatPopup(const int x, const int y, ChatTab *const tab) { - mPopupMenu->showChatPopup(x, y, tab); + popupMenu->showChatPopup(x, y, tab); } void PopupManager::showChatPopup(ChatTab *const tab) { - mPopupMenu->showChatPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showChatPopup(viewport->getMouseX(), viewport->getMouseY(), tab); } void PopupManager::showPopup(const int x, const int y, const Being *const being) { - mPopupMenu->showPopup(x, y, being); + popupMenu->showPopup(x, y, being); } void PopupManager::showPopup(const Being *const being) { - mPopupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), being); + popupMenu->showPopup(viewport->getMouseX(), viewport->getMouseY(), being); } void PopupManager::showPlayerPopup(const std::string &nick) { - mPopupMenu->showPlayerPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showPlayerPopup(viewport->getMouseX(), viewport->getMouseY(), nick); } void PopupManager::showPopup(const int x, const int y, Button *const button) { - mPopupMenu->showPopup(x, y, button); + popupMenu->showPopup(x, y, button); } void PopupManager::showPopup(const int x, const int y, const ProgressBar *const bar) { - mPopupMenu->showPopup(x, y, bar); + popupMenu->showPopup(x, y, bar); } void PopupManager::showAttackMonsterPopup(const std::string &name, const ActorType::Type &type) { - mPopupMenu->showAttackMonsterPopup(viewport->getMouseX(), + popupMenu->showAttackMonsterPopup(viewport->getMouseX(), viewport->getMouseY(), name, type); @@ -178,7 +175,7 @@ void PopupManager::showAttackMonsterPopup(const std::string &name, void PopupManager::showPickupItemPopup(const std::string &name) { - mPopupMenu->showPickupItemPopup(viewport->getMouseX(), + popupMenu->showPickupItemPopup(viewport->getMouseX(), viewport->getMouseY(), name); } @@ -187,57 +184,57 @@ void PopupManager::showUndressPopup(const int x, const int y, const Being *const being, Item *const item) { - mPopupMenu->showUndressPopup(x, y, being, item); + popupMenu->showUndressPopup(x, y, being, item); } void PopupManager::showMapPopup(const int x, const int y) { - mPopupMenu->showMapPopup(viewport->getMouseX(), viewport->getMouseY(), + popupMenu->showMapPopup(viewport->getMouseX(), viewport->getMouseY(), x, y); } void PopupManager::showMapPopup(const int x1, const int y1, const int x2, const int y2) { - mPopupMenu->showMapPopup(x1, y1, x2, y2); + popupMenu->showMapPopup(x1, y1, x2, y2); } void PopupManager::showTextFieldPopup(TextField *const input) { - mPopupMenu->showTextFieldPopup(viewport->getMouseX(), + popupMenu->showTextFieldPopup(viewport->getMouseX(), viewport->getMouseY(), input); } void PopupManager::showLinkPopup(const std::string &link) { - mPopupMenu->showLinkPopup(viewport->getMouseX(), + popupMenu->showLinkPopup(viewport->getMouseX(), viewport->getMouseY(), link); } void PopupManager::showWindowsPopup() { - mPopupMenu->showWindowsPopup(viewport->getMouseX(), viewport->getMouseY()); + popupMenu->showWindowsPopup(viewport->getMouseX(), viewport->getMouseY()); } void PopupManager::showNpcDialogPopup(const int npcId) { - mPopupMenu->showNpcDialogPopup(npcId, + popupMenu->showNpcDialogPopup(npcId, viewport->getMouseX(), viewport->getMouseY()); } void PopupManager::showWindowPopup(Window *const window) { - mPopupMenu->showWindowPopup(window, viewport->getMouseX(), + popupMenu->showWindowPopup(window, viewport->getMouseX(), viewport->getMouseY()); } void PopupManager::closePopupMenu() { - if (mPopupMenu) - mPopupMenu->handleLink("cancel", nullptr); + if (popupMenu) + popupMenu->handleLink("cancel", nullptr); } void PopupManager::hideBeingPopup() @@ -254,19 +251,19 @@ void PopupManager::hideTextPopup() void PopupManager::hidePopupMenu() { - if (mPopupMenu) - mPopupMenu->setVisible(false); + if (popupMenu) + popupMenu->setVisible(false); } bool PopupManager::isPopupMenuVisible() const { - return mPopupMenu ? mPopupMenu->isPopupVisible() : false; + return popupMenu ? popupMenu->isPopupVisible() : false; } void PopupManager::clearPopup() { - if (mPopupMenu) - mPopupMenu->clear(); + if (popupMenu) + popupMenu->clear(); } void PopupManager::showBeingPopup(const int x, const int y, diff --git a/src/gui/popupmanager.h b/src/gui/popupmanager.h index 3e54b1742..1687b8202 100644 --- a/src/gui/popupmanager.h +++ b/src/gui/popupmanager.h @@ -182,7 +182,6 @@ class PopupManager final void hidePopupMenu(); private: - PopupMenu *mPopupMenu; /**< Popup menu. */ BeingPopup *mBeingPopup; /**< Being information popup. */ TextPopup *mTextPopup; /**< Map Item information popup. */ }; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index aac6c1b21..0add7e10d 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -96,6 +96,8 @@ extern int serverVersion; std::string tradePartnerName; +PopupMenu *popupMenu = nullptr; + PopupMenu::PopupMenu() : Popup("PopupMenu", "popupmenu.xml"), mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 69ca3c17b..f9b8cc639 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -202,4 +202,6 @@ class PopupMenu final : public Popup, public LinkHandler void showPopup(int x, int y); }; +extern PopupMenu *popupMenu; + #endif // GUI_POPUPS_POPUPMENU_H diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 4ed20e980..3864a8990 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -32,6 +32,8 @@ #include "gui/gui.h" #include "gui/userpalette.h" +#include "gui/popups/popupmenu.h" + #include "gui/windows/didyouknowwindow.h" #include "gui/windows/helpwindow.h" #include "gui/windows/setupwindow.h" @@ -92,6 +94,8 @@ void WindowManager::createWindows() didYouKnowWindow = new DidYouKnowWindow; didYouKnowWindow->postInit(); commandHandler = new CommandHandler; + popupMenu = new PopupMenu; + popupMenu->postInit(); } void WindowManager::initTitle() |