summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugingui/knob.cc11
-rw-r--r--plugingui/knob.h1
2 files changed, 12 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) {
diff --git a/plugingui/knob.h b/plugingui/knob.h
index 98ccf36..a78361b 100644
--- a/plugingui/knob.h
+++ b/plugingui/knob.h
@@ -48,6 +48,7 @@ public:
virtual void repaintEvent(RepaintEvent *e);
virtual void buttonEvent(ButtonEvent *e);
virtual void mouseMoveEvent(MouseMoveEvent *e);
+ virtual void scrollEvent(ScrollEvent *e);
private:
typedef enum {