JFLib

plat/sysmenu.rs#

Source: lib/plat/sysmenu.rs

sysmenu -- the app's menus in the system's own menu bar (macOS: between the app menu and the Window
menu, as every Mac app has them; iPadOS: between the application menu and Window as well;
docs/APPLE.md "Menüs in der Menüleiste" and AP9)

  sysmenu_supported() -> bool        whether this system shows an app's menus in its own bar (macOS
                                     with a window of the app, an iPad under UIKit; elsewhere false:
                                     the app draws its menu bar in the window)
  sysmenu_window_row() -> bool       whether the window keeps its own menu row as well (iPadOS: its
                                     bar hides until a swipe down from the top or the pointer there
                                     reveals it, the row stays the way for the finger; macOS: false)
  sysmenu_set(&[SysMenuItem])        the app's menus: the top level are the menus of the bar, their
                                     `sub` the rows; the same list again changes nothing; an empty
                                     list takes them out again
  sysmenu_take() -> Vec<u32>         the ids of the rows chosen since the last call (each choice calls
                                     wake())

A row's key equivalent is a character ("s", or a function key's: "\u{F704}" = F1) with MOD_* bits;
MOD_CTRL is the Mac's Command key, MOD_ALT its Option key.  A disabled row cannot be chosen, its key
then reaches the window as a normal key press.  On the iPad the rows with a key also show while
Command is held; Insert has no key there.
  • struct SysMenuItem one menu or row

    • id: u32 -- reported by sysmenu_take (0: a row without action, e.g. a menu or a submenu)
    • label: String
    • flags: u32 -- TI_CHECKED, TI_DISABLED, TI_SEPARATOR
    • key: String -- the key equivalent: one character ("" = none)
    • mods: u32 -- MOD_SHIFT | MOD_CTRL | MOD_ALT of the key equivalent
    • sub: Vec<SysMenuItem> -- a menu or submenu when not empty
  • fn sysmenu_take() -> Vec<u32> the rows chosen since the last call, oldest first

  • fn sysmenu_supported() -> bool whether the app's menus go into the system's menu bar here

  • fn sysmenu_window_row() -> bool whether the window keeps drawing its own menu row besides the system's bar (iPadOS; false where the system's bar is the only place, macOS, and where sysmenu_supported is false)

  • fn sysmenu_set(menus: &[SysMenuItem]) put the app's menus into the system's menu bar (an unchanged list does nothing)

Source: docs/API.md in the JFLib repository.