From 847e8f06107293254606d499aeb3e8a2006b9b78 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 4 Apr 2011 22:26:03 +0000 Subject: [PATCH] add some scroll wheel support to the scroomer git-svn-id: svn://localhost/ardour2/branches/3.0@9287 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/gtkmm2ext/scroomer.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/libs/gtkmm2ext/scroomer.cc b/libs/gtkmm2ext/scroomer.cc index 40892301bc..3009449c91 100644 --- a/libs/gtkmm2ext/scroomer.cc +++ b/libs/gtkmm2ext/scroomer.cc @@ -202,6 +202,23 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) return true; } +bool +Scroomer::on_scroll_event (GdkEventScroll* ev) +{ + switch (ev->direction) { + case GDK_SCROLL_UP: + adj.set_value (adj.get_value() - adj.get_page_size()/10.0); + break; + case GDK_SCROLL_DOWN: + adj.set_value (adj.get_value() + adj.get_page_size()/10.0); + break; + default: + return false; + } + + return true; +} + bool Scroomer::on_button_press_event (GdkEventButton* ev) { @@ -267,12 +284,6 @@ Scroomer::on_button_release_event (GdkEventButton* ev) return true; } -bool -Scroomer::on_scroll_event (GdkEventScroll*) -{ - return true; -} - void Scroomer::on_size_allocate (Allocation& a) {