pub struct Menu<MK: MenuKind> { /* private fields */ }ui only.Expand description
Generic menu (top-level or submenu).
Implementations§
Source§impl<MK: MenuKind> Menu<MK>
impl<MK: MenuKind> Menu<MK>
pub fn new() -> Result<Self>
pub fn new_from_items<I>(items: I) -> Result<Self>where
I: IntoIterator<Item = MK::MenuItem>,
pub fn as_handle(&self) -> &MenuHandle
Inserts a menu item before the item with the given index.
If no index is given, it will be inserted after the last item.
§Panics
Will panic if the given index is greater than the current amount of items.
Modifies a menu item at the given index using the given closure.
§Panics
Will panic if the given index is out of bounds.
Source§impl Menu<SubMenuKind>
impl Menu<SubMenuKind>
Modifies all text menu items with the given ID using the given closure.
Will do nothing if no item with a matching ID is found.
Shows the popup menu at the given coordinates.
The coordinates can for example be retrieved from the window message handler, see
crate::ui::messaging::ListenerMessageVariant::NotificationIconContextSelect
The given window needs to be the foreground window for the menu to show
(use WindowHandle::set_as_foreground).