FLTK 1.3.2
|
00001 // 00002 // "$Id$" 00003 // 00004 // Button header file for the Fast Light Tool Kit (FLTK). 00005 // 00006 // Copyright 1998-2010 by Bill Spitzak and others. 00007 // 00008 // This library is free software. Distribution and use rights are outlined in 00009 // the file "COPYING" which should have been included with this file. If this 00010 // file is missing or damaged, see the license at: 00011 // 00012 // http://www.fltk.org/COPYING.php 00013 // 00014 // Please report all bugs and problems on the following page: 00015 // 00016 // http://www.fltk.org/str.php 00017 // 00018 00019 /* \file 00020 Fl_Button widget . */ 00021 00022 #ifndef Fl_Button_H 00023 #define Fl_Button_H 00024 00025 #ifndef Fl_Widget_H 00026 #include "Fl_Widget.H" 00027 #endif 00028 00029 // values for type() 00030 #define FL_NORMAL_BUTTON 0 00032 #define FL_TOGGLE_BUTTON 1 ///< value() toggles between 0 and 1 at every click of the button 00033 #define FL_RADIO_BUTTON (FL_RESERVED_TYPE+2) 00036 #define FL_HIDDEN_BUTTON 3 ///< for Forms compatibility 00037 00038 extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*); 00039 00040 class Fl_Widget_Tracker; 00041 00075 class FL_EXPORT Fl_Button : public Fl_Widget { 00076 00077 int shortcut_; 00078 char value_; 00079 char oldval; 00080 uchar down_box_; 00081 00082 protected: 00083 00084 static Fl_Widget_Tracker *key_release_tracker; 00085 static void key_release_timeout(void*); 00086 void simulate_key_action(); 00087 00088 virtual void draw(); 00089 00090 public: 00091 00092 virtual int handle(int); 00093 00094 Fl_Button(int X, int Y, int W, int H, const char *L = 0); 00095 00096 int value(int v); 00097 00101 char value() const {return value_;} 00102 00107 int set() {return value(1);} 00108 00113 int clear() {return value(0);} 00114 00115 void setonly(); // this should only be called on FL_RADIO_BUTTONs 00116 00121 int shortcut() const {return shortcut_;} 00122 00142 void shortcut(int s) {shortcut_ = s;} 00143 00148 Fl_Boxtype down_box() const {return (Fl_Boxtype)down_box_;} 00149 00155 void down_box(Fl_Boxtype b) {down_box_ = b;} 00156 00158 void shortcut(const char *s) {shortcut(fl_old_shortcut(s));} 00159 00161 Fl_Color down_color() const {return selection_color();} 00162 00164 void down_color(unsigned c) {selection_color(c);} 00165 }; 00166 00167 #endif 00168 00169 // 00170 // End of "$Id$". 00171 //