pub enum NativeMenuNode {
Item {
id: MenuItemId,
title: String,
key_equiv: Option<NativeKeyEquivalent>,
enabled: bool,
visible: 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.
visible: boolWhether the item is shown. A hidden item keeps its place, so a
MenuItemDelta can show it again without rebuilding the menu.
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: build Quit as an ordinary routed item under this id (the activation recorded for it, and the key equivalent the widget layer resolved), instead of the platform’s own terminate selector.
The widget layer always routes it: the activation sends the app’s
quit intent, and asks the application to quit through every
window’s close guard when nothing takes the intent or there is none
(NativeMenuActivation::quits). A main-menu key equivalent is
dispatched by the platform before the responder chain, so an
app-side ⌘Q never sees the keystroke; and the platform’s own item
(terminate:, which asks the quit through os_quit when
teksilo-app runs the loop) could not send the app’s quit intent.
None binds the item to the platform’s terminate selector
(terminate: on macOS), for a snapshot built by other means.
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 the widget layer resolved.
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
Auto 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.