pub struct MemoryNativeMenuBackend { /* private fields */ }Expand description
Recording backend for headless tests. Captures the snapshot set per window,
which window is active, item deltas, and cleared windows. Cloneable; clones
share the recording so a test can keep a clone after handing one to
NativeMenuHandle::new.
Implementations§
Source§impl MemoryNativeMenuBackend
impl MemoryNativeMenuBackend
The snapshot currently set for window_id, if any.
Sourcepub fn active_window(&self) -> Option<TeksiloWindowId>
pub fn active_window(&self) -> Option<TeksiloWindowId>
The window whose own menu shows, as on macOS: the one
[key_window_bar] picks for the key window (the last
activate_window), or a window that set one before any was
activated. None while the application menu shows.
Whether the application menu is the one showing: no window’s own
menu is (active_window is None).
Sourcepub fn deltas(&self) -> Vec<(MenuItemId, MenuItemDelta)>
pub fn deltas(&self) -> Vec<(MenuItemId, MenuItemDelta)>
All item deltas applied so far, in order.
Sourcepub fn cleared(&self) -> Vec<TeksiloWindowId>
pub fn cleared(&self) -> Vec<TeksiloWindowId>
Windows whose menus were cleared, in order.
The application menu last set, if any.
Trait Implementations§
Source§impl Clone for MemoryNativeMenuBackend
impl Clone for MemoryNativeMenuBackend
Source§impl Default for MemoryNativeMenuBackend
impl Default for MemoryNativeMenuBackend
Source§impl NativeMenuBackend for MemoryNativeMenuBackend
impl NativeMenuBackend for MemoryNativeMenuBackend
Build (or replace) the native menu of
window_id, a window with a
menu of its own, from menu. For every item the user later chooses,
the backend MUST post a NativeMenuEventPayload, with
window_id_owner == window_id, through poster. If window_id is
the key window (the last one activate_window
named), or no window has been activated yet, the backend shows this
menu.Source§fn activate_window(&mut self, window_id: TeksiloWindowId)
fn activate_window(&mut self, window_id: TeksiloWindowId)
window_id became the key window (focus follows window): show the
bar [key_window_bar] picks, its own menu if it set one, else the
menu of the window it belongs to (see
set_window_owner), else the
application menu, or, when the application
declared none, the bar shown before.Source§fn clear_window(&mut self, window_id: TeksiloWindowId)
fn clear_window(&mut self, window_id: TeksiloWindowId)
Forget
window_id’s menu (the window closed, or no longer has a menu
of its own). If it was showing, show the
application menu until another window becomes
key.Source§fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta)
fn update_item(&mut self, id: MenuItemId, delta: MenuItemDelta)
Apply a reactive delta to a single already-installed item, in every
menu that carries it, the application menu included.
Set the application menu: the menu shown whenever the key window has
no menu of its own nor an owner with one, and while no window is
open.
teksilo-app sets it from the application tree at startup and
again whenever it changes; it replaces any earlier one, and the bar
is chosen again for the key window, as
activate_window chooses it: an
application menu declared while a window
with no menu of its own is key shows at once. declared
says whether the application declared it: false for the default
App menu teksilo-app supplies when it declared none, which a key
window without a menu does not bring up (see [key_window_bar]).
For every item the user later chooses in it, the backend MUST post a
NativeAppMenuEventPayload through poster. The default does
nothing, for a backend whose menus belong to windows alone.Auto Trait Implementations§
impl !RefUnwindSafe for MemoryNativeMenuBackend
impl !Send for MemoryNativeMenuBackend
impl !Sync for MemoryNativeMenuBackend
impl !UnwindSafe for MemoryNativeMenuBackend
impl Freeze for MemoryNativeMenuBackend
impl Unpin for MemoryNativeMenuBackend
impl UnsafeUnpin for MemoryNativeMenuBackend
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.