summaryrefslogtreecommitdiffstats
path: root/native/src/widget/operation.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-14 03:20:30 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-01-14 03:20:30 +0100
commitdaa3f3324d001b634f73779423da605c213e7626 (patch)
tree634f929a715258a61edfcecd747f95a7d903b3b4 /native/src/widget/operation.rs
parent18552f96df5d1fa72c3c87e96a5765f89c340e19 (diff)
downloadiced-daa3f3324d001b634f73779423da605c213e7626.tar.gz
iced-daa3f3324d001b634f73779423da605c213e7626.tar.bz2
iced-daa3f3324d001b634f73779423da605c213e7626.zip
Introduce `custom` method to `widget::Operation` trait
This allows users to write operations for their custom widgets.
Diffstat (limited to 'native/src/widget/operation.rs')
-rw-r--r--native/src/widget/operation.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/native/src/widget/operation.rs b/native/src/widget/operation.rs
index a0aa4117..73e6a6b0 100644
--- a/native/src/widget/operation.rs
+++ b/native/src/widget/operation.rs
@@ -9,6 +9,7 @@ pub use text_input::TextInput;
use crate::widget::Id;
+use std::any::Any;
use std::fmt;
/// A piece of logic that can traverse the widget tree of an application in
@@ -33,6 +34,9 @@ pub trait Operation<T> {
/// Operates on a widget that has text input.
fn text_input(&mut self, _state: &mut dyn TextInput, _id: Option<&Id>) {}
+ /// Operates on a custom widget with some state.
+ fn custom(&mut self, _state: &mut dyn Any, _id: Option<&Id>) {}
+
/// Finishes the [`Operation`] and returns its [`Outcome`].
fn finish(&self) -> Outcome<T> {
Outcome::None