From 8581f07c6da9e37fdc5ded44802a5c178ccb419f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 20 Mar 2014 19:27:56 +0300 Subject: Improve windowmenu. --- src/gui/windowmenu.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/gui') 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 ::iterator it = mButtons.begin(), - it_end = mButtons.end(); it != it_end; ++it) + FOR_EACH (std::vector ::iterator, it, mButtons) { Button *const btn = dynamic_cast(*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 ::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 ::const_iterator it = mButtons.begin(), - it_end = mButtons.end(); - it != it_end; ++it) + FOR_EACH (std::vector ::const_iterator, it, mButtons) { const Button *const btn = dynamic_cast(*it); if (btn && !btn->isVisible()) -- cgit v1.2.3-70-g09d2