Add mousewheel handling.
This commit is contained in:
parent
cf9cbd2691
commit
c88ef27abf
|
@ -34,10 +34,41 @@ public:
|
|||
Fl_Dial( X, Y, W, H, L )
|
||||
{
|
||||
box( FL_OVAL_BOX );
|
||||
// step( 0.1f );
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
int handle ( int m )
|
||||
{
|
||||
/* Fl_Dial and friends should really handle mousewheel, but they don't in FTLK1 */
|
||||
|
||||
switch ( m )
|
||||
{
|
||||
case FL_MOUSEWHEEL:
|
||||
{
|
||||
if ( this != Fl::belowmouse() )
|
||||
return 0;
|
||||
|
||||
int d = Fl::event_dy();
|
||||
|
||||
double v = increment( value(), d );
|
||||
|
||||
if ( v < minimum() )
|
||||
v = minimum();
|
||||
else if ( v > maximum() )
|
||||
v = maximum();
|
||||
|
||||
value( v );
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Fl_Dial::handle( m );
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
draw ( void )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue