summaryrefslogtreecommitdiffstats
path: root/native/src/overlay
diff options
context:
space:
mode:
Diffstat (limited to 'native/src/overlay')
-rw-r--r--native/src/overlay/element.rs43
1 files changed, 43 insertions, 0 deletions
diff --git a/native/src/overlay/element.rs b/native/src/overlay/element.rs
index b919c221..9500df27 100644
--- a/native/src/overlay/element.rs
+++ b/native/src/overlay/element.rs
@@ -141,6 +141,49 @@ where
self.content.layout(renderer, bounds, position)
}
+ fn operate(
+ &self,
+ layout: Layout<'_>,
+ operation: &mut dyn widget::Operation<B>,
+ ) {
+ struct MapOperation<'a, B> {
+ operation: &'a mut dyn widget::Operation<B>,
+ }
+
+ impl<'a, T, B> widget::Operation<T> for MapOperation<'a, B> {
+ fn container(
+ &mut self,
+ id: Option<&widget::Id>,
+ operate_on_children: &mut dyn FnMut(
+ &mut dyn widget::Operation<T>,
+ ),
+ ) {
+ self.operation.container(id, &mut |operation| {
+ operate_on_children(&mut MapOperation { operation });
+ });
+ }
+
+ fn focusable(
+ &mut self,
+ state: &mut dyn widget::operation::Focusable,
+ id: Option<&widget::Id>,
+ ) {
+ self.operation.focusable(state, id);
+ }
+
+ fn scrollable(
+ &mut self,
+ state: &mut dyn widget::operation::Scrollable,
+ id: Option<&widget::Id>,
+ ) {
+ self.operation.scrollable(state, id);
+ }
+ }
+
+ self.content
+ .operate(layout, &mut MapOperation { operation });
+ }
+
fn on_event(
&mut self,
event: Event,