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.
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
impl PlatformMenu
Sourcepub fn new(
label: impl Into<String>,
menus: Vec<PlatformMenuItemRef>,
) -> PlatformMenu
pub fn new( label: impl Into<String>, menus: Vec<PlatformMenuItemRef>, ) -> PlatformMenu
Creates a PlatformMenu labelled label, of menus.
pub fn tooltip(self, tooltip: impl Into<String>) -> PlatformMenu
pub fn on_open(self, on_open: VoidCallback) -> PlatformMenu
pub fn on_close(self, on_close: VoidCallback) -> PlatformMenu
Sourcepub fn get_descendants(item: &PlatformMenu) -> Vec<PlatformMenuItemRef>
pub fn get_descendants(item: &PlatformMenu) -> Vec<PlatformMenuItemRef>
Returns all descendant PlatformMenuItems of this item.
Sourcepub fn serialize(
item: Rc<PlatformMenu>,
delegate: &dyn PlatformMenuDelegate,
get_id: &mut MenuItemSerializableIdGenerator<'_>,
) -> MenuEntry
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
impl PlatformMenu
Sourcepub fn debug_describe_children(&self) -> Vec<Rc<dyn DiagnosticsNode>>
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
impl Debug for PlatformMenu
Source§impl PlatformMenuItem for PlatformMenu
impl PlatformMenuItem for PlatformMenu
Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
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>
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>
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>
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>
fn descendants(&self) -> Vec<PlatformMenuItemRef>
Returns all descendant
PlatformMenuItems of this item. Read moreConverts the representation of this item into the entries the host’s menu takes.
Source§fn shortcut(&self) -> Option<&MenuSerializableShortcutRef>
fn shortcut(&self) -> Option<&MenuSerializableShortcutRef>
The optional shortcut that selects this
PlatformMenuItem. Read moreSource§fn on_selected(&self) -> Option<&VoidCallback>
fn on_selected(&self) -> Option<&VoidCallback>
An optional callback that is called when this
PlatformMenuItem is selected. Read moreSource§fn on_selected_intent(&self) -> Option<&IntentRef>
fn on_selected_intent(&self) -> Option<&IntentRef>
An optional intent that is invoked when this
PlatformMenuItem is selected. Read moreSource§fn check(&self) -> MenuItemCheck
fn check(&self) -> MenuItemCheck
The check the item shows, and which.
Source§fn members(&self) -> Vec<PlatformMenuItemRef>
fn members(&self) -> Vec<PlatformMenuItemRef>
Returns the list of group members if this menu item is a “grouping” menu item, such as
PlatformMenuItemGroup. Read moreSource§fn to_string_short(&self) -> String
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
fn diagnostics_node(&self, name: Option<String>) -> DiagnosticableNode
Dart’s
PlatformMenuItem.toDiagnosticsNode(name:), from Diagnosticable.Source§fn diagnostic_string(&self) -> String
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 PlatformMenuwhere
*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
impl UnsafeUnpin for PlatformMenuwhere
*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> 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