Skip to main content

StatefulInteractiveElement

Trait StatefulInteractiveElement 

Source
pub trait StatefulInteractiveElement: InteractiveElement {
Show 32 methods // Provided methods fn role(self, role: Role) -> Self { ... } fn aria_label(self, label: impl Into<SharedString>) -> Self { ... } fn aria_selected(self, selected: bool) -> Self { ... } fn aria_expanded(self, expanded: bool) -> Self { ... } fn aria_toggled(self, toggled: Toggled) -> Self { ... } fn aria_numeric_value(self, value: f64) -> Self { ... } fn aria_min_numeric_value(self, value: f64) -> Self { ... } fn aria_max_numeric_value(self, value: f64) -> Self { ... } fn aria_orientation(self, orientation: Orientation) -> Self { ... } fn aria_level(self, level: usize) -> Self { ... } fn aria_position_in_set(self, position: usize) -> Self { ... } fn aria_size_of_set(self, size: usize) -> Self { ... } fn aria_row_index(self, index: usize) -> Self { ... } fn aria_column_index(self, index: usize) -> Self { ... } fn aria_row_count(self, count: usize) -> Self { ... } fn aria_column_count(self, count: usize) -> Self { ... } fn on_a11y_action( self, action: Action, listener: impl FnMut(Option<&ActionData>, &mut Window, &mut App) + 'static, ) -> Self { ... } fn focusable(self) -> Self { ... } fn overflow_scroll(self) -> Self { ... } fn overflow_x_scroll(self) -> Self { ... } fn overflow_y_scroll(self) -> Self { ... } fn track_scroll(self, scroll_handle: &ScrollHandle) -> Self { ... } fn anchor_scroll(self, scroll_anchor: Option<ScrollAnchor>) -> Self { ... } fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self where Self: Sized { ... } fn group_active( self, group_name: impl Into<SharedString>, f: impl FnOnce(StyleRefinement) -> StyleRefinement, ) -> Self where Self: Sized { ... } fn on_click( self, listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self where Self: Sized { ... } fn on_aux_click( self, listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self where Self: Sized { ... } fn on_drag<T, W>( self, value: T, constructor: impl Fn(&T, Point<Pixels>, &mut Window, &mut App) -> Entity<W> + 'static, ) -> Self where Self: Sized, T: 'static, W: 'static + Render { ... } fn on_hover( self, listener: impl Fn(&bool, &mut Window, &mut App) + 'static, ) -> Self where Self: Sized { ... } fn tooltip( self, build_tooltip: impl Fn(&mut Window, &mut App) -> AnyView + 'static, ) -> Self where Self: Sized { ... } fn hoverable_tooltip( self, build_tooltip: impl Fn(&mut Window, &mut App) -> AnyView + 'static, ) -> Self where Self: Sized { ... } fn tooltip_show_delay(self, delay: Duration) -> Self where Self: Sized { ... }
}
Expand description

A trait for elements that want to use the standard GPUI interactivity features that require state.

Provided Methods§

Source

fn role(self, role: Role) -> Self

Set the accessible role for this element.

See the accessibility guide for an overview.

Source

fn aria_label(self, label: impl Into<SharedString>) -> Self

Set the accessible label for this element.

Source

fn aria_selected(self, selected: bool) -> Self

Set the selected state for this element.

Source

fn aria_expanded(self, expanded: bool) -> Self

Set the expanded state for this element.

Source

fn aria_toggled(self, toggled: Toggled) -> Self

Set the toggled state for this element.

Source

fn aria_numeric_value(self, value: f64) -> Self

Set the numeric value for this element.

Source

fn aria_min_numeric_value(self, value: f64) -> Self

Set the minimum numeric value for this element.

Source

fn aria_max_numeric_value(self, value: f64) -> Self

Set the maximum numeric value for this element.

Source

fn aria_orientation(self, orientation: Orientation) -> Self

Set the orientation of this element.

Source

fn aria_level(self, level: usize) -> Self

Set the heading level of this element.

Source

fn aria_position_in_set(self, position: usize) -> Self

Set the position in set of this element.

Source

fn aria_size_of_set(self, size: usize) -> Self

Set the size of set for this element.

Source

fn aria_row_index(self, index: usize) -> Self

Set the row index for this element.

Source

fn aria_column_index(self, index: usize) -> Self

Set the column index for this element.

Source

fn aria_row_count(self, count: usize) -> Self

Set the row count for this element.

Source

fn aria_column_count(self, count: usize) -> Self

Set the column count for this element.

Source

fn on_a11y_action( self, action: Action, listener: impl FnMut(Option<&ActionData>, &mut Window, &mut App) + 'static, ) -> Self

Register a handler for an accessibility action on this element. The handler is called when a screen reader requests the given action.

See the accessibility guide for an overview.

Source

fn focusable(self) -> Self

Set this element to focusable.

Source

fn overflow_scroll(self) -> Self

Set the overflow x and y to scroll.

Source

fn overflow_x_scroll(self) -> Self

Set the overflow x to scroll.

Source

fn overflow_y_scroll(self) -> Self

Set the overflow y to scroll.

Source

fn track_scroll(self, scroll_handle: &ScrollHandle) -> Self

Track the scroll state of this element with the given handle.

Source

fn anchor_scroll(self, scroll_anchor: Option<ScrollAnchor>) -> Self

Track the scroll state of this element with the given handle.

Source

fn active(self, f: impl FnOnce(StyleRefinement) -> StyleRefinement) -> Self
where Self: Sized,

Set the given styles to be applied when this element is active.

Source

fn group_active( self, group_name: impl Into<SharedString>, f: impl FnOnce(StyleRefinement) -> StyleRefinement, ) -> Self
where Self: Sized,

Set the given styles to be applied when this element’s group is active.

Source

fn on_click( self, listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self
where Self: Sized,

Bind the given callback to click events of this element. The fluent API equivalent to Interactivity::on_click.

See Context::listener to get access to a view’s state from this callback.

Source

fn on_aux_click( self, listener: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static, ) -> Self
where Self: Sized,

Bind the given callback to non-primary click events of this element. The fluent API equivalent to Interactivity::on_aux_click.

See Context::listener to get access to a view’s state from this callback.

Source

fn on_drag<T, W>( self, value: T, constructor: impl Fn(&T, Point<Pixels>, &mut Window, &mut App) -> Entity<W> + 'static, ) -> Self
where Self: Sized, T: 'static, W: 'static + Render,

On drag initiation, this callback will be used to create a new view to render the dragged value for a drag and drop operation. This API should also be used as the equivalent of ‘on drag start’ with the InteractiveElement::on_drag_move API. The callback also has access to the offset of triggering click from the origin of parent element. The fluent API equivalent to Interactivity::on_drag.

See Context::listener to get access to a view’s state from this callback.

Source

fn on_hover( self, listener: impl Fn(&bool, &mut Window, &mut App) + 'static, ) -> Self
where Self: Sized,

Bind the given callback on the hover start and end events of this element. Note that the boolean passed to the callback is true when the hover starts and false when it ends. The fluent API equivalent to Interactivity::on_hover.

See Context::listener to get access to a view’s state from this callback.

Source

fn tooltip( self, build_tooltip: impl Fn(&mut Window, &mut App) -> AnyView + 'static, ) -> Self
where Self: Sized,

Use the given callback to construct a new tooltip view when the mouse hovers over this element. The fluent API equivalent to Interactivity::tooltip.

Source

fn hoverable_tooltip( self, build_tooltip: impl Fn(&mut Window, &mut App) -> AnyView + 'static, ) -> Self
where Self: Sized,

Use the given callback to construct a new tooltip view when the mouse hovers over this element. The tooltip itself is also hoverable and won’t disappear when the user moves the mouse into the tooltip. The fluent API equivalent to Interactivity::hoverable_tooltip.

Source

fn tooltip_show_delay(self, delay: Duration) -> Self
where Self: Sized,

Set the delay before this element’s tooltip is shown. The fluent API equivalent to Interactivity::tooltip_show_delay.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§