themes: Workaround for bug where a background color of RGB 0,0,0 in Black color schem...
[ntk.git] / src / Clean_Theme.cxx
blob5640d8c22c84d7a928a1b7a47eb795df1f162c22
2 /*******************************************************************************/
3 /* Copyright (C) 2012 Jonathan Moore Liles */
4 /* Copyright (C) 2001-2005 by Colin Jones */
5 /* */
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. */
10 /* */
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 */
14 /* more details. */
15 /* */
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 */
23 #include <FL/Fl.H>
24 #include <FL/fl_draw.H>
26 #include "FL/Fl_Theme.H"
28 static void clean_color(Fl_Color c)
30 c = fl_color_average( FL_WHITE, c, 0.10f );
32 if (Fl::draw_box_active())
33 fl_color(c);
34 else
35 fl_color(fl_inactive(c));
38 static Fl_Color border_color (Fl_Color c)
40 return fl_color_average( FL_BLACK, FL_BACKGROUND_COLOR,0.70f);
43 static void rect(int x, int y, int w, int h, Fl_Color bc)
45 fl_rect( x, y, w, h, bc );
48 static void rectf ( int x, int y,int w, int h, Fl_Color bc )
50 clean_color( bc );
51 fl_rectf( x, y, w, h );
54 static void up_frame(int x, int y, int w, int h, Fl_Color c)
56 rect(x, y, w, h, border_color( c ));
59 static void up_box(int x, int y, int w, int h, Fl_Color c)
61 rectf(x, y, w, h, c );
62 rect(x, y, w, h, border_color( c ));
65 static void down_frame(int x, int y, int w, int h, Fl_Color c)
67 rect(x, y, w, h, fl_color_average( FL_BLACK, c, 0.2f ) );
70 static void down_box(int x, int y, int w, int h, Fl_Color c)
72 rectf(x, y, w, h,
73 FL_BACKGROUND_COLOR == c || FL_BACKGROUND2_COLOR == c
74 ? fl_darker(c)
75 : c );
76 rect(x, y, w, h, border_color( c ));
79 static void flat_box( int x, int y, int w, int h, Fl_Color c )
81 rectf( x, y, w, h, c );
84 static void border_box( int x, int y, int w, int h, Fl_Color c )
86 rectf( x, y, w, h, c );
87 rect(x, y, w, h, border_color( c ));
90 static void
91 init_theme ( void )
93 Fl::set_boxtype( FL_UP_BOX, up_box, 1,1,2,2 );
94 Fl::set_boxtype( FL_DOWN_BOX, down_box, 1,1,2,2 );
95 Fl::set_boxtype( FL_THIN_UP_BOX, up_box, 1,1,2,2 );
96 Fl::set_boxtype( FL_THIN_DOWN_BOX, down_box, 1,1,2,2 );
97 Fl::set_boxtype( FL_UP_FRAME, up_frame, 1,1,2,2 );
98 Fl::set_boxtype( FL_DOWN_FRAME, down_frame, 1,1,2,2 );
99 Fl::set_boxtype( FL_ROUND_UP_BOX, up_box, 1,1,2,2 );
100 Fl::set_boxtype( FL_ROUND_DOWN_BOX, down_box, 1,1,2,2 );
101 // Fl::set_boxtype( FL_FLAT_BOX, flat_box, 0, 0, 0, 0 );
102 Fl::set_boxtype( FL_BORDER_BOX, border_box, 1,1,2,2 );
105 void
106 init_clean_theme ( void )
108 Fl_Theme *t = new Fl_Theme( "Clean", "", "", init_theme );
110 Fl_Theme::add( t );