From 4cd59b0f9f30b7104197fa96851b616fb9981caa Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 3 Feb 2013 15:32:33 +0300 Subject: Add support for small screens with on screen top right buttons. Add button "WIN" to buttons list. --- src/gui/popupmenu.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/gui/popupmenu.cpp') 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 &names = windowMenu->getButtonTexts(); + mBrowserBox->addRow(_("Show window")); + + FOR_EACH (std::vector::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(); -- cgit v1.2.3-60-g2f50