summaryrefslogtreecommitdiff
path: root/src/gui/popups/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-03-22 15:38:51 +0300
committerAndrei Karas <akaras@inbox.ru>2014-03-22 15:38:51 +0300
commit7b07b0a09fd9799a7aca09c0dcd97a53547b0fa1 (patch)
treeca8ecc25a420c93944db3b9444acc1f68931efd5 /src/gui/popups/popupmenu.cpp
parentba931a717cb5a2549ecdaa1f924dbbf5f896a21b (diff)
downloadmv-7b07b0a09fd9799a7aca09c0dcd97a53547b0fa1.tar.gz
mv-7b07b0a09fd9799a7aca09c0dcd97a53547b0fa1.tar.bz2
mv-7b07b0a09fd9799a7aca09c0dcd97a53547b0fa1.tar.xz
mv-7b07b0a09fd9799a7aca09c0dcd97a53547b0fa1.zip
Add context menu into windows.
Diffstat (limited to 'src/gui/popups/popupmenu.cpp')
-rw-r--r--src/gui/popups/popupmenu.cpp63
1 files changed, 61 insertions, 2 deletions
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 3905d91e6..330df1a6c 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -840,6 +840,47 @@ void PopupMenu::showChangePos(const int x, const int y)
}
}
+void PopupMenu::showWindowPopup(Window *const window,
+ const int x, const int y)
+{
+ if (!window)
+ return;
+
+ mWindow = window;
+ mBrowserBox->clearRows();
+ // TRANSLATORS: popup menu header
+ mBrowserBox->addRow(_("window"));
+
+ if (window->getCloseButton())
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close window
+ mBrowserBox->addRow("window close", _("Close"));
+ }
+
+ if (window->isStickyButtonLock())
+ {
+ if (window->isSticky())
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: unlock window
+ mBrowserBox->addRow("window unlock", _("Unlock"));
+ }
+ else
+ {
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: lock window
+ mBrowserBox->addRow("window lock", _("Lock"));
+ }
+ }
+
+ // TRANSLATORS: popup menu item
+ // TRANSLATORS: close menu
+ mBrowserBox->addRow("cancel", _("Cancel"));
+
+ showPopup(x, y);
+}
+
void PopupMenu::handleLink(const std::string &link,
MouseEvent *event A_UNUSED)
{
@@ -1196,8 +1237,11 @@ void PopupMenu::handleLink(const std::string &link,
}
else if (link == "retrieve" && mItem)
{
- ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
- mWindow, mItem);
+ if (Widget::widgetExists(mWindow))
+ {
+ ItemAmountWindow::showWindow(ItemAmountWindow::StoreRemove,
+ mWindow, mItem);
+ }
}
else if (link == "retrieve 10" && mItem)
{
@@ -1748,6 +1792,21 @@ void PopupMenu::handleLink(const std::string &link,
showGMPopup();
return;
}
+ else if (link == "window close" && mWindow)
+ {
+ if (Widget::widgetExists(mWindow))
+ mWindow->close();
+ }
+ else if (link == "window unlock" && mWindow)
+ {
+ if (Widget::widgetExists(mWindow))
+ mWindow->setSticky(false);
+ }
+ else if (link == "window lock" && mWindow)
+ {
+ if (Widget::widgetExists(mWindow))
+ mWindow->setSticky(true);
+ }
else if (!link.compare(0, 10, "guild-pos-"))
{
if (player_node)