Normally a border box is drawn by a rectangle using an unique linestyle
like "SOLID, 1". But when I just compiled my datasheet for windows
(containing a lot of boxes) it looks strange, because the top and left
line is drawn in a thick way (like "SOLID, 2") and the right and bottom
line is drawn in normal border way.
Okay, I thought of a typical windows linestyle problem and took a look
into the code inside of fl_boxtype.cxx. But all the border lines are
drawn by a single fl_rect(), so there shouldn't be different linestyles.
But when trying a FL_BORDER_FRAME, it appears the desired way. The
difference is second inner rect and when I patched it out, all the
borders appear in thick way, so the second set of rect was ment to wipe
thickness out for border box. But regarding to the code it should work,
doesn't it?
Because there were linestyles in my mind, next approach was to add
fl_line_style(FL_SOLID, 1) after settings of fl_color() and this seems
to do the job, because also other boxtypes seem to be okay.
Do you mind this to be the appropriate patch? Anyway I'm wondering,
where the problem comes from - should't linestyle get lost by setting of
colour? To me it seems, first rect starts with wrong linestyle, but
where does it come from? And why is it wiped out only on bottom and left
side?
/**
Draws a bounded rectangle with a given position, size and color.
Equivalent to drawing a box of type FL_BORDER_BOX.
*/
void fl_rectbound(int x, int y, int w, int h, Fl_Color bgcolor) {
fl_color(draw_it_active ? FL_BLACK : fl_inactive(FL_BLACK));
>> fl_line_style(FL_SOLID, 1);
fl_rect(x, y, w, h);
fl_color(draw_it_active ? bgcolor : fl_inactive(bgcolor));
>> fl_line_style(FL_SOLID, 1);
fl_rectf(x+1, y+1, w-2, h-2);
}
#define fl_border_box fl_rectbound /**< allow consistent naming */
/**
Draws a frame of type FL_BORDER_FRAME.
*/
void fl_border_frame(int x, int y, int w, int h, Fl_Color c) {
fl_color(draw_it_active ? c : fl_inactive(c));
fl_rect(x, y, w, h);
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk