Introduce custom method to widget::Operation trait

This allows users to write operations for their custom widgets.
This commit is contained in:
Héctor Ramón Jiménez 2023-01-14 03:20:30 +01:00
parent 18552f96df
commit daa3f3324d
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
4 changed files with 24 additions and 0 deletions

View file

@ -9,6 +9,7 @@ use crate::{
Clipboard, Color, Layout, Length, Point, Rectangle, Shell, Widget,
};
use std::any::Any;
use std::borrow::Borrow;
/// A generic [`Widget`].
@ -333,6 +334,10 @@ where
) {
self.operation.text_input(state, id);
}
fn custom(&mut self, state: &mut dyn Any, id: Option<&widget::Id>) {
self.operation.custom(state, id);
}
}
self.widget.operate(