From 5cbd0d2cb7086fda592c00dbc3b07d06af95f080 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 30 Aug 2012 22:53:27 +0300 Subject: Add const to more classes. --- src/gui/windowmenu.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/gui/windowmenu.cpp') diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 361b5287e..0e25c1f18 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -224,8 +224,9 @@ void WindowMenu::action(const gcn::ActionEvent &event) //{ //} -void WindowMenu::addButton(const char* text, std::string description, - int &x, int &h, int key, bool visible) +void WindowMenu::addButton(const char *const text, + const std::string &description, + int &x, int &h, const int key, const bool visible) { Button *btn = new Button(gettext(text), text, this); btn->setPosition(x, 0); @@ -248,7 +249,7 @@ void WindowMenu::mousePressed(gcn::MouseEvent &event) if (event.getButton() == gcn::MouseEvent::RIGHT) { - Button *btn = dynamic_cast(event.getSource()); + Button *const btn = dynamic_cast(event.getSource()); if (!btn) return; if (viewport) @@ -272,7 +273,8 @@ void WindowMenu::mouseMoved(gcn::MouseEvent &event) return; } - Button *btn = dynamic_cast(event.getSource()); + const Button *const btn = dynamic_cast( + event.getSource()); if (!btn) { @@ -282,7 +284,7 @@ void WindowMenu::mouseMoved(gcn::MouseEvent &event) const int x = event.getX(); const int y = event.getY(); - int key = btn->getTag(); + const int key = btn->getTag(); if (key != Input::KEY_NO_VALUE) { mTextPopup->show(x + getX(), y + getY(), btn->getDescription(), @@ -304,9 +306,9 @@ void WindowMenu::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) mTextPopup->hide(); } -void WindowMenu::showButton(std::string name, bool visible) +void WindowMenu::showButton(const std::string &name, const bool visible) { - Button *btn = dynamic_cast(mButtonNames[name]); + Button *const btn = dynamic_cast