FL_NO_BOX
means nothing is drawn at all, so whatever
is already on the screen remains. The FRAME types only draw their
edges, leaving the center unchanged. In the above diagram the blue
color is the area that is not drawn by the box.
It may be useful to know: FL_NO_BOX==0
. "down"
versions of "up" boxes can be achieved by adding 1 to the box id.
"frame" versions of boxes can be achieved by adding 2 to the box id.
Many of the boxtype symbols are macros that call a function, this was done so that they are not linked in if not used. Linking in unused box types may be a problem if large numbers of them are added to fltk. See Enumerations.H.
void fl_draw_box(Fl_Boxtype b,int x,int y,int w,int h,Fl_Color)
;
int Fl::box_dx(Fl_Boxtype);
int Fl::box_dy(Fl_Boxtype);
int Fl::box_dw(Fl_Boxtype);
int Fl::box_dh(Fl_Boxtype);
You can define your own boxtypes by making a small function that
draws the box and adding a pointer to it to a table of boxtypes. Or
you can replace existing boxtypes, replacing FL_UP_BOX,
FL_DOWN_BOX
, and FL_FLAT_BOX
will allow you to
completely change the appearance of your program. You can make the
bevels thicker or thinner, change the colors of them, or use pixmaps
or maybe GL gourand shanding to make nifty shiny buttons.
typedef void (Fl_Box_Draw_F)(int, int, int, int, Fl_Color);
Here is the actual code for the FL_UP_FRAME and FL_UP_BOX types. See <FL/fl_draw.H> for the available drawing functions if you want your boxtype to be portable:
void fl_up_frame(int x, int y, int w, int h, Fl_Color) { if (w >= 3 && h >= 3) { fl_color(FL_LIGHT3); fl_xyline(x+1, y+1, x+w-2); fl_color(FL_LIGHT2); fl_yxline(x+1, y+h-2, y+2, x+w-3); fl_color(FL_LIGHT1); fl_yxline(x+2, y+h-3, y+3/*, x+w-3*/); fl_color(FL_DARK1); fl_xyline(x+2, y+h-3, x+w-3, y+3); fl_color(FL_DARK2); fl_xyline(x+1, y+h-2, x+w-2, y+2); } fl_color(FL_GRAY0); fl_rect(x,y,w,h); } void fl_up_box(int x, int y, int w, int h, Fl_Color c) { fl_up_frame(x,y,w,h,c); fl_color(c); fl_rectf(x+3,y+3,w-6,h-6); }
void Fl::set_boxtype(Fl_Boxtype n, Fl_Box_Draw_F*, uchar
dx, uchar dy, uchar dw, uchar dh);
Fl::set_boxtype(Fl_Boxtype n, Fl_Boxtype from);
Fl::set_boxtype(FL_UP_BOX,FL_THIN_UP_BOX); Fl::set_boxtype(FL_DOWN_BOX,FL_THIN_DOWN_BOX); Fl::set_boxtype(FL_UP_FRAME,FL_THIN_UP_FRAME); Fl::set_boxtype(FL_DOWN_FRAME,FL_THIN_DOWN_FRAME);