FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    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.

    View source

    Members

    TYPE

    const TYPE: &'static $crate::TypeInfo
    

    The runtime type of this class.

    Source

    to_ref

    fn to_ref(self: &Self) -> $crate::Ref<NativeMenu>
    

    Returns a strong reference to this object.

    Source

    parent_property

    fn parent_property() -> &'static DirectProperty<NativeMenu, Option<Ref<NativeMenuItem>>>
    

    Defines the Parent property.

    Source

    construct

    fn construct() -> Self
    

    Creates the class data; see FerroObject::construct.

    Source

    new

    fn new() -> Ref<Self>
    

    Source

    items

    fn items(self: &Self) -> FerroList<Ref<NativeMenuItemBase>>
    

    The items of the menu.

    Source

    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.

    Source

    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.

    Source

    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.

    Source

    parent

    fn parent(self: &Self) -> Option<Ref<NativeMenuItem>>
    

    The item the menu is the submenu of.

    Source

    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.

    Source

    add

    fn add(self: &Self, item: impl IntoRef<NativeMenuItemBase>)
    

    Adds an item to the menu.

    Source

    iter

    fn iter(self: &Self) -> std::vec::IntoIter<Ref<NativeMenuItemBase>>
    

    Enumerates the items of the menu.

    Source

    is_native_menu_exported_property

    fn is_native_menu_exported_property() -> &'static AttachedProperty<bool>
    

    Defines the IsNativeMenuExported attached property.

    Source

    menu_property

    fn menu_property() -> &'static AttachedProperty<Option<Ref<NativeMenu>>>
    

    Defines the Menu attached property.

    Source

    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.

    Source

    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.

    Source

    get_menu

    fn get_menu(o: &FerroObject) -> Option<Ref<NativeMenu>>
    

    Gets the native menu of an object.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.