Fltk Boxtypes

The type Fl_Boxtype stored and returned in Fl_Widget::box() is an enumeration defined in <FL/Enumerations.H>:

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);

Making your own Boxtypes

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);

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);

(back to contents)