diff options
author | 2023-01-14 03:20:30 +0100 | |
---|---|---|
committer | 2023-01-14 03:20:30 +0100 | |
commit | daa3f3324d001b634f73779423da605c213e7626 (patch) | |
tree | 634f929a715258a61edfcecd747f95a7d903b3b4 /native/src/element.rs | |
parent | 18552f96df5d1fa72c3c87e96a5765f89c340e19 (diff) | |
download | iced-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/element.rs')
-rw-r--r-- | native/src/element.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/native/src/element.rs b/native/src/element.rs index 2409b1c9..0a677d20 100644 --- a/native/src/element.rs +++ b/native/src/element.rs @@ -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( |