FLTK 1.4.0
Loading...
Searching...
No Matches
Fl_Value_Slider.H
1//
2// Value Slider 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_Value_Slider widget . */
19
20#ifndef Fl_Value_Slider_H
21#define Fl_Value_Slider_H
22
23#include "Fl_Slider.H"
24
31class FL_EXPORT Fl_Value_Slider : public Fl_Slider {
32 Fl_Font textfont_;
33 Fl_Fontsize textsize_;
34 Fl_Color textcolor_;
35 short value_width_;
36 short value_height_;
37
38protected:
39 void draw() FL_OVERRIDE;
40
41public:
42 int handle(int) FL_OVERRIDE;
43 Fl_Value_Slider(int x, int y, int w, int h, const char *l = 0);
44
46 Fl_Font textfont() const { return textfont_; }
47
49 void textfont(Fl_Font s) { textfont_ = s; }
50
52 Fl_Fontsize textsize() const { return textsize_; }
53
55 void textsize(Fl_Fontsize s) { textsize_ = s; }
56
58 Fl_Color textcolor() const { return textcolor_; }
59
61 void textcolor(Fl_Color s) { textcolor_ = s; }
62
78 void value_width(int s) {
79 if (s > w() - 10)
80 s = w() - 10;
81 if (s < 10)
82 s = 10;
83 value_width_ = (short)s;
84 }
85
90 int value_width() const { return (value_width_); }
91
107 void value_height(int s) {
108 if (s > h() - 10)
109 s = h() - 10;
110 if (s < 10)
111 s = 10;
112 value_height_ = (short)s;
113 }
118 int value_height() const { return (value_height_); }
119};
120
121#endif
int Fl_Font
A font number is an index into the internal font table.
Definition Enumerations.H:1044
unsigned int Fl_Color
An FLTK color value; see also Colors
Definition Enumerations.H:1101
int Fl_Fontsize
Size of a font in pixels.
Definition Enumerations.H:1073
The Fl_Slider widget contains a sliding knob inside a box.
Definition Fl_Slider.H:59
void draw() FL_OVERRIDE
Draws the widget.
Definition Fl_Slider.cxx:211
The Fl_Value_Slider widget is a Fl_Slider widget with a box displaying the current value.
Definition Fl_Value_Slider.H:31
void textfont(Fl_Font s)
Sets the typeface of the text in the value box.
Definition Fl_Value_Slider.H:49
void value_height(int s)
Sets the height of the value box in pixels (vertical mode only).
Definition Fl_Value_Slider.H:107
Fl_Font textfont() const
Gets the typeface of the text in the value box.
Definition Fl_Value_Slider.H:46
int value_height() const
Gets the height of the value box in pixels (vertical mode only).
Definition Fl_Value_Slider.H:118
void textcolor(Fl_Color s)
Sets the color of the text in the value box.
Definition Fl_Value_Slider.H:61
Fl_Fontsize textsize() const
Gets the size of the text in the value box.
Definition Fl_Value_Slider.H:52
void value_width(int s)
Sets the width of the value box in pixels (horizontal mode only).
Definition Fl_Value_Slider.H:78
void textsize(Fl_Fontsize s)
Sets the size of the text in the value box.
Definition Fl_Value_Slider.H:55
Fl_Color textcolor() const
Gets the color of the text in the value box.
Definition Fl_Value_Slider.H:58
int value_width() const
Gets the width of the value box in pixels (horizontal mode only).
Definition Fl_Value_Slider.H:90
int h() const
Gets the widget height.
Definition Fl_Widget.H:368
int w() const
Gets the widget width.
Definition Fl_Widget.H:363
#define FL_OVERRIDE
This macro makes it safe to use the C++11 keyword override with older compilers.
Definition fl_attr.h:46