Add mousewheel handling.

This commit is contained in:
Jonathan Moore Liles 2008-03-14 19:23:03 -05:00
parent cf9cbd2691
commit c88ef27abf
1 changed files with 31 additions and 0 deletions

View File

@ -34,10 +34,41 @@ public:
Fl_Dial( X, Y, W, H, L ) Fl_Dial( X, Y, W, H, L )
{ {
box( FL_OVAL_BOX ); box( FL_OVAL_BOX );
// step( 0.1f );
} }
protected: 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 virtual void
draw ( void ) draw ( void )
{ {