Introduce custom method to widget::Operation trait
This allows users to write operations for their custom widgets.
This commit is contained in:
parent
18552f96df
commit
daa3f3324d
4 changed files with 24 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue