Main Page | Class Hierarchy | Class List | File List | Class Members

Flu_Dual_Slider.h

00001 // $Id: Flu_Dual_Slider.h,v 1.9 2004/10/14 18:59:36 jbryan Exp $
00002 
00003 /***************************************************************
00004  *                FLU - FLTK Utility Widgets 
00005  *  Copyright (C) 2002 Ohio Supercomputer Center, Ohio State University
00006  *
00007  * This file and its content is protected by a software license.
00008  * You should have received a copy of this license with this file.
00009  * If not, please contact the Ohio Supercomputer Center immediately:
00010  * Attn: Jason Bryan Re: FLU 1224 Kinnear Rd, Columbus, Ohio 43212
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

Generated on Fri Nov 5 12:41:32 2004 for FLTK Utility Library and Widget Collection (FLU) by doxygen 1.3.5