diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-09 13:52:47 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2013-03-09 13:52:47 +0100 |
commit | 7dd94e3415b1d65c251c80d012f16ad183b38e7d (patch) | |
tree | 5de7d2a4189bc7a377eb7454ca5e867a9800bdc5 /plugingui/knob.cc | |
parent | 9d3ca6da69096d5904cbe16d0f8778e6c14537e8 (diff) |
Add scollwheel support for knob widget.
Diffstat (limited to 'plugingui/knob.cc')
-rw-r--r-- | plugingui/knob.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugingui/knob.cc b/plugingui/knob.cc index 75a7278..d60ecc4 100644 --- a/plugingui/knob.cc +++ b/plugingui/knob.cc @@ -64,6 +64,17 @@ void GUI::Knob::registerClickHandler(void (*handler)(void *), void *ptr) this->ptr = ptr; } +void GUI::Knob::scrollEvent(ScrollEvent *e) +{ + val -= e->delta / 200.0; + if(val < 0) val = 0; + if(val > 1) val = 1; + + if(handler) handler(ptr); + + repaintEvent(NULL); +} + void GUI::Knob::mouseMoveEvent(MouseMoveEvent *e) { if(state == down) { |