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:
parent
4d433663bd
commit
03619dfa55
80 changed files with 1132 additions and 1434 deletions
|
@ -46,7 +46,7 @@ impl View for TerminalButton {
|
|||
let workspace = self.workspace.upgrade(cx);
|
||||
let project = match workspace {
|
||||
Some(workspace) => workspace.read(cx).project().read(cx),
|
||||
None => return Empty::new().boxed(),
|
||||
None => return Empty::new().into_element(),
|
||||
};
|
||||
|
||||
let focused_view = cx.focused_view_id();
|
||||
|
@ -79,20 +79,18 @@ impl View for TerminalButton {
|
|||
.constrained()
|
||||
.with_width(style.icon_size)
|
||||
.aligned()
|
||||
.named("terminals-icon"),
|
||||
.into_named_element("terminals-icon"),
|
||||
)
|
||||
.with_children(has_terminals.then(|| {
|
||||
Label::new(terminal_count.to_string(), style.label.text.clone())
|
||||
.contained()
|
||||
.with_style(style.label.container)
|
||||
.aligned()
|
||||
.boxed()
|
||||
}))
|
||||
.constrained()
|
||||
.with_height(style.icon_size)
|
||||
.contained()
|
||||
.with_style(style.container)
|
||||
.boxed()
|
||||
}
|
||||
})
|
||||
.with_cursor_style(CursorStyle::PointingHand)
|
||||
|
@ -111,17 +109,10 @@ impl View for TerminalButton {
|
|||
Some(Box::new(FocusDock)),
|
||||
theme.tooltip.clone(),
|
||||
cx,
|
||||
)
|
||||
.boxed(),
|
||||
),
|
||||
)
|
||||
.with_child(
|
||||
ChildView::new(&self.popup_menu, cx)
|
||||
.aligned()
|
||||
.top()
|
||||
.right()
|
||||
.boxed(),
|
||||
)
|
||||
.boxed()
|
||||
.with_child(ChildView::new(&self.popup_menu, cx).aligned().top().right())
|
||||
.into_named_element("terminal button")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue