Draft widget operations

This commit is contained in:
Héctor Ramón Jiménez 2022-07-28 02:46:51 +02:00
parent a003e797e8
commit 80688689aa
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
16 changed files with 395 additions and 55 deletions

View file

@ -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 {