Trait Operation
pub trait Operation<T = ()>: Send {
// Required method
fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<T>));
// Provided methods
fn container(&mut self, _id: Option<&Id>, _bounds: Rectangle) { ... }
fn scrollable(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_content_bounds: Rectangle,
_translation: Vector,
_state: &mut dyn Scrollable,
) { ... }
fn focusable(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut dyn Focusable,
) { ... }
fn text_input(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut dyn TextInput,
) { ... }
fn text(&mut self, _id: Option<&Id>, _bounds: Rectangle, _text: &str) { ... }
fn custom(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut (dyn Any + 'static),
) { ... }
fn finish(&self) -> Outcome<T> { ... }
fn set_window_id(&mut self, _id: Id) { ... }
fn pre_operation(&mut self, _id: Option<&Id>) { ... }
}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§
fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<T>))
fn traverse(&mut self, operate: &mut dyn FnMut(&mut dyn Operation<T>))
Requests further traversal of the widget tree to keep operating.
The provided operate closure may be called by an Operation
to return control to the widget tree and keep traversing it. If
the closure is not called, the children of the widget asking for
traversal will be skipped.
Provided Methods§
fn container(&mut self, _id: Option<&Id>, _bounds: Rectangle)
fn container(&mut self, _id: Option<&Id>, _bounds: Rectangle)
Operates on a widget that contains other widgets.
fn scrollable(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_content_bounds: Rectangle,
_translation: Vector,
_state: &mut dyn Scrollable,
)
fn scrollable( &mut self, _id: Option<&Id>, _bounds: Rectangle, _content_bounds: Rectangle, _translation: Vector, _state: &mut dyn Scrollable, )
Operates on a widget that can be scrolled.
fn focusable(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut dyn Focusable,
)
fn focusable( &mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut dyn Focusable, )
Operates on a widget that can be focused.
fn text_input(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut dyn TextInput,
)
fn text_input( &mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut dyn TextInput, )
Operates on a widget that has text input.
fn text(&mut self, _id: Option<&Id>, _bounds: Rectangle, _text: &str)
fn text(&mut self, _id: Option<&Id>, _bounds: Rectangle, _text: &str)
Operates on a widget that contains some text.
fn custom(
&mut self,
_id: Option<&Id>,
_bounds: Rectangle,
_state: &mut (dyn Any + 'static),
)
fn custom( &mut self, _id: Option<&Id>, _bounds: Rectangle, _state: &mut (dyn Any + 'static), )
Operates on a custom widget with some state.
fn set_window_id(&mut self, _id: Id)
fn set_window_id(&mut self, _id: Id)
Track the active window id being processed if relevant to the operation
fn pre_operation(&mut self, _id: Option<&Id>)
fn pre_operation(&mut self, _id: Option<&Id>)
Used to mark the beginning of operations for a widget and its children