1 // ----------------------------------------------------------------------------
2 //
3 // class wheel_slider - based on Fl_Slider
4 // class wheel_value_slider - based on Fl_Value_Slider
5 //
6 // Copyright (C) 2008-2012
7 //               Stelios Buonanos, M0GLD
8 //               Dave Freese, W1HKJ
9 //
10 // This is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU General Public License as published by
12 // the Free Software Foundation; either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // fldigi is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with the program; if not, write to the
22 //
23 //  Free Software Foundation, Inc.
24 //  51 Franklin Street, Fifth Floor
25 //  Boston, MA  02110-1301 USA.
26 //
27 // ----------------------------------------------------------------------------
28 
29 #include <FL/Fl.H>
30 #include "ValueSlider.h"
31 
handle(int event)32 int Fl_Wheel_Slider::handle(int event)
33 {
34 	if (event != FL_MOUSEWHEEL || !Fl::event_inside(this))
35 		return Fl_Slider::handle(event);
36 	int d;
37 	if ( !((d = Fl::event_dy()) || (d = Fl::event_dx())) )
38 		return Fl_Slider::handle(event);
39     if (reverse_) d = -d;
40 	value(clamp(increment(value(), d)));
41 	do_callback();
42 	return 1;
43 }
44 
handle(int event)45 int Fl_Wheel_Value_Slider::handle(int event)
46 {
47 	if (event != FL_MOUSEWHEEL || !Fl::event_inside(this))
48 		return Fl_Value_Slider::handle(event);
49 	int d;
50 	if ( !((d = Fl::event_dy()) || (d = Fl::event_dx())) )
51 		return Fl_Value_Slider::handle(event);
52     if (reverse_) d = -d;
53 	value(clamp(increment(value(), d)));
54 	do_callback();
55 	return 1;
56 }
57