DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2231
Version: 2.0-feature
Whenever you have a multi column browser and you add an image to an item,
like this:
Browser b(...);
Widget* item=b.add(...);
item->image(an_image);
The image shifts the whole browser line and make them skewed.
I've created a patch that fixes that.
Link: http://www.fltk.org/str.php?L2231
Version: 2.0-feature
Index: src/Widget_draw.cxx
===================================================================
--- src/Widget_draw.cxx (revisão 6837)
+++ src/Widget_draw.cxx (cópia de trabalho)
@@ -139,6 +139,9 @@
void Widget::draw_label(const Rectangle& ir, Flags flags) const {
const Symbol* img = image();
+ int saved_colw = 0; // Save first column width.
+ int *cols = (int *)column_widths_; // Pointer to walk thru column widths.
+
Rectangle r(ir);
if (img) {
@@ -207,14 +210,21 @@
Rectangle ir(r, w, h, 0);
img->draw(ir);
} else {
- Rectangle ir(r, w, h, flags);
- img->draw(ir);
- // figure out the rectangle that remains for text:
- if (flags & ALIGN_TOP) r.set_y(ir.b());
- else if (flags & ALIGN_BOTTOM) r.set_b(ir.y());
- else if (flags & ALIGN_LEFT) r.set_x(ir.r());
- else if (flags & ALIGN_RIGHT) r.set_r(ir.x());
+ Rectangle ir(r, w, h, flags);
+ img->draw(ir);
+ // figure out the rectangle that remains for text:
+ if (flags & ALIGN_TOP) r.set_y(ir.b());
+ else if (flags & ALIGN_BOTTOM) r.set_b(ir.y());
+ else if (flags & ALIGN_LEFT) r.set_x(ir.r());
+ else if (flags & ALIGN_RIGHT) r.set_r(ir.x());
else r.set_y(ir.b());
+
+ // Shift first column width, so labels after 1st column are lined up
correctly.
+ if (flags & ALIGN_LEFT && cols) {
+ saved_colw = cols[0];
+ cols[0] -= ir.w();
+ if (cols[0]==0) cols[0]--;
+ }
}
}
@@ -237,6 +247,9 @@
}
if (flags & ALIGN_CLIP) pop_clip();
+
+ // Restore column width
+ if (cols) cols[0] = saved_colw;
}
/**
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs