From 415af32db3321d4b3a8026da46dda451cf44c735 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 10 Feb 2011 02:29:41 +0200 Subject: Impliment show/hide bars in left top corner. --- src/gui/popupmenu.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'src/gui/popupmenu.cpp') diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index db9e8447a..949aab9ae 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -41,6 +41,7 @@ #include "gui/chat.h" #include "gui/inventorywindow.h" #include "gui/itemamount.h" +#include "gui/ministatus.h" #include "gui/outfitwindow.h" #include "gui/sell.h" #include "gui/socialwindow.h" @@ -53,6 +54,7 @@ #include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" #include "gui/widgets/chattab.h" +#include "gui/widgets/progressbar.h" #include "gui/widgets/whispertab.h" #include "net/adminhandler.h" @@ -1049,6 +1051,16 @@ void PopupMenu::handleLink(const std::string &link, if (windowMenu) windowMenu->showButton(link.substr(12), true); } + else if (!link.find("hide bar_")) + { + if (miniStatusWindow) + miniStatusWindow->showBar(link.substr(9), false); + } + else if (!link.find("show bar_")) + { + if (miniStatusWindow) + miniStatusWindow->showBar(link.substr(9), true); + } // Unknown actions else if (link != "cancel") { @@ -1282,6 +1294,38 @@ void PopupMenu::showPopup(int x, int y, Button *button) showPopup(x, y); } +void PopupMenu::showPopup(int x, int y, ProgressBar *b) +{ + if (!b || !miniStatusWindow) + return; + + mBrowserBox->clearRows(); + std::list bars = miniStatusWindow->getBars(); + std::list ::iterator it, it_end; + for (it = bars.begin(), it_end = bars.end(); it != it_end; ++it) + { + ProgressBar *bar = *it; + if (!bar || bar->getActionEventId() == "status bar") + continue; + + if (bar->isVisible()) + { + mBrowserBox->addRow(strprintf("@@hide bar_%s|Hide %s@@", + bar->getActionEventId().c_str(), bar->getId().c_str())); + } + else + { + mBrowserBox->addRow(strprintf("@@show bar_%s|Show %s@@", + bar->getActionEventId().c_str(), bar->getId().c_str())); + } + } + + mBrowserBox->addRow("##3---"); + mBrowserBox->addRow(strprintf("@@cancel|%s@@", _("Cancel"))); + + showPopup(x, y); +} + void PopupMenu::showPopup(int x, int y) { setContentSize(mBrowserBox->getWidth() + 8, mBrowserBox->getHeight() + 8); -- cgit v1.2.3-70-g09d2