Make Widget::layout and operate mutable

... and bless `responsive`!
This commit is contained in:
Héctor Ramón Jiménez 2025-08-20 22:42:15 +02:00
parent 9490d735c5
commit 31bc6d48cd
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
54 changed files with 284 additions and 519 deletions

View file

@ -176,7 +176,7 @@ where
}
fn layout(
&self,
&mut self,
tree: &mut Tree,
renderer: &Renderer,
limits: &layout::Limits,
@ -220,10 +220,10 @@ where
let mut row_height = 0.0f32;
for (i, (child, tree)) in
self.children.iter().zip(&mut tree.children).enumerate()
self.children.iter_mut().zip(&mut tree.children).enumerate()
{
let node = child
.as_widget()
.as_widget_mut()
.layout(tree, renderer, &cell_limits)
.move_to((x, y));
@ -251,7 +251,7 @@ where
}
fn operate(
&self,
&mut self,
tree: &mut Tree,
layout: Layout<'_>,
renderer: &Renderer,
@ -259,12 +259,12 @@ where
) {
operation.container(None, layout.bounds(), &mut |operation| {
self.children
.iter()
.iter_mut()
.zip(&mut tree.children)
.zip(layout.children())
.for_each(|((child, state), layout)| {
child
.as_widget()
.as_widget_mut()
.operate(state, layout, renderer, operation);
});
});