Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
committerStijn Buys <ingar@osirion.org>2015-01-06 18:51:37 +0000
commit72ee43e9470c6fdbc6ed7ff92b85dfa5062c5762 (patch)
tree6474fa59066d5212dcd40e3d76652dce35565280 /src/ui/scrollpane.cc
parent57d958d40af061e83aa99ca12e375e5345836ecd (diff)
Added separate event handlers for mouse button clicks and mouse wheel movement.
Diffstat (limited to 'src/ui/scrollpane.cc')
-rw-r--r--src/ui/scrollpane.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/ui/scrollpane.cc b/src/ui/scrollpane.cc
index 48391c5..57c957f 100644
--- a/src/ui/scrollpane.cc
+++ b/src/ui/scrollpane.cc
@@ -65,24 +65,21 @@ void ScrollPane::set_offset(const int offset)
scrollpane_offset = offset;
}
-bool ScrollPane::on_keypress(const int key, const unsigned int modifier)
+bool ScrollPane::on_mousewheel(const math::Vector2f & direction)
{
// number of lines to scroll
int alignmentmodifier =( (alignment() & AlignTop) == AlignTop) ? -1 : 1;
- switch (key) {
-
- case 512 + SDL_BUTTON_WHEELUP:
- inc_scroll(alignmentmodifier * scrollpane_offset);
- return true;
- break;
-
- case 512 + SDL_BUTTON_WHEELDOWN:
- dec_scroll(alignmentmodifier * scrollpane_offset);
- return true;
- break;
+ if (direction.y() > 0 )
+ {
+ inc_scroll(alignmentmodifier * scrollpane_offset);
+ return true;
+ } else if (direction.y() < 0 )
+ {
+ dec_scroll(alignmentmodifier * scrollpane_offset);
+ return true;
}
-
+
return false;
}