Make Widget::layout and operate mutable
... and bless `responsive`!
This commit is contained in:
parent
9490d735c5
commit
31bc6d48cd
54 changed files with 284 additions and 519 deletions
|
|
@ -165,12 +165,12 @@ where
|
|||
}
|
||||
|
||||
pub(crate) fn layout(
|
||||
&self,
|
||||
&mut self,
|
||||
tree: &mut Tree,
|
||||
renderer: &Renderer,
|
||||
limits: &layout::Limits,
|
||||
) -> layout::Node {
|
||||
if let Some(title_bar) = &self.title_bar {
|
||||
if let Some(title_bar) = &mut self.title_bar {
|
||||
let max_size = limits.max();
|
||||
|
||||
let title_bar_layout = title_bar.layout(
|
||||
|
|
@ -181,7 +181,7 @@ where
|
|||
|
||||
let title_bar_size = title_bar_layout.size();
|
||||
|
||||
let body_layout = self.body.as_widget().layout(
|
||||
let body_layout = self.body.as_widget_mut().layout(
|
||||
&mut tree.children[0],
|
||||
renderer,
|
||||
&layout::Limits::new(
|
||||
|
|
@ -201,7 +201,7 @@ where
|
|||
],
|
||||
)
|
||||
} else {
|
||||
self.body.as_widget().layout(
|
||||
self.body.as_widget_mut().layout(
|
||||
&mut tree.children[0],
|
||||
renderer,
|
||||
limits,
|
||||
|
|
@ -210,13 +210,13 @@ where
|
|||
}
|
||||
|
||||
pub(crate) fn operate(
|
||||
&self,
|
||||
&mut self,
|
||||
tree: &mut Tree,
|
||||
layout: Layout<'_>,
|
||||
renderer: &Renderer,
|
||||
operation: &mut dyn widget::Operation,
|
||||
) {
|
||||
let body_layout = if let Some(title_bar) = &self.title_bar {
|
||||
let body_layout = if let Some(title_bar) = &mut self.title_bar {
|
||||
let mut children = layout.children();
|
||||
|
||||
title_bar.operate(
|
||||
|
|
@ -231,7 +231,7 @@ where
|
|||
layout
|
||||
};
|
||||
|
||||
self.body.as_widget().operate(
|
||||
self.body.as_widget_mut().operate(
|
||||
&mut tree.children[0],
|
||||
body_layout,
|
||||
renderer,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue