themes: Workaround for bug where a background color of RGB 0,0,0 in Black color schem...
[ntk.git] / src / fl_engraved_label.cxx
blob2cd4eda1887d627ec79933e7161837ee89a2639d
1 //
2 // "$Id: fl_engraved_label.cxx 7903 2010-11-28 21:06:39Z matt $"
3 //
4 // Engraved label drawing routines for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2010 by Bill Spitzak and others.
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Library General Public
10 // License as published by the Free Software Foundation; either
11 // version 2 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Library General Public License for more details.
18 // You should have received a copy of the GNU Library General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
21 // USA.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 // Drawing code for XForms style engraved & embossed labels
30 #include <FL/Fl.H>
31 #include <FL/Fl_Widget.H>
32 #include <FL/fl_draw.H>
34 // data[] is dx, dy, color triples
36 static void innards(
37 const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align,
38 int data[][3], int n)
40 Fl_Align a1 = align;
41 if (a1 & FL_ALIGN_CLIP) {
42 fl_push_clip(X, Y, W, H); a1 = (Fl_Align)(a1&~FL_ALIGN_CLIP);}
43 fl_font((Fl_Font)o->font, o->size);
44 for (int i = 0; i < n; i++) {
45 fl_color((Fl_Color)(i < n-1 ? data[i][2] : o->color));
46 fl_draw(o->value, X+data[i][0], Y+data[i][1], W, H, a1);
48 if (align & FL_ALIGN_CLIP) fl_pop_clip();
51 static void fl_shadow_label(
52 const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
54 static int data[2][3] = {{1,1,FL_DARK3},{0,0,0}};
55 innards(o, X, Y, W, H, align, data, 2);
58 static void fl_engraved_label(
59 const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
61 fl_shadow_label( o, X, Y, W, H, align );
64 static void fl_embossed_label(
65 const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align)
67 fl_shadow_label( o, X, Y, W, H, align );
70 Fl_Labeltype fl_define_FL_SHADOW_LABEL() {
71 Fl::set_labeltype(_FL_SHADOW_LABEL, fl_shadow_label, 0);
72 return _FL_SHADOW_LABEL;
74 Fl_Labeltype fl_define_FL_ENGRAVED_LABEL() {
75 Fl::set_labeltype(_FL_ENGRAVED_LABEL, fl_engraved_label, 0);
76 return _FL_ENGRAVED_LABEL;
78 Fl_Labeltype fl_define_FL_EMBOSSED_LABEL() {
79 Fl::set_labeltype(_FL_EMBOSSED_LABEL, fl_embossed_label, 0);
80 return _FL_EMBOSSED_LABEL;
84 // End of "$Id: fl_engraved_label.cxx 7903 2010-11-28 21:06:39Z matt $".