summaryrefslogtreecommitdiff
path: root/src/gui/widgets/listbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-08-30 22:53:27 +0300
committerAndrei Karas <akaras@inbox.ru>2012-08-30 22:53:27 +0300
commit5cbd0d2cb7086fda592c00dbc3b07d06af95f080 (patch)
treed36b4ac344f31f34311c7cb7a9a637ed48356e3e /src/gui/widgets/listbox.cpp
parent4210163dae7d6266923ab11f78b631173c9533e3 (diff)
downloadmanaverse-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.gz
manaverse-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.bz2
manaverse-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.tar.xz
manaverse-5cbd0d2cb7086fda592c00dbc3b07d06af95f080.zip
Add const to more classes.
Diffstat (limited to 'src/gui/widgets/listbox.cpp')
-rw-r--r--src/gui/widgets/listbox.cpp9
1 files changed, 4 insertions, 5 deletions
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*>(&keyEvent)->getActionId();
+ const int action = static_cast<KeyEvent*>(&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()