diff options
| author | Matthias Melcher <github@matthiasm.com> | 2025-11-19 16:57:02 +0100 |
|---|---|---|
| committer | Matthias Melcher <github@matthiasm.com> | 2025-11-19 16:58:08 +0100 |
| commit | 94008f57c30eadff13217e3de733cb9895ee41e8 (patch) | |
| tree | 905b8557229266ea825ae4959a96ed04ecfeecf1 /src/Fl_MacOS_Sys_Menu_Bar.mm | |
| parent | 2182bd60c0cabbb6cf65ca953d4643ec03006725 (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 'src/Fl_MacOS_Sys_Menu_Bar.mm')
| -rw-r--r-- | src/Fl_MacOS_Sys_Menu_Bar.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Fl_MacOS_Sys_Menu_Bar.mm b/src/Fl_MacOS_Sys_Menu_Bar.mm index 87c5089cd..f41db31b4 100644 --- a/src/Fl_MacOS_Sys_Menu_Bar.mm +++ b/src/Fl_MacOS_Sys_Menu_Bar.mm @@ -229,6 +229,14 @@ const char *Fl_Mac_App_Menu::quit = "Quit %@"; FLMenuItem *item = [[FLMenuItem alloc] initWithTitle:title action:selector keyEquivalent:@""]; + if (mitem->labelfont() & FL_BOLD) { + NSFont *boldFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; + NSAttributedString *attributed = + [ [ [NSAttributedString alloc] initWithString:title + attributes:@{ NSFontAttributeName: boldFont }] + autorelease]; + item.attributedTitle = attributed; + } // >= 0 if mitem is in the menu items of fl_sys_menu_bar, -1 if not NSInteger index = (fl_sys_menu_bar ? fl_sys_menu_bar->find_index(mitem) : -1); [item setTag:index]; @@ -369,6 +377,14 @@ static void createSubMenu( NSMenu *mh, pFl_Menu_Item &mm, const Fl_Menu_Item *m cnt = (int)[mh numberOfItems]; cnt--; menuItem = [mh itemAtIndex:cnt]; + if (mitem->labelfont() & FL_BOLD) { + NSFont *boldFont = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]; + NSAttributedString *attributed = + [ [ [NSAttributedString alloc] initWithString:title + attributes:@{ NSFontAttributeName: boldFont }] + autorelease]; + menuItem.attributedTitle = attributed; + } [menuItem setSubmenu:submenu]; [submenu release]; } else submenu = mh; |
