2 /*******************************************************************************/
3 /* Copyright (C) 2012 Jonathan Moore Liles */
5 /* This program is free software; you can redistribute it and/or modify it */
6 /* under the terms of the GNU General Public License as published by the */
7 /* Free Software Foundation; either version 2 of the License, or (at your */
8 /* option) any later version. */
10 /* This program is distributed in the hope that it will be useful, but WITHOUT */
11 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
12 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
15 /* You should have received a copy of the GNU General Public License along */
16 /* with This program; see the file COPYING. If not,write to the Free Software */
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18 /*******************************************************************************/
21 #include "Fl_Value_SliderX.H"
23 int Fl_Value_SliderX::_default_style = NICE_SLIDER;
26 Fl_Value_SliderX::draw ( void )
28 switch ( _default_style )
32 if ( FL_HORIZONTAL == _type )
33 Fl_Value_Slider::type( FL_HOR_NICE_SLIDER );
35 Fl_Value_Slider::type( FL_VERT_NICE_SLIDER );
40 if ( FL_HORIZONTAL == _type )
41 Fl_Value_Slider::type( FL_HOR_FILL_SLIDER );
43 Fl_Value_Slider::type( FL_VERT_FILL_SLIDER );
48 if ( FL_HORIZONTAL == _type )
49 Fl_Value_Slider::type( FL_HOR_SLIDER );
51 Fl_Value_Slider::type( FL_VERT_SLIDER );
56 Fl_Value_Slider::draw();
61 Fl_Value_SliderX::handle ( int m )
64 /* Fl_Value_Slider and friends should really handle mousewheel, but they don't in FTLK1 */
71 if ( this != Fl::belowmouse() )
76 if ( Fl::event_ctrl() )
79 float step = fabs( maximum() - minimum() ) / (float)steps;
81 float d = ((float)Fl::event_dy()) * step;
83 double v = value() + d;
85 if ( maximum() > minimum() )
89 else if ( v > maximum() )
96 else if ( v < maximum() )
107 return Fl_Value_Slider::handle( m );