Struct MenuItem

Source
pub struct MenuItem<'ui, Label, Shortcut = &'static str> { /* private fields */ }
Expand description

Builder for a menu item.

Implementations§

Source§

impl<'ui, Label> MenuItem<'ui, Label>
where Label: AsRef<str>,

Source

pub fn new(label: Label, ui: &'ui Ui) -> MenuItem<'ui, Label>

👎Deprecated since 0.9.0: Use ui.menu_item or ui.menu_item_config

Construct a new menu item builder.

Source§

impl<'ui, Label, Shortcut> MenuItem<'ui, Label, Shortcut>
where Label: AsRef<str>, Shortcut: AsRef<str>,

Source

pub fn shortcut<Shortcut2>( self, shortcut: Shortcut2, ) -> MenuItem<'ui, Label, Shortcut2>
where Shortcut2: AsRef<str>,

Sets the menu item shortcut.

Shortcuts are displayed for convenience only and are not automatically handled.

Source

pub fn selected(self, selected: bool) -> MenuItem<'ui, Label, Shortcut>

Sets the selected state of the menu item.

Default: false

Source

pub fn enabled(self, enabled: bool) -> MenuItem<'ui, Label, Shortcut>

Enables/disables the menu item.

Default: enabled

Source

pub fn build(self) -> bool

Builds the menu item.

Returns true if the menu item is activated.

Source

pub fn build_with_ref(self, selected: &mut bool) -> bool

Builds the menu item using a mutable reference to selected state.

Trait Implementations§

Source§

impl<'ui, Label, Shortcut> Clone for MenuItem<'ui, Label, Shortcut>
where Label: Clone, Shortcut: Clone,

Source§

fn clone(&self) -> MenuItem<'ui, Label, Shortcut>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'ui, Label, Shortcut> Debug for MenuItem<'ui, Label, Shortcut>
where Label: Debug, Shortcut: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'ui, Label, Shortcut> Copy for MenuItem<'ui, Label, Shortcut>
where Label: Copy, Shortcut: Copy,

Auto Trait Implementations§

§

impl<'ui, Label, Shortcut> Freeze for MenuItem<'ui, Label, Shortcut>
where Label: Freeze, Shortcut: Freeze,

§

impl<'ui, Label, Shortcut = &'static str> !RefUnwindSafe for MenuItem<'ui, Label, Shortcut>

§

impl<'ui, Label, Shortcut = &'static str> !Send for MenuItem<'ui, Label, Shortcut>

§

impl<'ui, Label, Shortcut = &'static str> !Sync for MenuItem<'ui, Label, Shortcut>

§

impl<'ui, Label, Shortcut> Unpin for MenuItem<'ui, Label, Shortcut>
where Label: Unpin, Shortcut: Unpin,

§

impl<'ui, Label, Shortcut = &'static str> !UnwindSafe for MenuItem<'ui, Label, Shortcut>

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<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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V