Skip to main content

PlatformMenu

Struct PlatformMenu 

Source
pub struct PlatformMenu {
    pub label: String,
    pub tooltip: Option<String>,
    pub on_open: Option<VoidCallback>,
    pub on_close: Option<VoidCallback>,
    pub menus: Vec<PlatformMenuItemRef>,
}
Expand description

A class for representing menu items that have child submenus.

Fields§

§label: String§tooltip: Option<String>§on_open: Option<VoidCallback>

A callback that is called when this menu is opened.

§on_close: Option<VoidCallback>

A callback that is called when this menu is closed.

§menus: Vec<PlatformMenuItemRef>

The menu items in the submenu opened by this menu item.

If this is an empty list, this PlatformMenu will be disabled.

Implementations§

Source§

impl PlatformMenu

Source

pub fn new( label: impl Into<String>, menus: Vec<PlatformMenuItemRef>, ) -> PlatformMenu

Creates a PlatformMenu labelled label, of menus.

Source

pub fn tooltip(self, tooltip: impl Into<String>) -> PlatformMenu

Source

pub fn on_open(self, on_open: VoidCallback) -> PlatformMenu

Source

pub fn on_close(self, on_close: VoidCallback) -> PlatformMenu

Source

pub fn get_descendants(item: &PlatformMenu) -> Vec<PlatformMenuItemRef>

Returns all descendant PlatformMenuItems of this item.

Source

pub fn serialize( item: Rc<PlatformMenu>, delegate: &dyn PlatformMenuDelegate, get_id: &mut MenuItemSerializableIdGenerator<'_>, ) -> MenuEntry

Converts the supplied object to the entry the host’s menu takes.

Source§

impl PlatformMenu

Source

pub fn debug_describe_children(&self) -> Vec<Rc<dyn DiagnosticsNode>>

Dart’s PlatformMenu.debugDescribeChildren: the items of the submenu.

Trait Implementations§

Source§

impl Debug for PlatformMenu

Source§

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

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

impl PlatformMenuItem for PlatformMenu

Source§

fn label(&self) -> &str

The required label used for rendering the menu item.
Source§

fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)

Dart’s PlatformMenuItem.debugFillProperties, which an implementor’s own body calls where Dart writes super.
Source§

fn tooltip(&self) -> Option<&str>

The optional tooltip text that is displayed when the user hovers over the menu item.
Source§

fn on_open(&self) -> Option<&VoidCallback>

Returns a callback, if any, to be invoked if the platform menu receives a “Menu.opened” method call from the platform for this item. Read more
Source§

fn on_close(&self) -> Option<&VoidCallback>

Returns a callback, if any, to be invoked if the platform menu receives a “Menu.closed” method call from the platform for this item. Read more
Source§

fn descendants(&self) -> Vec<PlatformMenuItemRef>

Returns all descendant PlatformMenuItems of this item. Read more
Source§

fn to_menu_entries( self: Rc<Self>, delegate: &dyn PlatformMenuDelegate, get_id: &mut MenuItemSerializableIdGenerator<'_>, ) -> Vec<MenuEntry>

Converts the representation of this item into the entries the host’s menu takes.
Source§

fn shortcut(&self) -> Option<&MenuSerializableShortcutRef>

The optional shortcut that selects this PlatformMenuItem. Read more
Source§

fn on_selected(&self) -> Option<&VoidCallback>

An optional callback that is called when this PlatformMenuItem is selected. Read more
Source§

fn on_selected_intent(&self) -> Option<&IntentRef>

An optional intent that is invoked when this PlatformMenuItem is selected. Read more
Source§

fn check(&self) -> MenuItemCheck

The check the item shows, and which.
Source§

fn icon(&self) -> Option<&IconImage>

The image the item shows beside its label.
Source§

fn members(&self) -> Vec<PlatformMenuItemRef>

Returns the list of group members if this menu item is a “grouping” menu item, such as PlatformMenuItemGroup. Read more
Source§

fn to_string_short(&self) -> String

Dart’s PlatformMenuItem.toStringShort: the identity, then the label in parentheses.
Source§

fn diagnostics_node(&self, name: Option<String>) -> DiagnosticableNode

Dart’s PlatformMenuItem.toDiagnosticsNode(name:), from Diagnosticable.
Source§

fn diagnostic_string(&self) -> String

Dart’s Diagnosticable.toString, which a group’s member list prints.

Auto Trait Implementations§

§

impl !RefUnwindSafe for PlatformMenu

§

impl !Send for PlatformMenu

§

impl !Sync for PlatformMenu

§

impl !UnwindSafe for PlatformMenu

§

impl Forget for PlatformMenu

§

impl Freeze for PlatformMenu
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const RcInner<dyn Fn(&mut App)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App)>>: Freeze, PhantomData<Rc<dyn PlatformMenuItem>>: Freeze,

§

impl Move for PlatformMenu

§

impl Unpin for PlatformMenu
where *const u8 is !null: Unpin, Rc<dyn Fn(&mut App)>: Unpin, Rc<dyn PlatformMenuItem>: Unpin,

§

impl UnsafeUnpin for PlatformMenu
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App)>>: UnsafeUnpin, PhantomData<Rc<dyn PlatformMenuItem>>: 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> 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, 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>