diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-30 00:07:54 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-30 00:07:54 +0300 |
commit | a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63 (patch) | |
tree | 2d85d112997176e9ab765e638b0e7f2e16677b83 /src/gui/popups | |
parent | 5c83a96b8ad85ad0562542b9720a0df6c5fb550c (diff) | |
parent | 8983700f6c8cc6496626ed3af235e1ec31fe5501 (diff) | |
download | plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.gz plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.bz2 plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.tar.xz plus-a93d1e06f928f6e4e1c7f3c58ddb7ae3676c1c63.zip |
Merge branch 'master' into stable
Diffstat (limited to 'src/gui/popups')
-rw-r--r-- | src/gui/popups/itempopup.h | 2 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 63 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 2 | ||||
-rw-r--r-- | src/gui/popups/speechbubble.h | 4 | ||||
-rw-r--r-- | src/gui/popups/spellpopup.h | 2 | ||||
-rw-r--r-- | src/gui/popups/textpopup.h | 2 |
6 files changed, 68 insertions, 7 deletions
diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index f1cedf046..73129eaea 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -61,7 +61,7 @@ class ItemPopup final : public Popup void setItem(const Item *const item, const bool showImage = false); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mItemName; 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) diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 7eb38dc15..8bdbd3b1b 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -182,6 +182,8 @@ class PopupMenu final : public Popup, public LinkHandler void showNpcDialogPopup(const int npcId, const int x, const int y); + void showWindowPopup(Window *const window, const int x, const int y); + /** * Handles link action. */ diff --git a/src/gui/popups/speechbubble.h b/src/gui/popups/speechbubble.h index 1bc5385a4..fe5cf1bfc 100644 --- a/src/gui/popups/speechbubble.h +++ b/src/gui/popups/speechbubble.h @@ -48,9 +48,9 @@ class SpeechBubble final : public Popup */ void setCaption(const std::string &name, const Color *const color1 = - &Theme::getThemeColor(Theme::BUBBLE_NAME), + &theme->getColor(Theme::BUBBLE_NAME, 255), const Color *const color2 = - &Theme::getThemeColor(Theme::BUBBLE_NAME_OUTLINE)); + &theme->getColor(Theme::BUBBLE_NAME_OUTLINE, 255)); /** * Sets the text to be displayed. diff --git a/src/gui/popups/spellpopup.h b/src/gui/popups/spellpopup.h index cbbd53703..0352161fc 100644 --- a/src/gui/popups/spellpopup.h +++ b/src/gui/popups/spellpopup.h @@ -59,7 +59,7 @@ class SpellPopup final : public Popup */ void view(const int x, const int y); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mItemName; diff --git a/src/gui/popups/textpopup.h b/src/gui/popups/textpopup.h index eb29cba61..e1dcb95b8 100644 --- a/src/gui/popups/textpopup.h +++ b/src/gui/popups/textpopup.h @@ -72,7 +72,7 @@ class TextPopup final : public Popup void show(const int x, const int y, const std::string &str1, const std::string &str2, const std::string &str3); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mText[TEXTPOPUPCOUNT]; |