2 // "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
4 // Counter header file for the Fast Light Tool Kit (FLTK).
6 // Copyright 1998-2010 by Bill Spitzak and others.
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
29 Fl_Counter widget . */
31 // A numerical value with up/down step buttons. From Forms.
37 #include "Fl_Valuator.H"
41 #define FL_NORMAL_COUNTER 0 /**< type() for counter with fast buttons */
42 #define FL_SIMPLE_COUNTER 1 /**< type() for counter without fast buttons */
45 Controls a single floating point value with button (or keyboard) arrows.
46 Double arrows buttons achieve larger steps than simple arrows.
47 \see Fl_Spinner for value input with vertical step arrows.
48 <P align=center>\image html counter.png</P>
49 \image latex counter.png "Fl_Counter" width=4cm
51 \todo Refactor the doxygen comments for Fl_Counter type() documentation.
53 The type of an Fl_Counter object can be set using type(uchar t) to:
54 \li \c FL_NORMAL_COUNTER: Displays a counter with 4 arrow buttons.
55 \li \c FL_SIMPLE_COUNTER: Displays a counter with only 2 arrow buttons.
57 class FL_EXPORT Fl_Counter : public Fl_Valuator {
60 Fl_Fontsize textsize_;
64 static void repeat_callback(void *);
76 Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
80 Sets the increment for the large step buttons.
81 The default value is 1.0.
82 \param[in] a large step increment.
84 void lstep(double a) {lstep_ = a;}
87 Sets the increments for the normal and large step buttons.
88 \param[in] a, b normal and large step increments.
90 void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
93 Sets the increment for the normal step buttons.
94 \param[in] a normal step increment.
96 void step(double a) {Fl_Valuator::step(a);}
99 Returns the increment for normal step buttons.
101 double step() const {return Fl_Valuator::step();}
103 /** Gets the text font */
104 Fl_Font textfont() const {return textfont_;}
105 /** Sets the text font to \p s */
106 void textfont(Fl_Font s) {textfont_ = s;}
108 /** Gets the font size */
109 Fl_Fontsize textsize() const {return textsize_;}
110 /** Sets the font size to \p s */
111 void textsize(Fl_Fontsize s) {textsize_ = s;}
113 /** Gets the font color */
114 Fl_Color textcolor() const {return textcolor_;}
115 /** Sets the font color to \p s */
116 void textcolor(Fl_Color s) {textcolor_ = s;}
123 // End of "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $".