NTK 1.3.0
Fl_Button.H
1//
2// "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $"
3//
4// Button 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_Button widget . */
30
31#ifndef Fl_Button_H
32#define Fl_Button_H
33
34#ifndef Fl_Widget_H
35#include "Fl_Widget.H"
36#endif
37
38// values for type()
39#define FL_NORMAL_BUTTON 0
41#define FL_TOGGLE_BUTTON 1
42#define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
45#define FL_HIDDEN_BUTTON 3
46
47extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
48
50
84class FL_EXPORT Fl_Button : public Fl_Widget {
85
86 int shortcut_;
87 char value_;
88 char oldval;
89 uchar down_box_;
90
91protected:
92
93 static Fl_Widget_Tracker *key_release_tracker;
94 static void key_release_timeout(void*);
95 void simulate_key_action();
96
97 virtual void draw();
98
99public:
100
101 virtual int handle(int);
102
103 Fl_Button(int X, int Y, int W, int H, const char *L = 0);
104
105 int value(int v);
106
110 char value() const {return value_;}
111
116 int set() {return value(1);}
117
122 int clear() {return value(0);}
123
124 void setonly(); // this should only be called on FL_RADIO_BUTTONs
125
130 int shortcut() const {return shortcut_;}
131
151 void shortcut(int s) {shortcut_ = s;}
152
157 Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
158
164 void down_box(Fl_Boxtype b) {down_box_ = b;}
165
167 void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
168
171
173 void down_color(unsigned c) {selection_color(c);}
174};
175
176#endif
177
178//
179// End of "$Id: Fl_Button.H 7903 2010-11-28 21:06:39Z matt $".
180//
unsigned int Fl_Color
an FLTK color value
Definition: Enumerations.H:764
Fl_Boxtype
Definition: Enumerations.H:472
Fl_Widget, Fl_Label classes .
Buttons generate callbacks when they are clicked by the user.
Definition: Fl_Button.H:84
int clear()
Same as value(0).
Definition: Fl_Button.H:122
void shortcut(const char *s)
(for backwards compatibility)
Definition: Fl_Button.H:167
Fl_Color down_color() const
(for backwards compatibility)
Definition: Fl_Button.H:170
void down_box(Fl_Boxtype b)
Sets the down box type.
Definition: Fl_Button.H:164
int set()
Same as value(1).
Definition: Fl_Button.H:116
char value() const
Returns the current value of the button (0 or 1).
Definition: Fl_Button.H:110
void shortcut(int s)
Sets the shortcut key to s.
Definition: Fl_Button.H:151
int shortcut() const
Returns the current shortcut key for the button.
Definition: Fl_Button.H:130
Fl_Boxtype down_box() const
Returns the current down box type, which is drawn when value() is non-zero.
Definition: Fl_Button.H:157
void down_color(unsigned c)
(for backwards compatibility)
Definition: Fl_Button.H:173
This class should be used to control safe widget deletion.
Definition: Fl.H:1116
Fl_Widget is the base class for all widgets in FLTK.
Definition: Fl_Widget.H:111
virtual void draw()=0
Draws the widget.
virtual int handle(int event)
Handles the specified event.
Definition: Fl_Widget.cxx:106
Fl_Color selection_color() const
Gets the selection color.
Definition: Fl_Widget.H:394
unsigned int Fl_Shortcut
24-bit Unicode character + 8-bit indicator for keyboard flags
Definition: fl_types.h:55
unsigned char uchar
unsigned char
Definition: fl_types.h:39
FL_EXPORT unsigned int fl_old_shortcut(const char *s)
Emulation of XForms named shortcuts.
Definition: fl_shortcut.cxx:284