MenuItem
struct · ferroui-controls · v0.5.0
struct MenuItem
A menu item control.
Members
TYPEto_refon_clickon_submenu_openedcommand_propertyhot_key_propertycommand_parameter_propertyicon_propertyinput_gesture_propertyis_sub_menu_open_propertystays_open_on_click_propertytoggle_type_propertyis_checked_propertygroup_name_propertyTEMPLATE_PARTSPSEUDO_CLASSESclick_eventpointer_entered_item_eventpointer_exited_item_eventsubmenu_opened_eventconstructnewclickpointer_entered_itempointer_exited_itemsubmenu_openedcommandset_commandhot_keyset_hot_keycommand_parameterset_command_parametericonset_iconinput_gestureset_input_gestureis_selectedset_is_selectedis_sub_menu_openset_is_sub_menu_openstays_open_on_clickset_stays_open_on_clicktoggle_typeset_toggle_typeis_checkedset_is_checkedgroup_nameset_group_namehas_sub_menuis_top_levelopenclose
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<MenuItem>
Returns a strong reference to this object.
on_click
fn on_click(self: &Self, e: &RoutedEventArgs)
Invoked when an unhandled Click event reaches an element in
its route that is derived from this class. Implement this method
to add class handling for this event.
on_submenu_opened
fn on_submenu_opened(self: &Self, e: &RoutedEventArgs)
Invoked when an unhandled SubmenuOpened event reaches an
element in its route that is derived from this class. Implement
this method to add class handling for this event.
command_property
fn command_property() -> &'static StyledProperty<Option<Rc<dyn ICommand>>>
Defines the Command property.
hot_key_property
fn hot_key_property() -> &'static StyledProperty<Option<KeyGesture>>
Defines the HotKey property.
command_parameter_property
fn command_parameter_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the CommandParameter property.
icon_property
fn icon_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the Icon property.
input_gesture_property
fn input_gesture_property() -> &'static StyledProperty<Option<KeyGesture>>
Defines the InputGesture property.
is_sub_menu_open_property
fn is_sub_menu_open_property() -> &'static StyledProperty<bool>
Defines the IsSubMenuOpen property.
stays_open_on_click_property
fn stays_open_on_click_property() -> &'static StyledProperty<bool>
Defines the StaysOpenOnClick property.
toggle_type_property
fn toggle_type_property() -> &'static StyledProperty<MenuItemToggleType>
Defines the ToggleType property.
is_checked_property
fn is_checked_property() -> &'static StyledProperty<bool>
Defines the IsChecked property.
group_name_property
fn group_name_property() -> &'static StyledProperty<Option<String>>
Defines the GroupName property.
TEMPLATE_PARTS
const TEMPLATE_PARTS: &'static [TemplatePartAttribute]
The named parts expected in the control template.
PSEUDO_CLASSES
const PSEUDO_CLASSES: PseudoClassesAttribute
The pseudoclasses set by the class.
click_event
fn click_event() -> &'static RoutedEvent<RoutedEventArgs>
Defines the Click event.
pointer_entered_item_event
fn pointer_entered_item_event() -> &'static RoutedEvent<RoutedEventArgs>
Defines the PointerEnteredItem event.
pointer_exited_item_event
fn pointer_exited_item_event() -> &'static RoutedEvent<RoutedEventArgs>
Defines the PointerExitedItem event.
submenu_opened_event
fn submenu_opened_event() -> &'static RoutedEvent<RoutedEventArgs>
Defines the SubmenuOpened event.
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
click
fn click(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when a MenuItem without a submenu is clicked.
pointer_entered_item
fn pointer_entered_item(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when the pointer enters a menu item.
A bubbling version of the pointer entered event for menu items.
pointer_exited_item
fn pointer_exited_item(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Raised when the pointer leaves a menu item.
A bubbling version of the pointer exited event for menu items.
submenu_opened
fn submenu_opened(self: &Self, handler: impl Fn(&Interactive, &RoutedEventArgs) -> () + 'static) -> RoutedEventHandlerToken
Occurs when a MenuItem's submenu is opened.
command
fn command(self: &Self) -> Option<Rc<dyn ICommand>>
Gets or sets the command associated with the menu item.
set_command
fn set_command(self: &Self, value: Option<Rc<dyn ICommand>>)
hot_key
fn hot_key(self: &Self) -> Option<KeyGesture>
Gets or sets a key gesture associated with this control.
set_hot_key
fn set_hot_key(self: &Self, value: Option<KeyGesture>)
command_parameter
fn command_parameter(self: &Self) -> Option<BoxedValue>
Gets or sets the parameter to pass to the Command property of a
MenuItem.
set_command_parameter
fn set_command_parameter(self: &Self, value: Option<BoxedValue>)
icon
fn icon(self: &Self) -> Option<BoxedValue>
Gets or sets the icon that appears in a MenuItem.
set_icon
fn set_icon(self: &Self, value: Option<BoxedValue>)
input_gesture
fn input_gesture(self: &Self) -> Option<KeyGesture>
Gets or sets the input gesture that will be displayed in the menu item.
Setting this property does not cause the input gesture to be handled by the menu item, it simply displays the gesture text in the menu.
set_input_gesture
fn set_input_gesture(self: &Self, value: Option<KeyGesture>)
is_selected
fn is_selected(self: &Self) -> bool
Gets or sets a value indicating whether the MenuItem is
currently selected.
set_is_selected
fn set_is_selected(self: &Self, value: bool)
is_sub_menu_open
fn is_sub_menu_open(self: &Self) -> bool
Gets or sets a value that indicates whether the submenu of the
MenuItem is open.
set_is_sub_menu_open
fn set_is_sub_menu_open(self: &Self, value: bool)
stays_open_on_click
fn stays_open_on_click(self: &Self) -> bool
Gets or sets a value that indicates the submenu that this
MenuItem is within should not close when this item is clicked.
set_stays_open_on_click
fn set_stays_open_on_click(self: &Self, value: bool)
toggle_type
fn toggle_type(self: &Self) -> MenuItemToggleType
Gets or sets the toggle type of the menu item.
set_toggle_type
fn set_toggle_type(self: &Self, value: MenuItemToggleType)
is_checked
fn is_checked(self: &Self) -> bool
Gets or sets if menu item is checked when the toggle type is
MenuItemToggleType::CheckBox or MenuItemToggleType::Radio.
set_is_checked
fn set_is_checked(self: &Self, value: bool)
group_name
fn group_name(self: &Self) -> Option<String>
Gets or sets the menu item group name when the toggle type is
MenuItemToggleType::Radio.
set_group_name
fn set_group_name(self: &Self, value: Option<String>)
has_sub_menu
fn has_sub_menu(self: &Self) -> bool
Gets a value that indicates whether the MenuItem has a submenu.
is_top_level
fn is_top_level(self: &Self) -> bool
Gets a value that indicates whether the MenuItem is a top-level
main menu item.
open
fn open(self: &Self)
Opens the submenu.
This has the same effect as setting IsSubMenuOpen to true.
close
fn close(self: &Self)
Closes the submenu.
This has the same effect as setting IsSubMenuOpen to false.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtHeaderedSelectingItemsControlImplExtSelectingItemsControlImplExtControlImplExtMenuItemImplExtItemsControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<MenuItem>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleLayoutableImplInteractiveImplSelectingItemsControlImplHeaderedSelectingItemsControlImplControlImplFerroObjectImplStyledElementImplVisualImplInputElementImplTemplatedControlImplItemsControlImplMenuItemImplISelectable
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.