diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-02-10 02:29:41 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-02-10 02:29:41 +0200 |
commit | 415af32db3321d4b3a8026da46dda451cf44c735 (patch) | |
tree | 3bb14334ffa98fceb1bdd87e6981a0046d26bb0e /src/gui/popupmenu.cpp | |
parent | 2fd9c226b15c4a30c728601b493a82942f9fe7bf (diff) | |
download | manaverse-415af32db3321d4b3a8026da46dda451cf44c735.tar.gz manaverse-415af32db3321d4b3a8026da46dda451cf44c735.tar.bz2 manaverse-415af32db3321d4b3a8026da46dda451cf44c735.tar.xz manaverse-415af32db3321d4b3a8026da46dda451cf44c735.zip |
Impliment show/hide bars in left top corner.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 44 |
1 files changed, 44 insertions, 0 deletions
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 <ProgressBar*> bars = miniStatusWindow->getBars(); + std::list <ProgressBar*>::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); |