Implement Widget::operate for PaneGrid

This commit is contained in:
Ryan Scheidter 2022-11-13 14:21:27 -06:00 committed by Héctor Ramón Jiménez
parent 23299a555f
commit b0678f4c75
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
3 changed files with 85 additions and 2 deletions

View file

@ -38,6 +38,7 @@ use crate::mouse;
use crate::overlay;
use crate::renderer;
use crate::touch;
use crate::widget;
use crate::widget::container;
use crate::widget::tree::{self, Tree};
use crate::{
@ -289,6 +290,23 @@ where
)
}
fn operate(
&self,
tree: &mut Tree,
layout: Layout<'_>,
operation: &mut dyn widget::Operation<Message>,
) {
operation.container(None, &mut |operation| {
self.contents
.iter()
.zip(&mut tree.children)
.zip(layout.children())
.for_each(|(((_pane, content), state), layout)| {
content.operate(state, layout, operation);
})
});
}
fn on_event(
&mut self,
tree: &mut Tree,