Struct MenuItem

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

Application menu item.

Implementations§

Source§

impl MenuItem

Source

pub fn builder() -> MenuItemBuilder

Returns a new builder instance.

Source

pub fn separator(ctx: &impl ContextOwner) -> Self

Creates a new menu separator.

§Parameters:
  • ctx - ContextOnwer
Source§

impl MenuItem

Source

pub fn set_title<S>(&mut self, title: S)
where S: Into<String>,

Sets a new menu item title.

§Parameters:
  • title - Title.
Source

pub fn title(&self) -> String

Returns a menu item title.

Source

pub fn set_action(&mut self, action: Option<Action>)

Sets a menu item action.

§Parameters:
  • action - Menu item action.
Source

pub fn set_submenu(&mut self, submenu: Option<Menu>)

Sets a submenu.

§Parameters:
  • submenu - Submenu of the current menu item.
Source

pub fn submenu(&self) -> Option<&Menu>

Returns a submenu.

Source

pub fn submenu_mut(&mut self) -> Option<&mut Menu>

Returns a mutable submenu.

Source

pub fn has_submenu(&self) -> bool

Checks if a menu item has a submenu.

Source

pub fn set_short_code(&mut self, short_code: ShortCode)

Sets short codes for different platforms.

§Parameters:
  • short_code - Short codes.
Source

pub fn short_code(&self) -> &ShortCode

Returns short codes for different platforms.

Source

pub fn set_enabled(&mut self, enabled: bool)

Turns on/off a menu item.

§Parameters:
  • enabled - Enable flag.
Source

pub fn enabled(&self) -> bool

Returns if a menu item is turned on/off.

Source

pub fn set_tooltip(&mut self, tooltip: Option<String>)

Sets a tooltip for the menu item.

§Parameters:
  • tooltip - Tooltip message.
Source

pub fn tooltip(&self) -> Option<String>

Returns a tooltip of the menu item.

Source

pub fn set_icon(&mut self, icon: Option<Icon>)

Sets a menu item icon.

§Parameters:
  • icon - Menu item icon.
Source

pub fn icon(&self) -> Option<&Icon>

Returns a menu item icon.

Trait Implementations§

Source§

impl Debug for MenuItem

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> 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, 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<T> AutoreleaseSafe for T
where T: ?Sized,