From cfc54a3b190dd7e85d6e2a313ab67d3ded4a4ab8 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Wed, 14 Aug 2024 01:45:20 +0200 Subject: Adding Fl_Widget::label_image_spacing() (#1039) - May need a better method name. - This makes the gap between the image in a label and the label text user settable. - Can be tested using test/label app --- src/fl_labeltype.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/fl_labeltype.cxx') diff --git a/src/fl_labeltype.cxx b/src/fl_labeltype.cxx index 8698c277b..9f5c5f20e 100644 --- a/src/fl_labeltype.cxx +++ b/src/fl_labeltype.cxx @@ -32,7 +32,7 @@ fl_normal_label(const Fl_Label* o, int X, int Y, int W, int H, Fl_Align align) { fl_font(o->font, o->size); fl_color((Fl_Color)o->color); - fl_draw(o->value, X, Y, W, H, align, o->image); + fl_draw(o->value, X, Y, W, H, align, o->image, 1, o->spacing); } void @@ -44,11 +44,11 @@ fl_normal_measure(const Fl_Label* o, int& W, int& H) { if (o->align_ & FL_ALIGN_IMAGE_BACKDROP) { // backdrop: ignore // ignore backdrop image for calculation } else if (o->align_ & FL_ALIGN_IMAGE_NEXT_TO_TEXT) { // text and image side by side - W += iw; + W += iw + o->spacing; if (ih > H) H = ih; } else { if (iw > W) W = iw; - H += ih; + H += ih + o->spacing; } } } -- cgit v1.2.3