NTK 1.3.0
Fl_Counter.H
1//
2// "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $"
3//
4// Counter 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; 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.
12//
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.
17//
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
21// USA.
22//
23// Please report all bugs and problems on the following page:
24//
25// http://www.fltk.org/str.php
26//
27
28/* \file
29 Fl_Counter widget . */
30
31// A numerical value with up/down step buttons. From Forms.
32
33#ifndef Fl_Counter_H
34#define Fl_Counter_H
35
36#ifndef Fl_Valuator_H
37#include "Fl_Valuator.H"
38#endif
39
40// values for type():
41#define FL_NORMAL_COUNTER 0
42#define FL_SIMPLE_COUNTER 1
43
57class FL_EXPORT Fl_Counter : public Fl_Valuator {
58
59 Fl_Font textfont_;
60 Fl_Fontsize textsize_;
61 Fl_Color textcolor_;
62 double lstep_;
63 uchar mouseobj;
64 static void repeat_callback(void *);
65 int calc_mouseobj();
66 void increment_cb();
67
68protected:
69
70 void draw();
71
72public:
73
74 int handle(int);
75
76 Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
78
84 void lstep(double a) {lstep_ = a;}
85
90 void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
91
96 void step(double a) {Fl_Valuator::step(a);}
97
101 double step() const {return Fl_Valuator::step();}
102
104 Fl_Font textfont() const {return textfont_;}
106 void textfont(Fl_Font s) {textfont_ = s;}
107
109 Fl_Fontsize textsize() const {return textsize_;}
111 void textsize(Fl_Fontsize s) {textsize_ = s;}
112
114 Fl_Color textcolor() const {return textcolor_;}
116 void textcolor(Fl_Color s) {textcolor_ = s;}
117
118};
119
120#endif
121
122//
123// End of "$Id: Fl_Counter.H 7981 2010-12-08 23:53:04Z greg.ercolano $".
124//
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:707
unsigned int Fl_Color
an FLTK color value
Definition Enumerations.H:764
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:736
void textfont(Fl_Font s)
Sets the text font to s.
Definition Fl_Counter.H:106
void lstep(double a)
Sets the increment for the large step buttons.
Definition Fl_Counter.H:84
void step(double a, double b)
Sets the increments for the normal and large step buttons.
Definition Fl_Counter.H:90
void textsize(Fl_Fontsize s)
Sets the font size to s.
Definition Fl_Counter.H:111
Fl_Fontsize textsize() const
Gets the font size.
Definition Fl_Counter.H:109
double step() const
Returns the increment for normal step buttons.
Definition Fl_Counter.H:101
Fl_Font textfont() const
Gets the text font.
Definition Fl_Counter.H:104
void textcolor(Fl_Color s)
Sets the font color to s.
Definition Fl_Counter.H:116
void step(double a)
Sets the increment for the normal step buttons.
Definition Fl_Counter.H:96
Fl_Color textcolor() const
Gets the font color.
Definition Fl_Counter.H:114
Fl_Counter(int X, int Y, int W, int H, const char *L=0)
Creates a new Fl_Counter widget using the given position, size, and label string.
Definition Fl_Counter.cxx:195
double step() const
Gets or sets the step value.
Definition Fl_Valuator.H:127
Fl_Valuator(int X, int Y, int W, int H, const char *L)
Creates a new Fl_Valuator widget using the given position, size, and label string.
Definition Fl_Valuator.cxx:37
virtual void draw()=0
Draws the widget.
virtual int handle(int event)
Handles the specified event.
Definition Fl_Widget.cxx:106
unsigned char uchar
unsigned char
Definition fl_types.h:39