Skip to main content

MenuControllerLeaf

Trait MenuControllerLeaf 

Source
pub trait MenuControllerLeaf: Sized + 'static {
    // Required methods
    fn menu_controller_data(
        self: Handle<Self>,
        app: &App,
    ) -> &MenuControllerData;
    fn menu_controller_data_mut(
        self: Handle<Self>,
        app: &mut App,
    ) -> &mut MenuControllerData;

    // Provided methods
    fn is_open(self: Handle<Self>, app: &App) -> bool { ... }
    fn open(self: Handle<Self>, app: &mut App, position: Option<Offset>) { ... }
    fn close(self: Handle<Self>, app: &mut App) { ... }
    fn close_children(self: Handle<Self>, app: &mut App) { ... }
    fn as_menu_controller(self: Handle<Self>) -> AnyMenuController { ... }
}
Expand description

The trait every menu-controller leaf implements: MenuController, and a type an app writes where Dart extends MenuController.

The members a subclass overrides are the ones with a default body here; the shared bodies are associated functions on MenuController, which an override calls where Dart writes super.….

Required Methods§

Source

fn menu_controller_data(self: Handle<Self>, app: &App) -> &MenuControllerData

Dart’s MenuController fields, held under the field menu_controller (menu_controller_accessors!).

Source

fn menu_controller_data_mut( self: Handle<Self>, app: &mut App, ) -> &mut MenuControllerData

Provided Methods§

Source

fn is_open(self: Handle<Self>, app: &App) -> bool

Whether or not the menu associated with this MenuController is open.

Source

fn open(self: Handle<Self>, app: &mut App, position: Option<Offset>)

Opens the menu that this MenuController is associated with.

If position is given, then the menu will open at the position given, in the coordinate space of the RawMenuAnchor that this controller is attached to.

If the menu’s anchor point is scrolled by an ancestor, or the view changes size, then any open menu will automatically close.

Source

fn close(self: Handle<Self>, app: &mut App)

Close the menu that this MenuController is associated with.

Associating with a menu is done by passing a MenuController to a RawMenuAnchor or a RawMenuAnchorGroup.

If the menu’s anchor point is scrolled by an ancestor, or the view changes size, then any open menu will automatically close.

Source

fn close_children(self: Handle<Self>, app: &mut App)

Close the children of the menu associated with this MenuController, without closing the menu itself.

Source

fn as_menu_controller(self: Handle<Self>) -> AnyMenuController

This controller as the erased AnyMenuController: what to pass where a Dart API takes a MenuController.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§