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





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,10 @@
 void Widget::draw_label(const Rectangle& ir, Flags flags) const {
   const Symbol* img = image();
 
+  int *cols = (int *)column_widths_; // Pointer to walk thru column widths.
+  int saved_colw = 0; // Save first column width.
+  if (cols) saved_colw = cols[0];
+
   Rectangle r(ir);
   if (img) {
 
@@ -207,14 +211,20 @@
       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) {
+       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

Reply via email to