57 lines
1018 B
C++
57 lines
1018 B
C++
#pragma once
|
|
|
|
#include <Fl/Fl.H>
|
|
#include <Fl/Fl_Window.H>
|
|
#include <Fl/Fl_Value_Slider.H>
|
|
|
|
#include <iostream>
|
|
|
|
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();
|
|
|
|
const int newVal= value() - dy * step();
|
|
if( 0 ) std::cerr << "newVal: " << newVal << " max: " << maximum() << " min: " << minimum() << std::endl;
|
|
if( newVal >= maximum()
|
|
and newVal <= minimum() )
|
|
{
|
|
value( newVal );
|
|
}
|
|
|
|
do_callback();
|
|
|
|
return 1;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
{
|
|
return this->Fl_Value_Slider::handle( event );
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
};
|