Improve Fl_Menu_Item docs and inline deprecated methods

The deprecated methods are now calling the new methods to be
entirely compatible.

These methods should be removed in 1.5.0

(fix unrelated whitespace as well)
This commit is contained in:
Albrecht Schlosser
2020-09-18 17:17:36 +02:00
parent 1d21dc7a38
commit 360040d0bf
2 changed files with 32 additions and 22 deletions
+24 -14
View File
@@ -1,7 +1,7 @@
// //
// Menu item header file for the Fast Light Tool Kit (FLTK). // Menu item header file for the Fast Light Tool Kit (FLTK).
// //
// Copyright 1998-2010 by Bill Spitzak and others. // Copyright 1998-2020 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // 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 // the file "COPYING" which should have been included with this file. If this
@@ -31,8 +31,8 @@ enum { // values for flags:
FL_MENU_RADIO = 8, ///< Item is a radio button (one checkbox of many can be on) FL_MENU_RADIO = 8, ///< Item is a radio button (one checkbox of many can be on)
FL_MENU_INVISIBLE = 0x10, ///< Item will not show up (shortcut will work) FL_MENU_INVISIBLE = 0x10, ///< Item will not show up (shortcut will work)
FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array
FL_SUBMENU = 0x40, ///< This item is a submenu to other items FL_SUBMENU = 0x40, ///< Item is a submenu to other items
FL_MENU_DIVIDER = 0x80, ///< Creates divider line below this item. Also ends a group of radio buttons. FL_MENU_DIVIDER = 0x80, ///< Creates divider line below this item. Also ends a group of radio buttons
FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved
}; };
@@ -402,19 +402,29 @@ struct FL_EXPORT Fl_Menu_Item {
*/ */
void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)(fl_intptr_t)arg);} void do_callback(Fl_Widget* o,long arg) const {callback_(o, (void*)(fl_intptr_t)arg);}
// back-compatibility, do not use: /** Back compatibility only.
\deprecated
Please use Fl_Menu_Item::value() instead.
This method will be removed in FLTK 1.5.0 or later.
\see value()
*/
inline int checked() const {return value();}
/** For back compatibility only /** Back compatibility only.
\deprecated Replaced by value() */ \deprecated
int checked() const {return flags&FL_MENU_VALUE;} Please use Fl_Menu_Item::set() instead.
This method will be removed in FLTK 1.5.0 or later.
\see set()
*/
inline void check() {set();}
/** For back compatibility only /** Back compatibility only.
\deprecated Replaced by set() */ \deprecated
void check() {flags |= FL_MENU_VALUE;} Please use Fl_Menu_Item::clear() instead.
This method will be removed in FLTK 1.5.0 or later.
/** For back compatibility only \see clear()
\deprecated Replaced by clear() */ */
void uncheck() {flags &= ~FL_MENU_VALUE;} inline void uncheck() {clear();}
int insert(int,const char*,int,Fl_Callback*,void* =0, int =0); int insert(int,const char*,int,Fl_Callback*,void* =0, int =0);
int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0); int add(const char*, int shortcut, Fl_Callback*, void* =0, int = 0);