NativeMenu
struct · ferroui-controls · v0.5.0
struct NativeMenu
A menu that is shown by the platform: the menu of a window or of the application, the menu of a tray icon or of the dock.
Members
TYPEto_refparent_propertyconstructnewitemsneeds_updateopeningclosedparentto_exporter_events_bridgeadditeris_native_menu_exported_propertymenu_propertyget_is_native_menu_exportedset_menuget_menu
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<NativeMenu>
Returns a strong reference to this object.
parent_property
fn parent_property() -> &'static DirectProperty<NativeMenu, Option<Ref<NativeMenuItem>>>
Defines the Parent property.
construct
fn construct() -> Self
Creates the class data; see FerroObject::construct.
new
fn new() -> Ref<Self>
items
fn items(self: &Self) -> FerroList<Ref<NativeMenuItemBase>>
The items of the menu.
needs_update
fn needs_update(self: &Self, handler: impl Fn(&NativeMenu) -> () + 'static) -> Subscription
Raised when the menu requests an update.
Use this event to add, remove or modify menu items before a menu is shown or a hotkey is pressed.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the menu.
opening
fn opening(self: &Self, handler: impl Fn(&NativeMenu) -> () + 'static) -> Subscription
Raised before the menu is opened.
Do not update the menu in this event; use
needs_update.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the menu.
closed
fn closed(self: &Self, handler: impl Fn(&NativeMenu) -> () + 'static) -> Subscription
Raised after the menu is closed.
Do not update the menu in this event; use
needs_update.
Dropping the returned guard removes the handler; Subscription::detach keeps it for the
life of the menu.
parent
fn parent(self: &Self) -> Option<Ref<NativeMenuItem>>
The item the menu is the submenu of.
to_exporter_events_bridge
fn to_exporter_events_bridge(self: &Self) -> Rc<dyn INativeMenuExporterEventsImplBridge>
The menu viewed as the contract through which the platform exporter of the menu raises its events.
add
fn add(self: &Self, item: impl IntoRef<NativeMenuItemBase>)
Adds an item to the menu.
iter
fn iter(self: &Self) -> std::vec::IntoIter<Ref<NativeMenuItemBase>>
Enumerates the items of the menu.
is_native_menu_exported_property
fn is_native_menu_exported_property() -> &'static AttachedProperty<bool>
Defines the IsNativeMenuExported attached property.
menu_property
fn menu_property() -> &'static AttachedProperty<Option<Ref<NativeMenu>>>
Defines the Menu attached property.
get_is_native_menu_exported
fn get_is_native_menu_exported(tl: &TopLevel) -> bool
Whether the native menu of the top-level is exported to the platform.
set_menu
fn set_menu(o: &FerroObject, menu: Option<Ref<NativeMenu>>)
Sets the native menu of an object: a top-level, the application or an object that provides a native menu exporter.
get_menu
fn get_menu(o: &FerroObject) -> Option<Ref<NativeMenu>>
Gets the native menu of an object.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyFerroObjectImplExtClassDefaultsErasedDestructorIntoEitherDerefUpcast<T>Upcast<NativeMenu>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleFerroObjectImplIntoIterator
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.