Rename Drawable::boxed to into_element and make containers generic

Multi-element are now generic over any drawable child, which can be converted
into an element.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-04-21 18:36:21 +02:00 committed by Nathan Sobo
parent 4d433663bd
commit 03619dfa55
80 changed files with 1132 additions and 1434 deletions

View file

@ -165,7 +165,7 @@ impl Member {
Border::default()
};
let prompt = if let Some((_, leader)) = leader {
let leader_status_box = if let Some((_, leader)) = leader {
match leader.location {
ParticipantLocation::SharedProject {
project_id: leader_project_id,
@ -195,7 +195,6 @@ impl Member {
.with_style(
theme.workspace.external_location_message.container,
)
.boxed()
},
)
.with_cursor_style(CursorStyle::PointingHand)
@ -208,7 +207,7 @@ impl Member {
.aligned()
.bottom()
.right()
.boxed(),
.into_element(),
)
}
}
@ -225,7 +224,7 @@ impl Member {
.aligned()
.bottom()
.right()
.boxed(),
.into_element(),
),
ParticipantLocation::External => Some(
Label::new(
@ -240,7 +239,7 @@ impl Member {
.aligned()
.bottom()
.right()
.boxed(),
.into_element(),
),
}
} else {
@ -248,14 +247,9 @@ impl Member {
};
Stack::new()
.with_child(
ChildView::new(pane, cx)
.contained()
.with_border(border)
.boxed(),
)
.with_children(prompt)
.boxed()
.with_child(ChildView::new(pane, cx).contained().with_border(border))
.with_children(leader_status_box)
.into_element()
}
Member::Axis(axis) => axis.render(
project,
@ -388,12 +382,12 @@ impl PaneAxis {
Axis::Vertical => border.bottom = true,
Axis::Horizontal => border.right = true,
}
member = Container::new(member).with_border(border).boxed();
member = member.contained().with_border(border).into_element();
}
FlexItem::new(member).flex(flex, true).boxed()
FlexItem::new(member).flex(flex, true)
}))
.boxed()
.into_element()
}
}