Skip to main content

MockMenuBar

Struct MockMenuBar 

Source
pub struct MockMenuBar(/* private fields */);
Expand description

A menu bar that keeps the menus last set. Every clone is the same menu bar.

Implementations§

Source§

impl MockMenuBar

Source

pub fn new() -> MockMenuBar

Source

pub fn taking( self, shortcuts: impl IntoIterator<Item = MenuShortcut>, ) -> MockMenuBar

A menu bar that takes a key-down offered (perform_key_equivalent) whose logical key is one of shortcuts’ keys. A key’s data carries no modifiers, which a host’s menu bar reads from the system’s own event, so the mock matches the key alone.

Source

pub fn offered(&self) -> Vec<KeyData>

The keys offered, in order, taken or not.

Source

pub fn menus(&self) -> Vec<MenuEntry>

The menus last set.

Source

pub fn sets(&self) -> usize

How many times the menus were set.

Source

pub fn id_of(&self, path: &[&str]) -> Option<MenuId>

The id of the entry reached by path, its labels from a top-level menu down, as the user finds it.

Trait Implementations§

Source§

impl Clone for MockMenuBar

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for MockMenuBar

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl MenuBar for MockMenuBar

Source§

fn set_menus(&self, menus: &[MenuEntry])

Replaces the app’s menu bar whole: its top-level menus, each a MenuEntry::Submenu. A choice reaches the app as EmbedderClient::menu_selected(id).
Source§

fn perform_key_equivalent(&self, key: &KeyData) -> bool

Offers the menu bar a key-down the app kept back when it came and has since left unhandled, as Chrome sends on a key its page did not consume; answers whether an item took it, which then reaches the app as EmbedderClient::menu_selected. For an app that answers a key later than the host must, such as one that waits on another thread: the host’s own order, the framework first and the menu bar after, needs no call. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for MockMenuBar

§

impl !Send for MockMenuBar

§

impl !Sync for MockMenuBar

§

impl !UnwindSafe for MockMenuBar

§

impl Forget for MockMenuBar

§

impl Freeze for MockMenuBar
where *const RcInner<RefCell<MenuBarState>> is !null: Freeze, PhantomData<RcInner<RefCell<MenuBarState>>>: Freeze,

§

impl Move for MockMenuBar

§

impl Unpin for MockMenuBar
where Rc<RefCell<MenuBarState>>: Unpin,

§

impl UnsafeUnpin for MockMenuBar
where *const RcInner<RefCell<MenuBarState>> is !null: UnsafeUnpin, PhantomData<RcInner<RefCell<MenuBarState>>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>