diff options
author | 2022-07-28 02:46:51 +0200 | |
---|---|---|
committer | 2022-07-28 02:46:51 +0200 | |
commit | 80688689aa4b15bc23824df899974a9094a77b07 (patch) | |
tree | bbfce1c91b9ee22990503a55d31d04cadf4093b7 /native/src/user_interface.rs | |
parent | a003e797e8a1bb5d365c1db5de6af88e61a47329 (diff) | |
download | iced-80688689aa4b15bc23824df899974a9094a77b07.tar.gz iced-80688689aa4b15bc23824df899974a9094a77b07.tar.bz2 iced-80688689aa4b15bc23824df899974a9094a77b07.zip |
Draft widget operations
Diffstat (limited to 'native/src/user_interface.rs')
-rw-r--r-- | native/src/user_interface.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 9f3a8e21..25557240 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -479,6 +479,27 @@ where .unwrap_or(base_interaction) } + /// Applies a [`widget::Operation`] to the [`UserInterface`]. + pub fn operate( + &mut self, + renderer: &Renderer, + operation: &mut dyn widget::Operation<Message>, + ) { + self.root + .as_widget() + .operate(Layout::new(&self.base), operation); + + if let Some(layout) = self.overlay.as_ref() { + if let Some(overlay) = self.root.as_widget().overlay( + &mut self.state, + Layout::new(&self.base), + renderer, + ) { + overlay.operate(Layout::new(layout), operation); + } + } + } + /// Relayouts and returns a new [`UserInterface`] using the provided /// bounds. pub fn relayout(self, bounds: Size, renderer: &mut Renderer) -> Self { |