summaryrefslogtreecommitdiff
path: root/FL
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2024-08-14 01:45:20 +0200
committerMatthias Melcher <github@matthiasm.com>2024-08-14 01:52:37 +0200
commitcfc54a3b190dd7e85d6e2a313ab67d3ded4a4ab8 (patch)
treee3c619c02f391079bbf0fba72032e05ff1b25421 /FL
parent325ac336c74e27037c3bfe0d8517be369f632aa9 (diff)
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
Diffstat (limited to 'FL')
-rw-r--r--FL/Fl_Widget.H13
-rw-r--r--FL/fl_draw.H4
2 files changed, 15 insertions, 2 deletions
diff --git a/FL/Fl_Widget.H b/FL/Fl_Widget.H
index cc616bcf0..7dc90069c 100644
--- a/FL/Fl_Widget.H
+++ b/FL/Fl_Widget.H
@@ -63,6 +63,8 @@ struct FL_EXPORT Fl_Label {
Fl_Align align_;
/** type of label. \see Fl_Labeltype */
uchar type;
+ /** Spacing between an image and the label text */
+ uchar spacing;
/** Draws the label aligned to the given box */
void draw(int,int,int,int, Fl_Align) const ;
@@ -685,6 +687,17 @@ public:
*/
void bind_deimage(int f) { if (f) set_flag(DEIMAGE_BOUND); else clear_flag(DEIMAGE_BOUND); }
+ /** Set the gap between the label and the image in pixels.
+ This value is limited to 0..255.
+ \param[in] gap spacing in pixels
+ */
+ void label_image_spacing(int gap) { label_.spacing = (uchar)gap; }
+
+ /** Return the gap size between the label and the image.
+ \return spacing in pixels
+ */
+ int label_image_spacing() { return label_.spacing; }
+
/** Gets the current tooltip text.
\return a pointer to the tooltip text or NULL
\see tooltip(const char*), copy_tooltip(const char*)
diff --git a/FL/fl_draw.H b/FL/fl_draw.H
index b158f7253..efb0b4d15 100644
--- a/FL/fl_draw.H
+++ b/FL/fl_draw.H
@@ -977,10 +977,10 @@ inline void fl_rtl_draw(const char *str, int n, int x, int y) {
FL_EXPORT void fl_measure(const char *str, int &x, int &y, int draw_symbols = 1);
FL_EXPORT void fl_draw(const char *str, int x, int y, int w, int h,
Fl_Align align, Fl_Image *img = 0,
- int draw_symbols = 1, int gap = 0);
+ int draw_symbols = 1, int spacing = 0);
FL_EXPORT void fl_draw(const char *str, int x, int y, int w, int h, Fl_Align align,
void (*callthis)(const char *, int, int, int),
- Fl_Image *img = 0, int draw_symbols = 1, int gap = 0);
+ Fl_Image *img = 0, int draw_symbols = 1, int spacing = 0);
// boxtypes: