FLTK Utility Library and Widget Collection (FLU): Flu_Dual_Slider.h Source File

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

# Flu_Dual_Slider.h

    00001 // $Id: Flu_Dual_Slider.h,v 1.7 2004/06/11 13:02:56 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; 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; 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
    00074 protected:
    00075
    00076   inline bool _horizontal()
    00077   { return( type() == FL_HOR_NICE_SLIDER || type() == FL_HOR_SLIDER ); }
    00078   inline bool _nice()
    00079   { return( type() == FL_HOR_NICE_SLIDER || type() == FL_VERT_NICE_SLIDER ); }
    00080
    00081   float highValue, lowValue;
    00082
    00083   bool _lFocus, _flip, _overlap;
    00084   int _grab, _delta;
    00085   float _lVal, _hVal;
    00086   int _lHandle[4], _hHandle[4];
    00087   bool _lGrabbed, _hGrabbed;
    00088   int _grabDelta;
    00089 };
    00090
    00091 #endif