pub struct NativeMenuHandle { /* private fields */ }Expand description
Per-app native-menu service. Registered in app-state by
TeksiloAppBuilder::install_native_menu (or .app_state(NativeMenuHandle::new(..))
for a custom backend). Cloneable; clones share one backend + activation map.
Implementations§
Source§impl NativeMenuHandle
impl NativeMenuHandle
Sourcepub fn new<B: NativeMenuBackend + 'static>(backend: B) -> Self
pub fn new<B: NativeMenuBackend + 'static>(backend: B) -> Self
Build a handle wrapping the given backend.
Install window_id’s menu, recording the per-item activations so a later
click can be routed. Replaces any prior menu for that window.
Sourcepub fn activate_window(&self, window_id: TeksiloWindowId)
pub fn activate_window(&self, window_id: TeksiloWindowId)
window_id became the key window: show the bar
[key_window_bar] picks for it.
Sourcepub fn clear_window(&self, window_id: TeksiloWindowId)
pub fn clear_window(&self, window_id: TeksiloWindowId)
Forget a window’s menu + activations (window closed).
Sourcepub fn update_item(&self, id: MenuItemId, delta: MenuItemDelta)
pub fn update_item(&self, id: MenuItemId, delta: MenuItemDelta)
Apply a reactive delta to one installed item. For a row that greys
out when nothing takes its intent, a new enabled is the row’s own
state, and what reaches the backend is that state and whether the
intent was taken at the last
refresh_availability.
Set the application menu, shown whenever the key window has no menu
of its own and while no window is open (see
NativeMenuBackend::set_app_menu), recording its activations.
Replaces any earlier one. teksilo-app calls it from the application
tree’s declaration; a window’s menu never sets it.
Sourcepub fn app_activation(&self, id: MenuItemId) -> Option<NativeMenuActivation>
pub fn app_activation(&self, id: MenuItemId) -> Option<NativeMenuActivation>
The activation for an item chosen in the application menu.
Sourcepub fn activation(
&self,
window_id: TeksiloWindowId,
id: MenuItemId,
) -> Option<NativeMenuActivation>
pub fn activation( &self, window_id: TeksiloWindowId, id: MenuItemId, ) -> Option<NativeMenuActivation>
Look up (and clone) the activation for a chosen item, for the router.
Trait Implementations§
Source§impl Clone for NativeMenuHandle
impl Clone for NativeMenuHandle
Auto Trait Implementations§
impl !RefUnwindSafe for NativeMenuHandle
impl !Send for NativeMenuHandle
impl !Sync for NativeMenuHandle
impl !UnwindSafe for NativeMenuHandle
impl Freeze for NativeMenuHandle
impl Unpin for NativeMenuHandle
impl UnsafeUnpin for NativeMenuHandle
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.