From 322208b8556790bea75efb5a468813c9a49af0d8 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Mon, 11 Sep 2017 18:54:10 +0000 Subject: Add missing Fl_Labeltype and Fl_Boxtype definitions. Some labeltypes and boxtypes were missing a #define for the enum without a leading underscore and the corresponding setup function to initialize the internal table of boxtypes and labeltypes, for instance _FL_MULTI_LABEL. This is now fixed so (hopefully) all boxtypes and labeltypes can and _should_ be used w/o leading underscore. Note: if there are still boxtypes or labeltypes that can't be used w/o leading underscore this should be considered a bug and is to be fixed ASAP. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12443 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Image.cxx | 10 ++++++++++ src/Fl_Multi_Label.cxx | 18 +++++++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/Fl_Image.cxx b/src/Fl_Image.cxx index efe980cb8..a43a596eb 100644 --- a/src/Fl_Image.cxx +++ b/src/Fl_Image.cxx @@ -113,6 +113,16 @@ void Fl_Image::color_average(Fl_Color, float) { void Fl_Image::desaturate() { } +// Doxygen documentation in FL/Enumerations.H +Fl_Labeltype fl_define_FL_IMAGE_LABEL() { + return Fl_Image::define_FL_IMAGE_LABEL(); +} + +Fl_Labeltype Fl_Image::define_FL_IMAGE_LABEL() { + Fl::set_labeltype(_FL_IMAGE_LABEL, Fl_Image::labeltype, Fl_Image::measure); + return _FL_IMAGE_LABEL; +} + /** The label() methods are an obsolete way to set the image attribute of a widget or menu item. Use the diff --git a/src/Fl_Multi_Label.cxx b/src/Fl_Multi_Label.cxx index 56ce602ca..1a9050494 100644 --- a/src/Fl_Multi_Label.cxx +++ b/src/Fl_Multi_Label.cxx @@ -3,7 +3,7 @@ // // Multi-label widget for the Fast Light Tool Kit (FLTK). // -// Copyright 1998-2010 by Bill Spitzak and others. +// Copyright 1998-2017 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -16,8 +16,8 @@ // http://www.fltk.org/str.php // -// Allows two labels to be used on a widget (by having one of them -// be one of these it allows an infinte number!) +// Allows two or more labels to be used on a widget (by having one of them +// be one of these it allows an infinite number!) #include #include @@ -56,14 +56,18 @@ static void multi_measure(const Fl_Label* o, int& w, int& h) { w += W; if (H>h) h = H; } -void Fl_Multi_Label::label(Fl_Widget* o) { +// used by FL_MULTI_LABEL to set up the internal table, see FL/Enumerations.H +Fl_Labeltype fl_define_FL_MULTI_LABEL() { Fl::set_labeltype(_FL_MULTI_LABEL, multi_labeltype, multi_measure); - o->label(_FL_MULTI_LABEL, (const char*)this); + return _FL_MULTI_LABEL; +} + +void Fl_Multi_Label::label(Fl_Widget* o) { + o->label(FL_MULTI_LABEL, (const char*)this); // calls fl_define_FL_MULTI_LABEL() } void Fl_Multi_Label::label(Fl_Menu_Item* o) { - Fl::set_labeltype(_FL_MULTI_LABEL, multi_labeltype, multi_measure); - o->label(_FL_MULTI_LABEL, (const char*)this); + o->label(FL_MULTI_LABEL, (const char*)this); // calls fl_define_FL_MULTI_LABEL() } // -- cgit v1.2.3