FLTK 1.4.5: Fl_Counter.H Source File

FLTK 1.4.5

Loading...
Searching...
No Matches
Fl_Counter.H
1//
2// Counter header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2022 by Bill Spitzak and others.
5//
6// This library is free software. Distribution and use rights are outlined in
7// the file "COPYING" which should have been included with this file. If this
8// file is missing or damaged, see the license at:
9//
10// https://www.fltk.org/COPYING.php
11//
12// Please see the following page on how to report bugs and issues:
13//
14// https://www.fltk.org/bugs.php
15//
16
17/* \file
18 Fl_Counter widget . */
19
20// A numerical value with up/down step buttons. From Forms.
21
22#ifndef Fl_Counter_H
23#define Fl_Counter_H
24
25#ifndef Fl_Valuator_H
26#include "Fl_Valuator.H"
27#endif
28
29// values for type():
30#define FL_NORMAL_COUNTER 0
31#define FL_SIMPLE_COUNTER 1
32
44 class FL_EXPORT Fl_Counter : public Fl_Valuator {
45
46 Fl_Font textfont_;
47 Fl_Fontsize textsize_;
48 Fl_Color textcolor_;
49 double lstep_;
50 uchar mouseobj_;
51 static void repeat_callback(void *);
52 int calc_mouseobj();
53 void increment_cb();
54
55protected:
56
57 void draw() FL_OVERRIDE;
58 // compute widths of arrow boxes
59 void arrow_widths(int &w1, int &w2);
60
61public:
62
63 int handle(int) FL_OVERRIDE;
64
65 Fl_Counter(int X, int Y, int W, int H, const char* L = 0);
66 ~Fl_Counter();
67
73 void lstep(double a) {lstep_ = a;}
74
79 void step(double a,double b) {Fl_Valuator::step(a); lstep_ = b;}
80
85 void step(double a) {Fl_Valuator::step(a);}
86
90 double step() const {return Fl_Valuator::step();}
91
93 Fl_Font textfont() const {return textfont_;}
95 void textfont(Fl_Font s) {textfont_ = s;}
96
98 Fl_Fontsize textsize() const {return textsize_;}
100 void textsize(Fl_Fontsize s) {textsize_ = s;}
101
103 Fl_Color textcolor() const {return textcolor_;}
105 void textcolor(Fl_Color s) {textcolor_ = s;}
106
107};
108
109#endif
Fl_Font
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1063
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Fontsize
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1092
Fl_Counter::textfont
void textfont(Fl_Font s)
Sets the text font to s.
Definition Fl_Counter.H:95
Fl_Counter::lstep
void lstep(double a)
Sets the increment for the large step buttons.
Definition Fl_Counter.H:73
Fl_Counter::step
void step(double a, double b)
Sets the increments for the normal and large step buttons.
Definition Fl_Counter.H:79
Fl_Counter::textsize
void textsize(Fl_Fontsize s)
Sets the font size to s.
Definition Fl_Counter.H:100
Fl_Counter::textsize
Fl_Fontsize textsize() const
Gets the font size.
Definition Fl_Counter.H:98
Fl_Counter::step
double step() const
Returns the increment for normal step buttons.
Definition Fl_Counter.H:90
Fl_Counter::textfont
Fl_Font textfont() const
Gets the text font.
Definition Fl_Counter.H:93
Fl_Counter::arrow_widths
void arrow_widths(int &w1, int &w2)
Compute sizes (widths) of arrow boxes.
Definition Fl_Counter.cxx:56
Fl_Counter::textcolor
void textcolor(Fl_Color s)
Sets the font color to s.
Definition Fl_Counter.H:105
Fl_Counter::step
void step(double a)
Sets the increment for the normal step buttons.
Definition Fl_Counter.H:85
Fl_Counter::textcolor
Fl_Color textcolor() const
Gets the font color.
Definition Fl_Counter.H:103
Fl_Counter::Fl_Counter
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:244
Fl_Valuator::step
double step() const
Gets or sets the step value.
Definition Fl_Valuator.H:121
Fl_Valuator::Fl_Valuator
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:26
Fl_Widget::draw
virtual void draw()=0
Draws the widget.
Fl_Widget::handle
virtual int handle(int event)
Handles the specified event.
Definition Fl_Widget.cxx:102
FL_OVERRIDE
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30