ContextMenuExt

Trait ContextMenuExt 

Source
pub trait ContextMenuExt: ParentElement + Styled {
    // Provided method
    fn context_menu(
        self,
        f: impl Fn(PopupMenu, &mut Window, &mut Context<'_, PopupMenu>) -> PopupMenu + 'static,
    ) -> ContextMenu<Self> { ... }
}
Expand description

A extension trait for adding a context menu to an element.

Provided Methods§

Source

fn context_menu( self, f: impl Fn(PopupMenu, &mut Window, &mut Context<'_, PopupMenu>) -> PopupMenu + 'static, ) -> ContextMenu<Self>

Add a context menu to the element.

This will changed the element to be relative positioned, and add a child ContextMenu element. Because the ContextMenu element is positioned absolute, it will not affect the layout of the parent element.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§