fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl_Valuator.H
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Valuator header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2016 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 
50 
51  double value_;
53  double min, max; // truncates to this range *after* rounding
54  double A; int B; // rounds to multiples of A/B, or no rounding if A is zero
55 
56 protected:
58  int horizontal() const {return type()& FL_HORIZONTAL;}
59  Fl_Valuator(int X, int Y, int W, int H, const char* L);
60 
62  double previous_value() const {return previous_value_;}
64  void handle_push() {previous_value_ = value_;}
65  double softclamp(double);
66  void handle_drag(double newvalue);
67  void handle_release(); // use drag() value
68  virtual void value_damage(); // cause damage() due to value() changing
70  void set_value(double v) {value_ = v;}
71 
72 public:
73 
75  void bounds(double a, double b) {min=a; max=b;}
77  double minimum() const {return min;}
79  void minimum(double a) {min = a;}
81  double maximum() const {return max;}
83  void maximum(double a) {max = a;}
104  void range(double a, double b) {min = a; max = b;}
106  void step(int a) {A = a; B = 1;}
108  void step(double a, int b) {A = a; B = b;}
109  void step(double s);
121  double step() const {return A/B;}
122  void precision(int digits);
123 
125  double value() const {return value_;}
126  int value(double);
127 
128  virtual int format(char*);
129  double round(double); // round to nearest multiple of step
130  double clamp(double); // keep in range
131  double increment(double, int); // add n*step to value
132 };
133 
134 #endif
135 
136 //
137 // End of "$Id$".
138 //
min
static int min(int i1, int i2)
Definition: Fl_Text_Buffer.cxx:63
Fl_Widget.H
Fl_Valuator::min
double min
Definition: Fl_Valuator.H:53
Fl_Valuator::value
double value() const
Definition: Fl_Valuator.H:125
Fl_Valuator::step
void step(double a, int b)
Definition: Fl_Valuator.H:108
Fl_Valuator::minimum
void minimum(double a)
Definition: Fl_Valuator.H:79
Fl_Valuator::previous_value
double previous_value() const
Definition: Fl_Valuator.H:62
H
static int H
Definition: Fl_Tooltip.cxx:76
Fl_Valuator::value_
double value_
Definition: Fl_Valuator.H:51
Fl_Valuator::maximum
double maximum() const
Definition: Fl_Valuator.H:81
b
long b
Definition: jpegint.h:397
FL_EXPORT
#define FL_EXPORT
Definition: Fl_Export.H:35
FL_HORIZONTAL
#define FL_HORIZONTAL
The valuator can work horizontally.
Definition: Fl_Valuator.H:31
Fl_Valuator::range
void range(double a, double b)
Definition: Fl_Valuator.H:104
Fl_Valuator::step
double step() const
Definition: Fl_Valuator.H:121
max
static int max(int i1, int i2)
Definition: Fl_Text_Buffer.cxx:58
Fl_Valuator::maximum
void maximum(double a)
Definition: Fl_Valuator.H:83
Fl_Widget
Definition: Fl_Widget.H:101
Fl_Valuator::minimum
double minimum() const
Definition: Fl_Valuator.H:77
Fl_Valuator::horizontal
int horizontal() const
Definition: Fl_Valuator.H:58
Fl_Valuator
Definition: Fl_Valuator.H:49
Fl_Valuator::B
int B
Definition: Fl_Valuator.H:54
Fl_Valuator::set_value
void set_value(double v)
Definition: Fl_Valuator.H:70
Fl_Widget::type
uchar type() const
Definition: Fl_Widget.H:274
Y
static int Y
Definition: Fl_Tooltip.cxx:76
Fl_Valuator::previous_value_
double previous_value_
Definition: Fl_Valuator.H:52
Fl_Valuator::step
void step(int a)
Definition: Fl_Valuator.H:106
Fl_Valuator::handle_push
void handle_push()
Definition: Fl_Valuator.H:64
Fl_Valuator::bounds
void bounds(double a, double b)
Definition: Fl_Valuator.H:75