pub enum NativeMenuNode {
Item {
id: MenuItemId,
title: String,
key_equiv: Option<NativeKeyEquivalent>,
enabled: bool,
check: NativeCheck,
},
Submenu {
title: String,
children: Vec<NativeMenuNode>,
},
Separator,
Standard {
role: StandardMenuRole,
labels: StandardLabels,
quit_item: Option<StandardRoutedItem>,
settings_item: Option<StandardRoutedItem>,
},
}Expand description
One node of a native menu tree.
Variants§
Item
A leaf command.
Fields
id: MenuItemIdCorrelates the native item back to the logical one on activation.
key_equiv: Option<NativeKeyEquivalent>Key equivalent, if any.
check: NativeCheckCheck-mark state.
A submenu with its own children.
Separator
A separator line.
Standard
A platform-standard menu the backend fills in, with localized chrome.
Fields
role: StandardMenuRoleWhich standard menu.
labels: StandardLabelsLocalized display strings (supplied by the widget layer).
quit_item: Option<StandardRoutedItem>App menu only: route Quit back to the app under this item instead of firing the platform’s own terminate selector.
None — the default — keeps the system behaviour: on macOS the item
is bound to terminate:, which works with no app wiring at all and
is why ⌘Q is live even for an app that declares no menus.
Some(..) builds Quit as an ordinary routed item — same id → the
activation recorded for it, and the key equivalent the widget layer
resolved. An app with anything to lose on exit must set this: a
main-menu key equivalent is dispatched by the platform before the
responder chain, and terminate: does not run winit’s exit path, so
an in-app quit shortcut is shadowed rather than merely duplicated.
Whatever the app routes to then owes the exit itself — nothing here
terminates.
settings_item: Option<StandardRoutedItem>App menu only: build a Settings… item under this id, placed where the platform expects it (on macOS: after About, with the ⌘, key equivalent).
Unlike Quit there is no None fallback that still does something —
no platform ships a default action for opening an app’s settings —
so None simply omits the item. An app that has a settings window
routes it; one that has none leaves the slot empty rather than
showing a row that does nothing.
Trait Implementations§
Source§impl Clone for NativeMenuNode
impl Clone for NativeMenuNode
Source§fn clone(&self) -> NativeMenuNode
fn clone(&self) -> NativeMenuNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for NativeMenuNode
impl RefUnwindSafe for NativeMenuNode
impl Send for NativeMenuNode
impl Sync for NativeMenuNode
impl Unpin for NativeMenuNode
impl UnsafeUnpin for NativeMenuNode
impl UnwindSafe for NativeMenuNode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.