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
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue