Fix window background and label drawing ("plastic" scheme only).

There was a regression since svn r10598 because the background image width
and height were set to 0. The label drawing code erroneously used this
for positioning the label text inside the window which could be seen for
instance in test/valuators. Now the label (text) is not drawn at all.

PS: this should be fixed with a better scheme setup w/o manipulating
the window's label, labeltype, and image in a later version.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10607 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2015-03-07 13:01:14 +00:00
parent c96a330e26
commit d77813a174

View File

@ -360,13 +360,27 @@ void Fl_Window::draw() {
}
// The following is similar to Fl_Group::draw(), but ...
//
// - draws the box at (0,0), i.e. with x=0 and y=0 instead of x() and y()
// - draws the label at (0,0): this draws the background image, if any
// Note: align() *must* be set correctly for this to work as expected
// - does NOT draw the label (text)
// - draws the image only if FL_ALIGN_INSIDE is set
//
// Note: The label (text) of top level windows is drawn in the title bar.
// Other windows do not draw their labels at all, unless drawn by their
// parent widgets or by special draw() methods (derived classes).
if (damage() & ~FL_DAMAGE_CHILD) { // draw the entire thing
draw_box(box(),0,0,w(),h(),color()); // draw box with x/y = 0
draw_label(0,0,w(),h()); // draws label and/or bg image
if (image() && (align() & FL_ALIGN_INSIDE)) { // draw the image only
Fl_Label l1;
memset(&l1,0,sizeof(l1));
l1.align_ = align();
l1.image = image();
if (!active_r() && l1.image && l1.deimage) l1.image = l1.deimage;
l1.type = labeltype();
l1.draw(0,0,w(),h(),align());
}
}
draw_children();