summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2017-09-12 13:44:15 +0000
committerAlbrecht Schlosser <albrechts.fltk@online.de>2017-09-12 13:44:15 +0000
commit141c3594d27be719da816775de788cbd6797375c (patch)
tree77df4a5c6396446461341b65f694ab30c1e3248a /fluid
parenta6803d71c620f6dc81bad95f329d66a2461df714 (diff)
Fluid: remove redundant code, fix FL_IMAGE_LABEL labeltype.
Remove leading underscore from _FL_IMAGE_LABEL. Remove redundant assignment of image(). Thanks to Greg for finding these issues. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12449 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/factory.cxx16
1 files changed, 9 insertions, 7 deletions
diff --git a/fluid/factory.cxx b/fluid/factory.cxx
index edde697f9..d7133377e 100644
--- a/fluid/factory.cxx
+++ b/fluid/factory.cxx
@@ -1046,23 +1046,25 @@ Fl_Menu_Item New_Menu[] = {
#include <FL/Fl_Multi_Label.H>
-// modify a menuitem to display an icon in front of the label
-static void make_iconlabel( Fl_Menu_Item *mi, Fl_Image *ic, const char *txt )
+// Modify a menuitem to display an icon in front of the label. This is
+// implemented using Fl_Multi_Label as the labeltype (FL_MULTI_LABEL).
+// The icon (ic) may be null. If ic is null only the text (txt) is assigned
+// to the label - Fl_Multi_Label is not used. txt must not be null.
+static void make_iconlabel(Fl_Menu_Item *mi, Fl_Image *ic, const char *txt)
{
if (ic) {
char *t1 = new char[strlen(txt)+6];
- strcpy( t1, " " );
+ strcpy(t1, " ");
strcat(t1, txt);
strcat(t1, "...");
- mi->image( ic );
Fl_Multi_Label *ml = new Fl_Multi_Label;
ml->labela = (char*)ic;
ml->labelb = t1;
- ml->typea = _FL_IMAGE_LABEL;
+ ml->typea = FL_IMAGE_LABEL;
ml->typeb = FL_NORMAL_LABEL;
- ml->label( mi );
+ ml->label(mi);
}
- else if (txt!=mi->text)
+ else if (txt != mi->text)
mi->label(txt);
}