Files
power-console/MouseWheelSlider.cc
ADAM David Alan Martin c368696cc2 I dunno that this makes it any easier...
I tried splitting up the sources to speed
up some compiling... but it didn't help.
I dunno that it's more readable this way.

I'm checkpointing this just in case.
2026-01-26 03:47:52 -05:00

45 lines
785 B
C++

#include "MouseWheelSlider.h"
#include <iostream>
MouseWheelSlider::MouseWheelSlider( const int x, const int y, const int w, const int h,
const char *const l )
: Fl_Value_Slider( x, y, w, h, l )
{
step( 1 );
}
int
MouseWheelSlider::handle( const int event )
{
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;
}
}