fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

fl_diamond_box.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Diamond box code for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2011 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 // Box drawing code for an obscure box type.
20 // These box types are in separate files so they are not linked
21 // in if not used.
22 
23 // The diamond box draws best if the area is square!
24 
25 #include <FL/Fl.H>
26 #include <FL/fl_draw.H>
27 
28 extern const uchar* fl_gray_ramp();
29 
30 static void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor) {
31  w &= -2;
32  h &= -2;
33  int x1 = x+w/2;
34  int y1 = y+h/2;
35  Fl::set_box_color(bgcolor);
36  fl_polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
37  const uchar *g = fl_gray_ramp();
38  fl_color(g[(int)'W']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
39  fl_color(g[(int)'U']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
40  fl_color(g[(int)'S']); fl_line(x+3, y1, x1, y+3, x+w-3, y1);
41  fl_color(g[(int)'P']); fl_line(x+3, y1, x1, y+h-3, x+w-3, y1);
42  fl_color(g[(int)'N']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
43  fl_color(g[(int)'H']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
44  fl_color(g[(int)'A']); fl_loop(x, y1, x1, y, x+w, y1, x1, y+h);
45 }
46 
47 static void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor) {
48  w &= -2;
49  h &= -2;
50  int x1 = x+w/2;
51  int y1 = y+h/2;
52  const uchar *g = fl_gray_ramp();
53  fl_color(g[(int)'P']); fl_line(x+0, y1, x1, y+0, x+w-0, y1);
54  fl_color(g[(int)'N']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
55  fl_color(g[(int)'H']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
56  fl_color(g[(int)'W']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
57  fl_color(g[(int)'U']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
58  fl_color(g[(int)'S']); fl_line(x+0, y1, x1, y+h-0, x+w-0, y1);
59  Fl::set_box_color(bgcolor);
60  fl_polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
61  fl_color(g[(int)'A']); fl_loop(x+3, y1, x1, y+3, x+w-3, y1, x1, y+h-3);
62 }
63 
68  return _FL_DIAMOND_UP_BOX;
69 }
70 
71 //
72 // End of "$Id$".
73 //
Fl_Box_Draw_F
void() Fl_Box_Draw_F(int x, int y, int w, int h, Fl_Color color)
Definition: Fl.H:89
Fl.H
fl_line
void fl_line(int x, int y, int x1, int y1)
Definition: fl_draw.H:223
Fl_Color
unsigned int Fl_Color
Definition: Enumerations.H:934
Fl_Boxtype
Fl_Boxtype
Definition: Enumerations.H:603
fl_color
void fl_color(Fl_Color c)
Definition: fl_draw.H:52
fl_diamond_up_box
static void fl_diamond_up_box(int x, int y, int w, int h, Fl_Color bgcolor)
Definition: fl_diamond_box.cxx:30
_FL_DIAMOND_DOWN_BOX
see figure 1
Definition: Enumerations.H:630
Fl::set_box_color
static void set_box_color(Fl_Color)
Definition: fl_boxtype.cxx:93
fl_loop
void fl_loop(int x, int y, int x1, int y1, int x2, int y2)
Definition: fl_draw.H:233
fl_draw.H
utility header to pull drawing functions together
fl_internal_boxtype
void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F *)
Definition: fl_boxtype.cxx:404
fl_gray_ramp
const uchar * fl_gray_ramp()
Definition: fl_boxtype.cxx:60
x
int x
Definition: test.c:73
y
int y
Definition: test.c:74
fl_diamond_down_box
static void fl_diamond_down_box(int x, int y, int w, int h, Fl_Color bgcolor)
Definition: fl_diamond_box.cxx:47
fl_define_FL_DIAMOND_BOX
Fl_Boxtype fl_define_FL_DIAMOND_BOX()
Definition: fl_diamond_box.cxx:65
uchar
unsigned char uchar
Definition: fl_types.h:30
_FL_DIAMOND_UP_BOX
see figure 1
Definition: Enumerations.H:629
fl_polygon
void fl_polygon(int x, int y, int x1, int y1, int x2, int y2)
Definition: fl_draw.H:244