You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.1KB

  1. # data file for the Fltk User Interface Designer (fluid)
  2. version 2.00
  3. header_name {.H}
  4. code_name {.cxx}
  5. gridx 5
  6. gridy 5
  7. snap 3
  8. decl {\#include <FL/fl_draw.H>} {}
  9. decl {\#include <FL/Fl_Light_Button.H>} {public
  10. }
  11. class Fl_LED_Button {open : {public Fl_Light_Button}
  12. } {
  13. Function {Fl_LED_Button(int x, int y, int w, int h, const char* l=0):Fl_Light_Button(x,y,w,h,l)} {open
  14. } {
  15. code {box(FL_NO_BOX);
  16. down_box(FL_ROUND_DOWN_BOX);
  17. selection_color(FL_RED);} {}
  18. }
  19. Function {~Fl_LED_Button()} {open
  20. } {}
  21. Function {draw()} {open private
  22. } {
  23. code {uchar r,g,b;
  24. if (box()) draw_box(this==Fl::pushed() ? down(box()) : box(), color());
  25. Fl_Color col = value() ? selection_color() : color();
  26. Fl::get_color((Fl_Color)selection_color(),r,g,b);
  27. int d = h()/6;
  28. int W = w()<h() ? w() : h();
  29. int x1 = x()+d+2;
  30. int y1 = y()+d+3;
  31. int ww = W-2*d-6;
  32. int hh = W-2*d-6;
  33. Fl::get_color(parent()->color(),r,g,b);
  34. modulate(-90,r,g,b);
  35. fl_pie(x1-1,y1-1,ww+2,hh+2,0,360);
  36. Fl::get_color((Fl_Color)selection_color(),r,g,b);
  37. if (value()) modulate(-90,r,g,b); else modulate(-210,r,g,b);
  38. fl_pie(x1,y1,ww,hh,0,360);
  39. if (value()) modulate(-60,r,g,b); else modulate(-190,r,g,b);
  40. fl_pie(x1+1,y1+1,ww-2,hh-2,0,360);
  41. if (value()) modulate(-20,r,g,b); else modulate(-150,r,g,b);
  42. fl_pie(x1+1,y1+1,ww-3,hh-3,0,360);
  43. if (value()) modulate(0,r,g,b); else modulate(-130,r,g,b);
  44. fl_pie(x1+3,y1+3,ww-5,hh-5,0,360);
  45. if (value()) modulate(160,r,g,b); else modulate(-30,r,g,b);
  46. fl_arc(x1+3,y1+3,ww-5,hh-5,250,350);
  47. if (value()) modulate(250,r,g,b); else modulate(100,r,g,b);
  48. fl_pie((int)(x1+ww/2-(0.3*ww)/2),(int)(y1+ww/2-(0.3*ww)/2),
  49. (int)((0.45*ww)/2),(int)((0.45*ww)/2),0,360);
  50. fl_color(FL_BLACK);
  51. fl_arc(x1,y1,ww+1,hh+1,0,360);
  52. draw_label(x()+W-d, y(), w()-W+d, h(),labelcolor());} {selected
  53. }
  54. }
  55. Function {modulate(const int offs,const uchar r,uchar g,uchar b)} {open private
  56. } {
  57. code {int rr,gg,bb;
  58. rr = r + offs;
  59. rr = rr > 255 ? 255:rr;
  60. rr = rr < 0 ? 0:rr;
  61. gg = g + offs;
  62. gg = gg > 255 ? 255:gg;
  63. gg = gg < 0 ? 0:gg;
  64. bb = b + offs;
  65. bb = bb > 255 ? 255:bb;
  66. bb = bb < 0 ? 0:bb;
  67. fl_color((uchar)rr,(uchar)gg,(uchar)bb);} {}
  68. }
  69. }