summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-08 11:15:42 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-08 11:15:42 +0200
commitc66b4a56badc75fbd106e2a7019b6cb83972d677 (patch)
tree5da4cb652f5e617c56bf480e1198b1159b7f7e3f /src
parent0452ce8e5ada7ddc20d7ec8aa3bdd1e8a93b0687 (diff)
downloadmana-c66b4a56badc75fbd106e2a7019b6cb83972d677.tar.gz
mana-c66b4a56badc75fbd106e2a7019b6cb83972d677.tar.bz2
mana-c66b4a56badc75fbd106e2a7019b6cb83972d677.tar.xz
mana-c66b4a56badc75fbd106e2a7019b6cb83972d677.zip
Fixed scroll wheel handling in list boxes
The scroll wheel was changing the list box selection, which is somewhat unexpected. By not handling the event, it will be passed on to the parent ScrollArea and be handled appropriately.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/listbox.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index 753e6461..28a5a018 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -66,7 +66,6 @@ void ListBox::draw(gcn::Graphics *graphics)
}
}
-// -- KeyListener notifications
void ListBox::keyPressed(gcn::KeyEvent& keyEvent)
{
gcn::Key key = keyEvent.getKey();
@@ -105,31 +104,14 @@ void ListBox::keyPressed(gcn::KeyEvent& keyEvent)
}
}
+// Don't do anything on scrollwheel. ScrollArea will deal with that.
+
void ListBox::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
{
- if (isFocused())
- {
- if (getSelected() > 0)
- setSelected(getSelected() - 1);
- else if (getSelected() == 0 && mWrappingEnabled)
- setSelected(getListModel()->getNumberOfElements() - 1);
-
- mouseEvent.consume();
- }
}
void ListBox::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
{
- if (isFocused())
- {
- if (getSelected() < (getListModel()->getNumberOfElements() - 1))
- setSelected(getSelected() + 1);
- else if (getSelected() == (getListModel()->getNumberOfElements() - 1) &&
- mWrappingEnabled)
- setSelected(0);
-
- mouseEvent.consume();
- }
}
void ListBox::mouseDragged(gcn::MouseEvent &event)