Add Renderer argument to operate

This commit is contained in:
Héctor Ramón Jiménez 2022-12-22 14:29:24 +01:00
parent 678de11879
commit 0e9c1ab192
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
17 changed files with 50 additions and 8 deletions

View file

@ -325,11 +325,13 @@ mod modal {
&self,
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
self.base.as_widget().operate(
&mut state.children[0],
layout,
renderer,
operation,
);
}
@ -436,11 +438,13 @@ mod modal {
fn operate(
&mut self,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
self.content.as_widget().operate(
self.tree,
layout.children().next().unwrap(),
renderer,
operation,
);
}

View file

@ -234,6 +234,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
struct MapOperation<'a, B> {
@ -274,6 +275,7 @@ where
element.as_widget().operate(
&mut tree.children[0],
layout,
renderer,
&mut MapOperation { operation },
);
});

View file

@ -130,12 +130,14 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
self.with_element(|element| {
element.as_widget().operate(
&mut tree.children[0],
layout,
renderer,
operation,
);
});

View file

@ -290,6 +290,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<B>,
) {
struct MapOperation<'a, B> {
@ -334,8 +335,12 @@ where
}
}
self.widget
.operate(tree, layout, &mut MapOperation { operation });
self.widget.operate(
tree,
layout,
renderer,
&mut MapOperation { operation },
);
}
fn on_event(
@ -473,9 +478,12 @@ where
&self,
state: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
self.element.widget.operate(state, layout, operation)
self.element
.widget
.operate(state, layout, renderer, operation)
}
fn on_event(

View file

@ -46,6 +46,7 @@ where
fn operate(
&mut self,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn widget::Operation<Message>,
) {
}

View file

@ -108,9 +108,10 @@ where
pub fn operate(
&mut self,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
self.overlay.operate(layout, operation);
self.overlay.operate(layout, renderer, operation);
}
}
@ -144,6 +145,7 @@ where
fn operate(
&mut self,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<B>,
) {
struct MapOperation<'a, B> {
@ -189,7 +191,7 @@ where
}
self.content
.operate(layout, &mut MapOperation { operation });
.operate(layout, renderer, &mut MapOperation { operation });
}
fn on_event(

View file

@ -493,6 +493,7 @@ where
self.root.as_widget().operate(
&mut self.state,
Layout::new(&self.base),
renderer,
operation,
);
@ -507,6 +508,7 @@ where
overlay.operate(
Layout::new(self.overlay.as_ref().unwrap()),
renderer,
operation,
);
}

View file

@ -175,6 +175,7 @@ where
&self,
_state: &mut Tree,
_layout: Layout<'_>,
_renderer: &Renderer,
_operation: &mut dyn Operation<Message>,
) {
}

View file

@ -169,12 +169,14 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
operation.container(None, &mut |operation| {
self.content.as_widget().operate(
&mut tree.children[0],
layout.children().next().unwrap(),
renderer,
operation,
);
});

View file

@ -147,6 +147,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
operation.container(None, &mut |operation| {
@ -155,7 +156,9 @@ where
.zip(&mut tree.children)
.zip(layout.children())
.for_each(|((child, state), layout)| {
child.as_widget().operate(state, layout, operation);
child
.as_widget()
.operate(state, layout, renderer, operation);
})
});
}

View file

@ -169,12 +169,14 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
operation.container(None, &mut |operation| {
self.content.as_widget().operate(
&mut tree.children[0],
layout.children().next().unwrap(),
renderer,
operation,
);
});

View file

@ -294,6 +294,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
operation.container(None, &mut |operation| {
@ -302,7 +303,7 @@ where
.zip(&mut tree.children)
.zip(layout.children())
.for_each(|(((_pane, content), state), layout)| {
content.operate(state, layout, operation);
content.operate(state, layout, renderer, operation);
})
});
}

View file

@ -187,6 +187,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
let body_layout = if let Some(title_bar) = &self.title_bar {
@ -195,6 +196,7 @@ where
title_bar.operate(
&mut tree.children[1],
children.next().unwrap(),
renderer,
operation,
);
@ -206,6 +208,7 @@ where
self.body.as_widget().operate(
&mut tree.children[0],
body_layout,
renderer,
operation,
);
}

View file

@ -261,6 +261,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn widget::Operation<Message>,
) {
let mut children = layout.children();
@ -282,6 +283,7 @@ where
controls.as_widget().operate(
&mut tree.children[1],
controls_layout,
renderer,
operation,
)
};
@ -290,6 +292,7 @@ where
self.content.as_widget().operate(
&mut tree.children[0],
title_layout,
renderer,
operation,
)
}

View file

@ -134,6 +134,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
operation.container(None, &mut |operation| {
@ -142,7 +143,9 @@ where
.zip(&mut tree.children)
.zip(layout.children())
.for_each(|((child, state), layout)| {
child.as_widget().operate(state, layout, operation);
child
.as_widget()
.operate(state, layout, renderer, operation);
})
});
}

View file

@ -164,6 +164,7 @@ where
&self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
let state = tree.state.downcast_mut::<State>();
@ -174,6 +175,7 @@ where
self.content.as_widget().operate(
&mut tree.children[0],
layout.children().next().unwrap(),
renderer,
operation,
);
});

View file

@ -228,6 +228,7 @@ where
&self,
tree: &mut Tree,
_layout: Layout<'_>,
_renderer: &Renderer,
operation: &mut dyn Operation<Message>,
) {
let state = tree.state.downcast_mut::<State>();