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/widgets/listbox.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/gui/widgets/listbox.cpp') diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index f11632675..dcd27e671 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -40,7 +40,7 @@ float ListBox::mAlpha = 1.0; -ListBox::ListBox(gcn::ListModel *listModel): +ListBox::ListBox(gcn::ListModel *const listModel): gcn::ListBox(listModel), mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), mDistributeMousePressed(true) @@ -54,7 +54,7 @@ ListBox::~ListBox() void ListBox::updateAlpha() { - float alpha = std::max(Client::getGuiAlpha(), + const float alpha = std::max(Client::getGuiAlpha(), Theme::instance()->getMinimumOpacity()); if (mAlpha != alpha) @@ -92,7 +92,7 @@ void ListBox::draw(gcn::Graphics *graphics) void ListBox::keyPressed(gcn::KeyEvent &keyEvent) { - int action = static_cast(&keyEvent)->getActionId(); + const int action = static_cast(&keyEvent)->getActionId(); if (action == Input::KEY_GUI_SELECT) { @@ -156,9 +156,8 @@ void ListBox::mouseDragged(gcn::MouseEvent &event) return; // Make list selection update on drag, but guard against negative y - int y = std::max(0, event.getY()); if (getRowHeight()) - setSelected(y / getRowHeight()); + setSelected(std::max(0, event.getY()) / getRowHeight()); } void ListBox::refocus() -- cgit v1.2.3-70-g09d2