FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

Fl_Valuator.H
1 //
2 // "$Id: Fl_Valuator.H 8864 2011-07-19 04:49:30Z greg.ercolano $"
3 //
4 // Valuator header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18
19 /* \file
20 Fl_Valuator widget . */
21
22 #ifndef Fl_Valuator_H
23 #define Fl_Valuator_H
24
25 #ifndef Fl_Widget_H
26 #include "Fl_Widget.H"
27 #endif
28
29 // shared type() values for classes that work in both directions:
30 #define FL_VERTICAL 0
31 #define FL_HORIZONTAL 1
32
33
46 class FL_EXPORT Fl_Valuator : public Fl_Widget {
47
48 double value_;
49 double previous_value_;
50 double min, max; // truncates to this range *after* rounding
51 double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
52
53 protected:
55 int horizontal() const {return type()& FL_HORIZONTAL;}
56 Fl_Valuator(int X, int Y, int W, int H, const char* L);
57
59 double previous_value() const {return previous_value_;}
61 void handle_push() {previous_value_ = value_;}
62 double softclamp(double);
63 void handle_drag(double newvalue);
64 void handle_release(); // use drag() value
65 virtual void value_damage(); // cause damage() due to value() changing
67 void set_value(double v) {value_ = v;}
68
69 public:
70
72 void bounds(double a, double b) {min=a; max=b;}
74 double minimum() const {return min;}
76 void minimum(double a) {min = a;}
78 double maximum() const {return max;}
80 void maximum(double a) {max = a;}
101 void range(double a, double b) {min = a; max = b;}
103 void step(int a) {A = a; B = 1;}
105 void step(double a, int b) {A = a; B = b;}
106 void step(double s);
118 double step() const {return A/B;}
119 void precision(int);
120
122 double value() const {return value_;}
123 int value(double);
124
125 virtual int format(char*);
126 double round(double); // round to nearest multiple of step
127 double clamp(double); // keep in range
128 double increment(double, int); // add n*step to value
129 };
130
131 #endif
132
133 //
134 // End of "$Id: Fl_Valuator.H 8864 2011-07-19 04:49:30Z greg.ercolano $".
135 //
Fl_Widget
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:100
Fl_Valuator
The Fl_Valuator class controls a single floating-point value and provides a consistent interface to s...
Definition: Fl_Valuator.H:46
Fl_Valuator::maximum
void maximum(double a)
Sets the maximum value for the valuator.
Definition: Fl_Valuator.H:80
Fl_Valuator::previous_value
double previous_value() const
Gets the previous floating point value before an event changed it.
Definition: Fl_Valuator.H:59
Fl_Valuator::minimum
double minimum() const
Gets the minimum value for the valuator.
Definition: Fl_Valuator.H:74
Fl_Valuator::horizontal
int horizontal() const
Tells if the valuator is an FL_HORIZONTAL one.
Definition: Fl_Valuator.H:55
Fl_Valuator::set_value
void set_value(double v)
Sets the current floating point value.
Definition: Fl_Valuator.H:67
Fl_Valuator::step
void step(double a, int b)
See double Fl_Valuator::step() const.
Definition: Fl_Valuator.H:105
Fl_Widget.H
Fl_Widget, Fl_Label classes .
Fl_Valuator::maximum
double maximum() const
Gets the maximum value for the valuator.
Definition: Fl_Valuator.H:78
Fl_Valuator::handle_push
void handle_push()
Stores the current value in the previous value.
Definition: Fl_Valuator.H:61
Fl_Valuator::minimum
void minimum(double a)
Sets the minimum value for the valuator.
Definition: Fl_Valuator.H:76
Fl_Valuator::bounds
void bounds(double a, double b)
Sets the minimum (a) and maximum (b) values for the valuator widget.
Definition: Fl_Valuator.H:72
Fl_Valuator::value
double value() const
Gets the floating point(double) value.
Definition: Fl_Valuator.H:122
Fl_Valuator::range
void range(double a, double b)
Sets the minimum and maximum values for the valuator.
Definition: Fl_Valuator.H:101
Fl_Valuator::step
void step(int a)
See double Fl_Valuator::step() const.
Definition: Fl_Valuator.H:103
Fl_Valuator::step
double step() const
Gets or sets the step value.
Definition: Fl_Valuator.H:118
Fl_Widget::type
uchar type() const
Gets the widget type.
Definition: Fl_Widget.H:263
- © 1998-2012 by Bill Spitzak and others.