diff options
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index b71676b15..2c25cceaf 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -27,6 +27,7 @@ #include "game.h" #include "guild.h" #include "guildmanager.h" +#include "inputmanager.h" #include "item.h" #include "itemshortcut.h" #include "localplayer.h" @@ -1620,6 +1621,12 @@ void PopupMenu::handleLink(const std::string &link, if (miniStatusWindow) miniStatusWindow->showBar(link.substr(9), true); } + else if (!link.compare(0, 12, "show window_")) + { + const int id = atoi(link.substr(12).c_str()); + if (id >= 0) + inputManager.executeAction(id); + } // Unknown actions else if (link != "cancel") { @@ -2104,6 +2111,30 @@ void PopupMenu::showLinkPopup(const int x, const int y, showPopup(x, y); } +void PopupMenu::showWindowsPopup(const int x, const int y) +{ + mX = x; + mY = y; + + mBrowserBox->clearRows(); + const std::vector<ButtonText*> &names = windowMenu->getButtonTexts(); + mBrowserBox->addRow(_("Show window")); + + FOR_EACH (std::vector<ButtonText*>::const_iterator, it, names) + { + const ButtonText *const btn = *it; + if (!btn) + continue; + + mBrowserBox->addRow(strprintf("show window_%d", btn->key), + btn->text.c_str()); + } + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow("cancel", _("Cancel")); + + showPopup(x, y); +} + void PopupMenu::showPopup(int x, int y) { const int pad2 = 2 * getPadding(); |