summaryrefslogtreecommitdiff
path: root/FL/Fl_Menu_Item.H
diff options
context:
space:
mode:
authorMatthias Melcher <github@matthiasm.com>2025-11-19 16:57:02 +0100
committerMatthias Melcher <github@matthiasm.com>2025-11-19 16:58:08 +0100
commit94008f57c30eadff13217e3de733cb9895ee41e8 (patch)
tree905b8557229266ea825ae4959a96ed04ecfeecf1 /FL/Fl_Menu_Item.H
parent2182bd60c0cabbb6cf65ca953d4643ec03006725 (diff)
Add headline menu item style (#1059)
A menu item can be designated as a headline. Fully integrated and used in Fluid.
Diffstat (limited to 'FL/Fl_Menu_Item.H')
-rw-r--r--FL/Fl_Menu_Item.H26
1 files changed, 24 insertions, 2 deletions
diff --git a/FL/Fl_Menu_Item.H b/FL/Fl_Menu_Item.H
index 6d086ea8b..4dab9c624 100644
--- a/FL/Fl_Menu_Item.H
+++ b/FL/Fl_Menu_Item.H
@@ -36,8 +36,10 @@ enum { // values for flags:
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, do not use
- FL_MENU_CHATTY = 0x200 ///< Menu Item receives additional callbacks
- ///< Note: \b ALL other bits in \p flags are reserved: do not use them for your own purposes!
+ FL_MENU_CHATTY = 0x200, ///< Menu Item receives additional callbacks
+ FL_MENU_HEADLINE = 0x400, ///< Mark menu item as a headline
+ ///<
+ ///< Note: All other bits in `flags` are reserved: do not use them for your own purposes!
};
class Fl_Menu_;
@@ -460,9 +462,29 @@ struct FL_EXPORT Fl_Menu_Item {
the menu item to appear grayed-out.
*/
void deactivate() {flags |= FL_MENU_INACTIVE;}
+
/** Returns non 0 if FL_INACTIVE and FL_INVISIBLE are cleared, 0 otherwise. */
int activevisible() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE));}
+ /** Returns non-0 if the menu item can be selected.
+ Return 0 if the menu is hidden, inactive, or a headline.
+ */
+ int selectable() const {return !(flags & (FL_MENU_INACTIVE|FL_MENU_INVISIBLE|FL_MENU_HEADLINE));}
+
+ /**
+ Set menu item as a headline.
+ A menu item can be designated as a headline. Headline items are not selectable,
+ but they are also not grayed out. To visually distinguish them, add
+ indentation and apply bold or italic styling.
+ */
+ void headline(bool yes) {
+ if (yes) flags |= FL_MENU_HEADLINE; else flags &= ~FL_MENU_HEADLINE;
+ }
+ /**
+ Return non 0 if this menu item is used as a headline.
+ */
+ int headline() const { return (flags & FL_MENU_HEADLINE); }
+
// compatibility for FLUID so it can set the image of a menu item...
/** Compatibility API for FLUID, same as image->label(this).