|  | // generated by Fast Light User Interface Designer (fluid) version 2.00
#include "Fl_LED_Button.H"
#include <FL/fl_draw.H>
Fl_LED_Button::Fl_LED_Button(int x, int y, int w, int h, const char* l):Fl_Light_Button(x,y,w,h,l) {
  box(FL_NO_BOX);
	down_box(FL_ROUND_DOWN_BOX);
	selection_color(FL_RED);
}
Fl_LED_Button::~Fl_LED_Button() {
}
void Fl_LED_Button::draw() {
  uchar r,g,b;
	//if (box()) draw_box(this==Fl::pushed() ? down(box()) : box(), color());
	Fl_Color col = value() ? selection_color() : color();
	Fl::get_color((Fl_Color)selection_color(),r,g,b);
	int d = h()/6;
	int W = w()<h() ? w() : h();
 
	int x1 = x()+d+2;
	int y1 = y()+d+3;
	int ww = W-2*d-6;
	int hh = W-2*d-6;
	Fl::get_color(parent()->color(),r,g,b);
	modulate(-90,r,g,b);
	fl_pie(x1-1,y1-1,ww+2,hh+2,0,360);
	Fl::get_color((Fl_Color)selection_color(),r,g,b);
	if (value()) modulate(-90,r,g,b); else modulate(-210,r,g,b);
	fl_pie(x1,y1,ww,hh,0,360);
	if (value()) modulate(-60,r,g,b); else modulate(-190,r,g,b);
	fl_pie(x1+1,y1+1,ww-2,hh-2,0,360);
	if (value()) modulate(-20,r,g,b); else modulate(-150,r,g,b);
	fl_pie(x1+1,y1+1,ww-3,hh-3,0,360);
	if (value()) modulate(0,r,g,b); else modulate(-130,r,g,b);
	fl_pie(x1+3,y1+3,ww-5,hh-5,0,360);
	if (value()) modulate(160,r,g,b); else modulate(-30,r,g,b);
	fl_arc(x1+3,y1+3,ww-5,hh-5,250,350);  
	if (value()) modulate(250,r,g,b); else modulate(100,r,g,b);
	fl_pie((int)(x1+ww/2-(0.3*ww)/2),(int)(y1+ww/2-(0.3*ww)/2),
			(int)((0.45*ww)/2),(int)((0.45*ww)/2),0,360); 
	fl_color(FL_BLACK);
	fl_arc(x1,y1,ww+1,hh+1,0,360);
	draw_label(x()+W-d, y(), w()-W+d, h());//,labelcolor());
}
void Fl_LED_Button::modulate(const int offs,const uchar r,uchar g,uchar b) {
  int rr,gg,bb;
	rr = r + offs; 
	rr = rr > 255 ? 255:rr;
	rr = rr < 0 ? 0:rr;
	gg = g + offs; 
	gg = gg > 255 ? 255:gg;
	gg = gg < 0 ? 0:gg;
	bb = b + offs; 
	bb = bb > 255 ? 255:bb;
	bb = bb < 0 ? 0:bb;
	fl_color((uchar)rr,(uchar)gg,(uchar)bb);
}
 |