00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef _FLU_DUAL_SLIDER_H
00017 #define _FLU_DUAL_SLIDER_H
00018
00019 #include <FL/Fl.H>
00020 #include <FL/Fl_Valuator.H>
00021 #include <FL/Fl_Slider.H>
00022
00023 #include <stdlib.h>
00024 #include <string.h>
00025 #include <stdio.h>
00026
00027 #include "FLU/Flu_Enumerations.h"
00028
00030 class FLU_EXPORT Flu_Dual_Slider : public Fl_Valuator
00031 {
00032 public:
00033
00035 Flu_Dual_Slider( int x, int y, int w, int h, const char *l = 0 );
00036
00038 ~Flu_Dual_Slider();
00039
00041 int handle( int event );
00042
00044 void draw();
00045
00047 inline void overlap( bool b )
00048 { _overlap = b; }
00049
00051 inline bool overlap() const
00052 { return _overlap; }
00053
00055 inline void low_value( float v )
00056 { lowValue = v; _lVal = (lowValue-minimum())/(maximum()-minimum()); Fl_Valuator::value(v); }
00057
00059 inline float low_value() const
00060 { return minimum()>maximum() ? (minimum()+maximum()-highValue) : lowValue; }
00061
00063 inline void high_value( float v )
00064 { highValue = v; _hVal = (highValue-minimum())/(maximum()-minimum()); Fl_Valuator::value(v); }
00065
00067 inline float high_value() const
00068 { return minimum()>maximum() ? (minimum()+maximum()-lowValue) : highValue; }
00069
00071 inline void value( float lo, float hi )
00072 { low_value(lo); high_value(hi); }
00073
00075 inline bool low_grabbed() const
00076 { return _lGrabbed; }
00077
00079 inline bool high_grabbed() const
00080 { return _hGrabbed; }
00081
00082 protected:
00083
00084 inline bool _horizontal()
00085 { return( type() == FL_HOR_NICE_SLIDER || type() == FL_HOR_SLIDER ); }
00086 inline bool _nice()
00087 { return( type() == FL_HOR_NICE_SLIDER || type() == FL_VERT_NICE_SLIDER ); }
00088
00089 float highValue, lowValue;
00090
00091 bool _lFocus, _flip, _overlap;
00092 int _grab, _delta;
00093 float _lVal, _hVal;
00094 int _lHandle[4], _hHandle[4];
00095 bool _lGrabbed, _hGrabbed;
00096 int _grabDelta;
00097 };
00098
00099 #endif