diff options
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/custom_widgets.cxx | 16 | ||||
| -rw-r--r-- | fluid/custom_widgets.h | 2 |
2 files changed, 18 insertions, 0 deletions
diff --git a/fluid/custom_widgets.cxx b/fluid/custom_widgets.cxx index 170ef44a2..f409e9761 100644 --- a/fluid/custom_widgets.cxx +++ b/fluid/custom_widgets.cxx @@ -292,3 +292,19 @@ void Fluid_Coord_Input::value(int v) { fl_snprintf(buf, sizeof(buf), "%d", v); text(buf); } + +/** + Allow vertical mouse dragging and mouse wheel to interactively change the value. + */ +int Fluid_Coord_Input::handle(int event) { + switch (event) { + case FL_MOUSEWHEEL: + if (Fl::event_dy()) { + value( value() - Fl::event_dy() ); + set_changed(); + do_callback(FL_REASON_CHANGED); + } + return 1; + } + return Fl_Input::handle(event); +} diff --git a/fluid/custom_widgets.h b/fluid/custom_widgets.h index 8a464ae82..36abc1414 100644 --- a/fluid/custom_widgets.h +++ b/fluid/custom_widgets.h @@ -83,6 +83,8 @@ public: vars_ = vars; vars_user_data_ = user_data; } + + int handle(int) override; }; #endif |
