FLTK 1.4.4: Fl_Button.H Source File

FLTK 1.4.4

Loading...
Searching...
No Matches
Fl_Button.H
1//
2// Button header file for the Fast Light Tool Kit (FLTK).
3//
4// Copyright 1998-2014 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_Button widget . */
19
20#ifndef Fl_Button_H
21#define Fl_Button_H
22
23#ifndef Fl_Widget_H
24#include "Fl_Widget.H"
25#endif
26
27// values for type()
28#define FL_NORMAL_BUTTON 0
30#define FL_TOGGLE_BUTTON 1
31#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
34#define FL_HIDDEN_BUTTON 3
35
36extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
37
38class Fl_Widget_Tracker;
39
75
76 class FL_EXPORT Fl_Button : public Fl_Widget {
77
78 int shortcut_;
79 char value_;
80 char oldval;
81 uchar down_box_;
82 uchar compact_;
83
84protected:
85
86 static Fl_Widget_Tracker *key_release_tracker;
87 static void key_release_timeout(void*);
88 void simulate_key_action();
89
90 void draw() FL_OVERRIDE;
91
92public:
93
94 int handle(int) FL_OVERRIDE;
95
96 Fl_Button(int X, int Y, int W, int H, const char *L = 0);
97
98 int value(int v);
99
103 char value() const {return value_;}
104
109 int set() {return value(1);}
110
115 int clear() {return value(0);}
116
117 void setonly(); // this should only be called on FL_RADIO_BUTTONs
118
123 int shortcut() const {return shortcut_;}
124
144 void shortcut(int s) {shortcut_ = s;}
145
150 Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
151
161 void down_box(Fl_Boxtype b) {down_box_ = b;}
162
164 void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
165
167 Fl_Color down_color() const {return selection_color();}
168
170 void down_color(unsigned c) {selection_color(c);}
171
172 // handle flag for compact buttons, documentation in source code
173 void compact(uchar v);
174
178 uchar compact() { return compact_; }
179};
180
181#endif
Fl_Color
unsigned int Fl_Color
An FLTK color value; see also Colors.
Definition Enumerations.H:1120
Fl_Boxtype
Fl_Boxtype
FLTK standard box types.
Definition Enumerations.H:644
Fl_Widget.H
Fl_Widget and Fl_Label classes.
Fl_Button::compact
uchar compact()
Return true if buttons are rendered as compact buttons.
Definition Fl_Button.H:178
Fl_Button::clear
int clear()
Same as value(0).
Definition Fl_Button.H:115
Fl_Button::shortcut
void shortcut(const char *s)
(for backwards compatibility)
Definition Fl_Button.H:164
Fl_Button::down_color
Fl_Color down_color() const
(for backwards compatibility)
Definition Fl_Button.H:167
Fl_Button::down_box
void down_box(Fl_Boxtype b)
Sets the down box type.
Definition Fl_Button.H:161
Fl_Button::set
int set()
Same as value(1).
Definition Fl_Button.H:109
Fl_Button::value
char value() const
Returns the current value of the button (0 or 1).
Definition Fl_Button.H:103
Fl_Button::value
int value(int v)
Sets the current value of the button.
Definition Fl_Button.cxx:40
Fl_Button::shortcut
void shortcut(int s)
Sets the shortcut key to s.
Definition Fl_Button.H:144
Fl_Button::shortcut
int shortcut() const
Returns the current shortcut key for the button.
Definition Fl_Button.H:123
Fl_Button::down_box
Fl_Boxtype down_box() const
Returns the current down box type, which is drawn when value() is non-zero.
Definition Fl_Button.H:150
Fl_Button::down_color
void down_color(unsigned c)
(for backwards compatibility)
Definition Fl_Button.H:170
Fl_Button::Fl_Button
Fl_Button(int X, int Y, int W, int H, const char *L=0)
The constructor creates the button using the given position, size, and label.
Definition Fl_Button.cxx:274
Fl_Widget_Tracker
This class should be used to control safe widget deletion.
Definition Fl.H:1575
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_Widget::selection_color
Fl_Color selection_color() const
Gets the selection color.
Definition Fl_Widget.H:473
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
Fl_Shortcut
unsigned int Fl_Shortcut
16-bit Unicode character + 8-bit indicator for keyboard flags.
Definition fl_types.h:55
uchar
unsigned char uchar
unsigned char
Definition fl_types.h:30