NativeMenuItem
struct · ferroui-controls · v0.5.0
struct NativeMenuItem
An item of a NativeMenu.
Members
TYPEto_refmenu_propertyicon_propertyheader_propertytool_tip_propertygesture_propertyis_checked_propertytoggle_type_propertycommand_propertycommand_parameter_propertyis_enabled_propertyis_visible_propertyconstructnewwith_headermenuset_menuiconset_iconheaderset_headertool_tipset_tool_tipgestureset_gestureis_checkedset_is_checkedtoggle_typeset_toggle_typeis_enabledset_is_enabledis_visibleset_is_visiblehas_click_handlerscommandset_commandcommand_parameterset_command_parameterclickto_exporter_events_bridge
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<NativeMenuItem>
Returns a strong reference to this object.
menu_property
fn menu_property() -> &'static StyledProperty<Option<Ref<NativeMenu>>>
Defines the Menu property.
icon_property
fn icon_property() -> &'static StyledProperty<Option<Rc<dyn IBitmap>>>
Defines the Icon property.
header_property
fn header_property() -> &'static StyledProperty<Option<String>>
Defines the Header property.
tool_tip_property
fn tool_tip_property() -> &'static StyledProperty<Option<String>>
Defines the ToolTip property.
gesture_property
fn gesture_property() -> &'static StyledProperty<Option<KeyGesture>>
Defines the Gesture property.
is_checked_property
fn is_checked_property() -> &'static StyledProperty<bool>
Defines the IsChecked property.
toggle_type_property
fn toggle_type_property() -> &'static StyledProperty<MenuItemToggleType>
Defines the ToggleType property.
command_property
fn command_property() -> &'static StyledProperty<Option<Rc<dyn ICommand>>>
Defines the Command property.
command_parameter_property
fn command_parameter_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the CommandParameter property.
is_enabled_property
fn is_enabled_property() -> &'static StyledProperty<bool>
Defines the IsEnabled property.
is_visible_property
fn is_visible_property() -> &'static StyledProperty<bool>
Defines the IsVisible property.
construct
fn construct() -> Self
Creates the class data; see FerroObject::construct.
new
fn new() -> Ref<Self>
with_header
fn with_header(header: &str) -> Ref<Self>
Creates an item with the given header.
menu
fn menu(self: &Self) -> Option<Ref<NativeMenu>>
The submenu of the item.
set_menu
fn set_menu(self: &Self, value: Option<Ref<NativeMenu>>)
icon
fn icon(self: &Self) -> Option<Rc<dyn IBitmap>>
The icon that appears in the item.
set_icon
fn set_icon(self: &Self, value: Option<Rc<dyn IBitmap>>)
header
fn header(self: &Self) -> Option<String>
The header of the item.
set_header
fn set_header(self: &Self, value: Option<String>)
tool_tip
fn tool_tip(self: &Self) -> Option<String>
Gets the tooltip associated with the menu item. This may not be supported by the native menu provider, but will be passed on to the non-native fallback menu item if used.
set_tool_tip
fn set_tool_tip(self: &Self, value: Option<String>)
gesture
fn gesture(self: &Self) -> Option<KeyGesture>
The input gesture that will be displayed in the item.
set_gesture
fn set_gesture(self: &Self, value: Option<KeyGesture>)
is_checked
fn is_checked(self: &Self) -> bool
Whether the item is checked.
set_is_checked
fn set_is_checked(self: &Self, value: bool)
toggle_type
fn toggle_type(self: &Self) -> MenuItemToggleType
How the item reacts to clicks.
set_toggle_type
fn set_toggle_type(self: &Self, value: MenuItemToggleType)
is_enabled
fn is_enabled(self: &Self) -> bool
Whether the item is enabled.
set_is_enabled
fn set_is_enabled(self: &Self, value: bool)
is_visible
fn is_visible(self: &Self) -> bool
Gets a value indicating whether this menu item is visible.
set_is_visible
fn set_is_visible(self: &Self, value: bool)
has_click_handlers
fn has_click_handlers(self: &Self) -> bool
Whether the click event has handlers.
command
fn command(self: &Self) -> Option<Rc<dyn ICommand>>
The command to invoke when the item is clicked.
set_command
fn set_command(self: &Self, value: Option<Rc<dyn ICommand>>)
command_parameter
fn command_parameter(self: &Self) -> Option<BoxedValue>
The parameter to pass to the command.
set_command_parameter
fn set_command_parameter(self: &Self, value: Option<BoxedValue>)
click
fn click(self: &Self, handler: impl Fn(&NativeMenuItem) -> () + 'static) -> Subscription
Occurs when a NativeMenuItem is clicked.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the item.
to_exporter_events_bridge
fn to_exporter_events_bridge(self: &Self) -> Rc<dyn INativeMenuItemExporterEventsImplBridge>
The item viewed as the contract through which the platform exporter of the menu raises the events of the item.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<NativeMenuItem>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.