Remove FL_MENU_RESERVED bit mask in favor of better documentation

This bit mask was added in commit 53b40f4138 in an attempt
to *document* reserved bits but it turned out that this mask could
have negative side effects on some newer compilers by propagating
the enum to an 'unsigned int' and issuing compiler warnings.

See this comment and follow-up's in fltk.general:
https://groups.google.com/g/fltkgeneral/c/7xrDkbkxiyw/m/rzEIJ7XhAgAJ
This commit is contained in:
Albrecht Schlosser 2024-10-19 15:58:25 +02:00
parent 737137cf78
commit 74d827f71f

View File

@ -34,8 +34,8 @@ enum { // values for flags:
FL_SUBMENU_POINTER = 0x20, ///< Indicates user_data() is a pointer to another menu array
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_HORIZONTAL = 0x100, ///< ??? -- reserved, internal (do not use)
FL_MENU_RESERVED = 0xffffff00 ///< These bits are reserved for internal or future usage (do not use)
FL_MENU_HORIZONTAL = 0x100 ///< ??? -- reserved, internal (do not use)
///< Note: \b ALL other bits in \p flags are reserved: do not use them for your own purposes!
};
extern FL_EXPORT Fl_Shortcut fl_old_shortcut(const char*);
@ -67,10 +67,19 @@ class Fl_Menu_;
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_MENU_DIVIDER = 0x80, // Creates divider line below this item. Also ends a group of radio buttons.
FL_MENU_HORIZONTAL = 0x100, // ??? -- reserved, internal (do not use)
FL_MENU_RESERVED = 0xffffff00 // These bits are reserved for internal or future usage (do not use)
FL_MENU_HORIZONTAL = 0x100 // ??? -- reserved, internal (do not use)
};
\endcode
\note \b All other bits in \p flags are reserved for FLTK usage, do not use any bits of the
\p flags variable for your own purposes. Even \b undocumented bits can be used for internal
purposes in this or any future FLTK version.
Some \p flags bits may be changed during runtime by user code, particularly if you need to change
the value of a menu item (ON/OFF) or make it active or inactive. Such changes must be done with
caution so they don't affect other (maybe undocumented) bits, i.e. you need to make proper bit
operations to set or clear only these particular bits.
Typically menu items are statically defined; for example:
\code
Fl_Menu_Item popup[] = {