Brightness slider works with mouse wheel.

This commit is contained in:
2026-01-25 17:29:36 -05:00
parent fa3944d3e3
commit d34a149716
3 changed files with 55 additions and 9 deletions

View File

@ -1,5 +1,49 @@
#pragma once
#include <Fl/Fl.H>
#include <Fl/Fl_Window.H>
#include <Fl/Fl_Value_Slider.H>
void saverChosen();
void perfChosen();
void balChosen();
class MouseWheelSlider : public Fl_Value_Slider
{
public:
explicit
MouseWheelSlider( const int x, const int y, const int w, const int h,
const char *const l= 0 )
: Fl_Value_Slider( x, y, w, h, l )
{
step( 1 );
}
int
handle( const int event ) override
{
switch( event )
{
case FL_MOUSEWHEEL:
{
// Negative, because I use this for the Brightness control.
const int dy= -Fl::event_dy();
value( value() - dy * step() );
do_callback();
return 1;
}
break;
default:
{
return this->Fl_Value_Slider::handle( event );
}
break;
}
}
};