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

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

# Flu_Spinner.h

    00001 // $Id: Flu_Spinner.h,v 1.11 2004/10/22 16:17:45 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_SPINNER_H
    00017 #define _FLU_SPINNER_H
    00018
    00019 #include <FL/Fl_Valuator.H>
    00020 #include <FL/Fl_Input.H>
    00021 #include <FL/Fl_Group.H>
    00022
    00023 #include "FLU/Flu_Enumerations.h"
    00024
    00026 class FLU_EXPORT Flu_Spinner : public Fl_Valuator
    00027 {
    00028
    00029   class NoTabInput : public Fl_Input
    00030     {
    00031     public:
    00032       NoTabInput( Flu_Spinner *s, int x, int y, int w, int h, const char *l = 0 );
    00033       int handle( int event );
    00034       void draw();
    00035       Flu_Spinner *spinner;
    00036     };
    00037
    00038 public:
    00039
    00041   Flu_Spinner( int x, int y, int w, int h, const char *l = 0 );
    00042
    00044   ~Flu_Spinner();
    00045
    00047   inline bool enable_repeating() const
    00048     { return _doRepeat; }
    00049
    00051   inline void enable_repeating( bool b )
    00052     { _doRepeat = b; }
    00053
    00055
    00060   inline void repeat( float initialDelay, float initialTime, float rapidDelay, float rapidTime )
    00061     { _initialDelay = initialDelay; _repeatTime[0] = initialTime; _rapidDelay = rapidDelay;_repeatTime[1] = rapidTime; }
    00062
    00064   inline int input_when() const
    00065     { return _input.when(); }
    00066
    00068   inline void input_when( int w )
    00069     { _input.when(w); }
    00070
    00072   inline bool editable() const
    00073     { return _editable; }
    00074
    00076   inline void editable( bool b )
    00077     { _editable = b; }
    00078
    00080   int handle( int );
    00081
    00083   void resize( int X, int Y, int W, int H );
    00084
    00086   inline void unlimited_range()
    00087     { range( -3.4e+38f, 3.4e+38f ); }
    00088
    00090   inline void wrap_range( bool b )
    00091     { _wrapRange = b; }
    00092
    00094   inline bool wrap_range() const
    00095     { return _wrapRange; }
    00096
    00098   inline void precision( int p )
    00099     { Fl_Valuator::precision(p); value_damage(); }
    00100
    00102   void value_damage();
    00103
    00105   inline void hide()
    00106     { Fl_Valuator::hide(); _input.hide(); }
    00107
    00109   inline void show()
    00110     { Fl_Valuator::show(); _input.show(); }
    00111
    00113   inline Fl_Font valuefont() const { return (Fl_Font)_input.textfont(); }
    00114
    00116   inline void valuefont( uchar s ) { _input.textfont(s); }
    00117
    00119   inline uchar valuesize() const { return _input.textsize(); }
    00120
    00122   inline void valuesize( uchar s ) { _input.textsize(s); }
    00123
    00125   inline Fl_Color valuecolor() const { return (Fl_Color)_input.color(); }
    00126
    00128   inline void valuecolor( unsigned s ) { _input.color(s); }
    00129
    00131   inline void valuecolor( unsigned s, unsigned s1 ) { _input.color(s,s1); }
    00132
    00134   inline Fl_Color valuefontcolor() const { return (Fl_Color)_input.textcolor(); }
    00135
    00137   inline void valuefontcolor( unsigned s ) { _input.textcolor(s); }
    00138
    00139 protected:
    00140
    00141   void _setvalue( double v );
    00142
    00143   friend class NoTabInput;
    00144
    00145   NoTabInput _input;
    00146   uchar _valbox[2];
    00147   bool _up, _pushed, _editable, _dragging;
    00148   float _totalTime;
    00149   double _lastValue;
    00150   int _lastY;
    00151   float _initialDelay, _repeatTime[2], _rapidDelay;
    00152   bool _doRepeat, _wrapRange;
    00153
    00154   static void input_cb( Fl_Widget*, void* v );
    00155   static void repeat_callback(void *);
    00156   void increment_cb();
    00157
    00158 protected:
    00159
    00160   void draw();
    00161
    00162 };
    00163
    00164 #endif