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

@ -50,7 +50,6 @@ impl View for DeployFeedbackButton {
.with_height(style.icon_size)
.contained()
.with_style(style.container)
.boxed()
})
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, move |_, _, cx| {
@ -64,10 +63,9 @@ impl View for DeployFeedbackButton {
Some(Box::new(GiveFeedback)),
theme.tooltip.clone(),
cx,
)
.boxed(),
),
)
.boxed()
.into_element()
}
}

View file

@ -231,7 +231,7 @@ impl View for FeedbackEditor {
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
ChildView::new(&self.editor, cx).boxed()
ChildView::new(&self.editor, cx).into_element()
}
fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<Self>) {
@ -264,16 +264,14 @@ impl Item for FeedbackEditor {
.with_width(style.type_icon_width)
.aligned()
.contained()
.with_margin_right(style.spacing)
.boxed(),
.with_margin_right(style.spacing),
)
.with_child(
Label::new("Send Feedback", style.label.clone())
.aligned()
.contained()
.boxed(),
.contained(),
)
.boxed()
.into_element()
}
fn for_each_project_item(&self, cx: &AppContext, f: &mut dyn FnMut(usize, &dyn project::Item)) {

View file

@ -39,8 +39,7 @@ impl View for FeedbackInfoText {
theme.feedback.info_text_default.text.clone(),
)
.with_soft_wrap(false)
.aligned()
.boxed(),
.aligned(),
)
.with_child(
MouseEventHandler::<OpenZedCommunityRepo, Self>::new(0, cx, |state, _| {
@ -55,24 +54,21 @@ impl View for FeedbackInfoText {
.aligned()
.left()
.clipped()
.boxed()
})
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, |_, _, cx| {
cx.dispatch_action(OpenZedCommunityRepo)
})
.boxed(),
}),
)
.with_child(
Text::new(" on GitHub.", theme.feedback.info_text_default.text.clone())
.with_soft_wrap(false)
.aligned()
.boxed(),
.aligned(),
)
.aligned()
.left()
.clipped()
.boxed()
.into_element()
}
}

View file

@ -37,7 +37,6 @@ impl View for SubmitFeedbackButton {
Label::new("Submit as Markdown", style.text.clone())
.contained()
.with_style(style.container)
.boxed()
})
.with_cursor_style(CursorStyle::PointingHand)
.on_click(MouseButton::Left, |_, _, cx| {
@ -53,7 +52,7 @@ impl View for SubmitFeedbackButton {
theme.tooltip.clone(),
cx,
)
.boxed()
.into_element()
}
}