iced::advanced::widget::operation

Trait Operation

Source
pub trait Operation<T = ()>: Send {
    // Required method
    fn container(
        &mut self,
        id: Option<&Id>,
        bounds: Rectangle,
        operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>),
    );

    // Provided methods
    fn focusable(&mut self, _state: &mut dyn Focusable, _id: Option<&Id>) { ... }
    fn scrollable(
        &mut self,
        _state: &mut dyn Scrollable,
        _id: Option<&Id>,
        _bounds: Rectangle,
        _content_bounds: Rectangle,
        _translation: Vector,
    ) { ... }
    fn text_input(&mut self, _state: &mut dyn TextInput, _id: Option<&Id>) { ... }
    fn custom(&mut self, _state: &mut (dyn Any + 'static), _id: Option<&Id>) { ... }
    fn finish(&self) -> Outcome<T> { ... }
}
Available on crate feature advanced only.
Expand description

A piece of logic that can traverse the widget tree of an application in order to query or update some widget state.

Required Methods§

Source

fn container( &mut self, id: Option<&Id>, bounds: Rectangle, operate_on_children: &mut dyn FnMut(&mut dyn Operation<T>), )

Operates on a widget that contains other widgets.

The operate_on_children function can be called to return control to the widget tree and keep traversing it.

Provided Methods§

Source

fn focusable(&mut self, _state: &mut dyn Focusable, _id: Option<&Id>)

Operates on a widget that can be focused.

Source

fn scrollable( &mut self, _state: &mut dyn Scrollable, _id: Option<&Id>, _bounds: Rectangle, _content_bounds: Rectangle, _translation: Vector, )

Operates on a widget that can be scrolled.

Source

fn text_input(&mut self, _state: &mut dyn TextInput, _id: Option<&Id>)

Operates on a widget that has text input.

Source

fn custom(&mut self, _state: &mut (dyn Any + 'static), _id: Option<&Id>)

Operates on a custom widget with some state.

Source

fn finish(&self) -> Outcome<T>

Finishes the Operation and returns its Outcome.

Implementations on Foreign Types§

Source§

impl<T, O> Operation<O> for Box<T>
where T: Operation<O> + ?Sized,

Source§

fn container( &mut self, id: Option<&Id>, bounds: Rectangle, operate_on_children: &mut dyn FnMut(&mut dyn Operation<O>), )

Source§

fn focusable(&mut self, state: &mut dyn Focusable, id: Option<&Id>)

Source§

fn scrollable( &mut self, state: &mut dyn Scrollable, id: Option<&Id>, bounds: Rectangle, content_bounds: Rectangle, translation: Vector, )

Source§

fn text_input(&mut self, state: &mut dyn TextInput, id: Option<&Id>)

Source§

fn custom(&mut self, state: &mut (dyn Any + 'static), id: Option<&Id>)

Source§

fn finish(&self) -> Outcome<O>

Implementors§