2 /*******************************************************************************/
3 /* Copyright (C) 2012 Jonathan Moore Liles */
4 /* Copyright (C) 2001-2005 by Colin Jones */
6 /* This program is free software; you can redistribute it and/or modify it */
7 /* under the terms of the GNU General Public License as published by the */
8 /* Free Software Foundation; either version 2 of the License, or (at your */
9 /* option) any later version. */
11 /* This program is distributed in the hope that it will be useful, but WITHOUT */
12 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
13 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for */
16 /* You should have received a copy of the GNU General Public License along */
17 /* with This program; see the file COPYING. If not,write to the Free Software */
18 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 /*******************************************************************************/
21 /* Taken from the "Gleam" FLTK scheme, as modified by prodatum */
24 #include <FL/fl_draw.H>
26 #include "FL/Fl_Theme.H"
28 static void gleam_color(Fl_Color c
)
30 if (Fl::draw_box_active())
33 fl_color(fl_inactive(c
));
35 static void frame_rect(int x
, int y
, int w
, int h
, Fl_Color bc
)
38 // Draw the outline around the perimeter of the box
39 fl_color(fl_color_average(FL_BLACK
, FL_BACKGROUND_COLOR
, .1));
40 fl_line(x
, y
, x
+ w
, y
);
41 fl_line(x
+ w
, y
, x
+ w
, y
+ h
);
42 fl_line(x
+ w
, y
+ h
, x
, y
+ h
);
43 fl_line(x
, y
+ h
, x
, y
);
47 static void shade_rect_up(int x
, int y
, int w
, int h
, Fl_Color bc
)
50 const float third
= 5;
52 fl_rectf(x
, y
, w
, third
+ 1);
53 const float step_size
= 0.10;
56 for (; j
< third
; k
-= step_size
, j
++ )
58 gleam_color(fl_color_average( FL_WHITE
, bc
, k
));
59 fl_line(x
, y
+ j
, x
+ w
- 1, y
+ j
);
63 fl_rectf( x
, y
+ j
, x
+ w
- 1, h
- j
);
66 static void frame_rect_up(int x
, int y
, int w
, int h
, Fl_Color bc
)
69 // Draw the outline around the perimeter of the box
71 fl_line(x
, y
, x
+ w
, y
); //Go across.
72 fl_line(x
, y
+ (h
/ 2), x
, y
+ 1); //Go to top
73 fl_line(x
+ w
, y
+ (h
/ 2), x
+ w
, y
+ 1); //Go to top
75 gleam_color(fl_darker(bc
));
76 fl_line(x
, y
+ h
, x
+ w
, y
+ h
); //Go across again!
77 fl_line(x
, y
+ (h
/ 2), x
, y
+ h
- 1); //Go to top
78 fl_line(x
+ w
, y
+ (h
/ 2), x
+ w
, y
+ h
- 1); //Go to top
82 static void frame_rect_down(int x
, int y
, int w
, int h
, Fl_Color bc
)
85 // Draw the outline around the perimeter of the box
86 gleam_color(fl_darker(bc
));
87 fl_line(x
, y
, x
+ w
, y
); //Go across.
88 fl_line(x
, y
+ (h
/ 2), x
, y
+ 1); //Go to top
89 fl_line(x
+ w
, y
+ (h
/ 2), x
+ w
, y
+ 1); //Go to top
92 fl_line(x
, y
+ h
, x
+ w
, y
+ h
); //Go across again!
93 fl_line(x
, y
+ (h
/ 2), x
, y
+ h
- 1); //Go to top
94 fl_line(x
+ w
, y
+ (h
/ 2), x
+ w
, y
+ h
- 1); //Go to top
98 static void shade_rect_down(int x
, int y
, int w
, int h
, Fl_Color bc
)
102 Fl_Color color
= fl_color();
103 fl_rectf(x
, y
, w
, h
);
104 gleam_color(fl_color_average(bc
, fl_darker(color
), 0.65));
105 fl_line(x
, y
+ 1, x
+ w
, y
+ 1);
106 fl_line(x
, y
+ 1, x
, y
+ h
- 2);
107 gleam_color(fl_color_average(bc
, fl_darker(color
), 0.85));
108 fl_line(x
+ 1, y
+ 2, x
+ w
, y
+ 2);
109 fl_line(x
+ 1, y
+ 2, x
+ 1, y
+ h
- 2);
113 static void up_frame(int x
, int y
, int w
, int h
, Fl_Color c
)
115 frame_rect_up(x
, y
, w
- 1, h
- 1, fl_darker(c
));
118 static void up_box(int x
, int y
, int w
, int h
, Fl_Color c
)
120 shade_rect_up(x
+ 1, y
, w
- 2, h
- 1, c
);
121 frame_rect_up(x
, y
, w
- 1, h
- 1, fl_darker(c
));
122 //draw the inner rect.
123 frame_rect(x
+ 1, y
+ 1, w
- 3, h
- 3, fl_color_average(c
, FL_WHITE
, .25f
));
127 static void down_frame(int x
, int y
, int w
, int h
, Fl_Color c
)
129 frame_rect_down(x
, y
, w
- 1, h
- 1, fl_darker(c
));
132 static void down_box(int x
, int y
, int w
, int h
, Fl_Color c
)
134 shade_rect_down(x
+ 1, y
, w
- 2, h
,
135 FL_BACKGROUND_COLOR
== c
|| FL_BACKGROUND2_COLOR
== c
138 down_frame(x
, y
, w
, h
, fl_darker(c
));
139 //draw the inner rect.
140 //frame_rect(x + 1, y + 1, w - 3, h - 3, fl_color_average(c, FL_BLACK, .65));
144 static void border_box(int x
, int y
, int w
, int h
, Fl_Color c
)
148 gleam_color(fl_darker(c
));
149 fl_rect(x
+1,y
+1,w
-2,h
-2);
155 /* replace the gtk+ boxes... (is there a better way?) */
156 Fl::set_boxtype( FL_UP_BOX
, up_box
, 2,2,4,4 );
157 Fl::set_boxtype( FL_DOWN_BOX
, down_box
, 2,2,3,3 );
158 Fl::set_boxtype( FL_THIN_UP_BOX
, up_box
, 2,2,3,3 );
159 Fl::set_boxtype( FL_THIN_DOWN_BOX
, down_box
, 2,2,3,3 );
160 Fl::set_boxtype( FL_UP_FRAME
, up_frame
, 2,2,3,3 );
161 Fl::set_boxtype( FL_DOWN_FRAME
, down_frame
, 2,2,3,3 );
162 Fl::set_boxtype( FL_ROUND_UP_BOX
, up_box
, 2,2,3,3 );
163 Fl::set_boxtype( FL_ROUND_DOWN_BOX
, down_box
, 2,2,3,3 );
164 Fl::set_boxtype( FL_BORDER_BOX
, border_box
, 1,1,2,2 );
168 init_gleam_theme ( void )
170 Fl_Theme
*t
= new Fl_Theme( "Gleam", "", "", init_theme
);