diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-03-20 19:27:56 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-03-20 19:27:56 +0300 |
commit | 8581f07c6da9e37fdc5ded44802a5c178ccb419f (patch) | |
tree | 793a7cb8c2ab9fb4aa33d3175f7a8ff5838ee596 /src | |
parent | 25de0fac3fac02fbd843e33e1494c697dd35638a (diff) | |
download | manaverse-8581f07c6da9e37fdc5ded44802a5c178ccb419f.tar.gz manaverse-8581f07c6da9e37fdc5ded44802a5c178ccb419f.tar.bz2 manaverse-8581f07c6da9e37fdc5ded44802a5c178ccb419f.tar.xz manaverse-8581f07c6da9e37fdc5ded44802a5c178ccb419f.zip |
Improve windowmenu.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windowmenu.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 03d4d15a8..616afa46d 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -180,16 +180,13 @@ WindowMenu::~WindowMenu() delete (*it).second; } mButtonNames.clear(); - for (std::vector <Button*>::iterator it = mButtons.begin(), - it_end = mButtons.end(); it != it_end; ++it) + FOR_EACH (std::vector <Button*>::iterator, it, mButtons) { Button *const btn = dynamic_cast<Button*>(*it); if (!btn) continue; if (!btn->isVisible()) - { delete btn; - } } delete_all(mButtonTexts); mButtonTexts.clear(); @@ -204,7 +201,6 @@ WindowMenu::~WindowMenu() void WindowMenu::action(const ActionEvent &event) { const std::string &eventId = event.getId(); - const std::map <std::string, ButtonInfo*>::iterator it = mButtonNames.find(eventId); if (it == mButtonNames.end()) @@ -219,7 +215,9 @@ void WindowMenu::action(const ActionEvent &event) void WindowMenu::addButton(const char *const text, const std::string &description, - int &restrict x, int &restrict h, const int key, + int &restrict x, + int &restrict h, + const int key, const bool visible) { Button *const btn = new Button(this, gettext(text), text, this); @@ -391,9 +389,7 @@ void WindowMenu::loadButtons() void WindowMenu::saveButtons() const { int i = 0; - for (std::vector <Button*>::const_iterator it = mButtons.begin(), - it_end = mButtons.end(); - it != it_end; ++it) + FOR_EACH (std::vector <Button*>::const_iterator, it, mButtons) { const Button *const btn = dynamic_cast<const Button *const>(*it); if (btn && !btn->isVisible()) |