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

@ -153,26 +153,22 @@ impl View for GoToLine {
self.max_point.row + 1
);
ConstrainedBox::new(
Container::new(
Flex::new(Axis::Vertical)
.with_child(
Container::new(ChildView::new(&self.line_editor, cx).boxed())
.with_style(theme.input_editor.container)
.boxed(),
)
.with_child(
Container::new(Label::new(label, theme.no_matches.label.clone()).boxed())
.with_style(theme.no_matches.container)
.boxed(),
)
.boxed(),
Flex::new(Axis::Vertical)
.with_child(
ChildView::new(&self.line_editor, cx)
.contained()
.with_style(theme.input_editor.container),
)
.with_child(
Label::new(label, theme.no_matches.label.clone())
.contained()
.with_style(theme.no_matches.container),
)
.contained()
.with_style(theme.container)
.boxed(),
)
.with_max_width(500.0)
.named("go to line")
.constrained()
.with_max_width(500.0)
.into_named_element("go to line")
}
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {