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

@ -7,6 +7,8 @@ use crate::renderer;
use crate::widget;
use crate::{Clipboard, Layout, Point, Rectangle, Shell, Size, Vector};
use std::any::Any;
/// A generic [`Overlay`].
#[allow(missing_debug_implementations)]
pub struct Element<'a, Message, Renderer> {
@ -188,6 +190,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.content