FLTK 1.3.5
Fl_Button.H
1 //
2 // "$Id$"
3 //
4 // Button header file for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2014 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 /* \file
20  Fl_Button widget . */
21 
22 #ifndef Fl_Button_H
23 #define Fl_Button_H
24 
25 #ifndef Fl_Widget_H
26 #include "Fl_Widget.H"
27 #endif
28 
29 // values for type()
30 #define FL_NORMAL_BUTTON 0
32 #define FL_TOGGLE_BUTTON 1
33 #define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2)
36 #define FL_HIDDEN_BUTTON 3
37 
38 extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
39 
40 class Fl_Widget_Tracker;
41 
76 class FL_EXPORT Fl_Button : public Fl_Widget {
77 
78  int shortcut_;
79  char value_;
80  char oldval;
81  uchar down_box_;
82 
83 protected:
84 
85  static Fl_Widget_Tracker *key_release_tracker;
86  static void key_release_timeout(void*);
87  void simulate_key_action();
88 
89  virtual void draw();
90 
91 public:
92 
93  virtual int handle(int);
94 
95  Fl_Button(int X, int Y, int W, int H, const char *L = 0);
96 
97  int value(int v);
98 
102  char value() const {return value_;}
103 
108  int set() {return value(1);}
109 
114  int clear() {return value(0);}
115 
116  void setonly(); // this should only be called on FL_RADIO_BUTTONs
122  int shortcut() const {return shortcut_;}
123 
143  void shortcut(int s) {shortcut_ = s;}
144 
149  Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;}
150 
160  void down_box(Fl_Boxtype b) {down_box_ = b;}
161 
163  void shortcut(const char *s) {shortcut(fl_old_shortcut(s));}
164 
166  Fl_Color down_color() const {return selection_color();}
167 
169  void down_color(unsigned c) {selection_color(c);}
170 };
171 
172 #endif
173 
174 //
175 // End of "$Id$".
176 //