From d77813a1742ae6fa94b4adab74214da158cc0efe Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 7 Mar 2015 13:01:14 +0000 Subject: 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 --- src/Fl_Window_shape.cxx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Fl_Window_shape.cxx b/src/Fl_Window_shape.cxx index 9da04bfce..c3dc21aae 100644 --- a/src/Fl_Window_shape.cxx +++ b/src/Fl_Window_shape.cxx @@ -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(); -- cgit v1.2.3