Skip to main content

MaterialElementExt

Trait MaterialElementExt 

Source
pub trait MaterialElementExt: IntoElement + Sized {
    // Provided methods
    fn badge_dot(self) -> Badge { ... }
    fn badge_label(self, text: impl Into<SharedString>) -> Badge { ... }
    fn badge_count(self, count: usize, maximum: usize) -> Badge { ... }
    fn tooltip(
        self,
        id: impl Into<ElementId>,
        text: impl Into<SharedString>,
    ) -> Tooltip { ... }
    fn context_menu(
        self,
        id: impl Into<ElementId>,
        items: impl IntoIterator<Item = MenuItem>,
    ) -> Menu { ... }
    fn context_menu_with<I>(
        self,
        id: impl Into<ElementId>,
        build: impl FnOnce(&mut Window, &mut App) -> I + 'static,
    ) -> Menu
       where I: IntoIterator<Item = MenuItem> { ... }
}
Expand description

Fluent postfix composition helpers for attaching Material badges, tooltips, and context menus to any GPUI element.

Provided Methods§

Source

fn badge_dot(self) -> Badge

Anchors a small dot Badge to this element’s upper trailing edge.

Source

fn badge_label(self, text: impl Into<SharedString>) -> Badge

Anchors a text Badge to this element’s upper trailing edge.

Source

fn badge_count(self, count: usize, maximum: usize) -> Badge

Anchors a capped numeric Badge to this element’s upper trailing edge.

Source

fn tooltip( self, id: impl Into<ElementId>, text: impl Into<SharedString>, ) -> Tooltip

Wraps this element as the trigger of a plain Tooltip.

Source

fn context_menu( self, id: impl Into<ElementId>, items: impl IntoIterator<Item = MenuItem>, ) -> Menu

Wraps this element as the trigger of a secondary-click context Menu.

Source

fn context_menu_with<I>( self, id: impl Into<ElementId>, build: impl FnOnce(&mut Window, &mut App) -> I + 'static, ) -> Menu
where I: IntoIterator<Item = MenuItem>,

Wraps this element as the trigger of a secondary-click context Menu whose items are built lazily only while the menu is open.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§