~ubuntu-branches/ubuntu/wily/flrig/wily

« back to all changes in this revision

Viewing changes to src/widgets/ValueSlider.cxx

  • Committer: Package Import Robot
  • Author(s): Kamal Mostafa
  • Date: 2014-10-25 11:17:10 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20141025111710-n32skgya3l9u1brw
Tags: 1.3.17-1
* New upstream release (Closes: #761839)
* Debian Standards-Version: 3.9.6

Show diffs side-by-side

added added

removed removed

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