diff options
author | 2022-08-05 22:31:26 +0200 | |
---|---|---|
committer | 2022-08-05 22:31:26 +0200 | |
commit | f294c2d16249ce8b7989f8af6332678f53d8fb12 (patch) | |
tree | bb8d6f00fe25de9187b1d3b90a88ae95225b7428 /native/src/user_interface.rs | |
parent | a003e797e8a1bb5d365c1db5de6af88e61a47329 (diff) | |
parent | ad5bd0970d7106a97d455a164a582ab1d0bff18b (diff) | |
download | iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.tar.gz iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.tar.bz2 iced-f294c2d16249ce8b7989f8af6332678f53d8fb12.zip |
Merge pull request #1399 from iced-rs/widget-operations
Widget Operations
Diffstat (limited to 'native/src/user_interface.rs')
-rw-r--r-- | native/src/user_interface.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/native/src/user_interface.rs b/native/src/user_interface.rs index 9f3a8e21..42669f95 100644 --- a/native/src/user_interface.rs +++ b/native/src/user_interface.rs @@ -479,6 +479,29 @@ 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( + &mut self.state, + 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 { |