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.
This commit is contained in:
44
MouseWheelSlider.cc
Normal file
44
MouseWheelSlider.cc
Normal file
@ -0,0 +1,44 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user