Refine naming of element-related types and traits
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
03619dfa55
commit
fe492eacbf
93 changed files with 661 additions and 656 deletions
|
@ -9,7 +9,7 @@ use gpui::{
|
|||
geometry::vector::Vector2F,
|
||||
impl_internal_actions,
|
||||
platform::{CursorStyle, MouseButton},
|
||||
AppContext, Border, Drawable, Element, SizeConstraint, ViewContext, ViewHandle,
|
||||
AnyElement, AppContext, Border, Element, SizeConstraint, ViewContext, ViewHandle,
|
||||
};
|
||||
use settings::{DockAnchor, Settings};
|
||||
use theme::Theme;
|
||||
|
@ -315,7 +315,7 @@ impl Dock {
|
|||
theme: &Theme,
|
||||
anchor: DockAnchor,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Option<Element<Workspace>> {
|
||||
) -> Option<AnyElement<Workspace>> {
|
||||
let style = &theme.workspace.dock;
|
||||
|
||||
self.position
|
||||
|
@ -382,7 +382,7 @@ impl Dock {
|
|||
)
|
||||
})
|
||||
}
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
DockAnchor::Expanded => {
|
||||
enum ExpandedDockWash {}
|
||||
|
@ -411,7 +411,7 @@ impl Dock {
|
|||
.contained()
|
||||
.with_style(style.maximized),
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ use gpui::{
|
|||
elements::{Empty, MouseEventHandler, Svg},
|
||||
platform::CursorStyle,
|
||||
platform::MouseButton,
|
||||
Drawable, Element, Entity, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
AnyElement, Element, Entity, View, ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use settings::Settings;
|
||||
|
||||
|
@ -34,11 +34,11 @@ impl View for ToggleDockButton {
|
|||
"Dock Toggle"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> AnyElement<Self> {
|
||||
let workspace = self.workspace.upgrade(cx);
|
||||
|
||||
if workspace.is_none() {
|
||||
return Empty::new().into_element();
|
||||
return Empty::new().into_any();
|
||||
}
|
||||
|
||||
let workspace = workspace.unwrap();
|
||||
|
@ -97,7 +97,7 @@ impl View for ToggleDockButton {
|
|||
cx,
|
||||
)
|
||||
}
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::{
|
|||
use anyhow::{anyhow, Result};
|
||||
use client::{proto, Client};
|
||||
use gpui::{
|
||||
fonts::HighlightStyle, AnyViewHandle, AppContext, Element, ModelHandle, Task, View,
|
||||
fonts::HighlightStyle, AnyElement, AnyViewHandle, AppContext, ModelHandle, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle, WindowContext,
|
||||
};
|
||||
use project::{Project, ProjectEntryId, ProjectPath};
|
||||
|
@ -59,7 +59,7 @@ pub trait Item: View {
|
|||
detail: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<V>;
|
||||
) -> AnyElement<V>;
|
||||
fn for_each_project_item(&self, _: &AppContext, _: &mut dyn FnMut(usize, &dyn project::Item)) {}
|
||||
fn is_singleton(&self, _cx: &AppContext) -> bool {
|
||||
false
|
||||
|
@ -180,13 +180,13 @@ pub trait ItemHandle: 'static + fmt::Debug {
|
|||
detail: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<Pane>;
|
||||
) -> AnyElement<Pane>;
|
||||
fn dragged_tab_content(
|
||||
&self,
|
||||
detail: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<Workspace>;
|
||||
) -> AnyElement<Workspace>;
|
||||
fn project_path(&self, cx: &AppContext) -> Option<ProjectPath>;
|
||||
fn project_entry_ids(&self, cx: &AppContext) -> SmallVec<[ProjectEntryId; 3]>;
|
||||
fn project_item_model_ids(&self, cx: &AppContext) -> SmallVec<[usize; 3]>;
|
||||
|
@ -283,7 +283,7 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
detail: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<Pane> {
|
||||
) -> AnyElement<Pane> {
|
||||
self.read(cx).tab_content(detail, style, cx)
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ impl<T: Item> ItemHandle for ViewHandle<T> {
|
|||
detail: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
cx: &AppContext,
|
||||
) -> Element<Workspace> {
|
||||
) -> AnyElement<Workspace> {
|
||||
self.read(cx).tab_content(detail, style, cx)
|
||||
}
|
||||
|
||||
|
@ -770,7 +770,7 @@ pub(crate) mod test {
|
|||
use super::{Item, ItemEvent};
|
||||
use crate::{sidebar::SidebarItem, ItemId, ItemNavHistory, Pane, Workspace, WorkspaceId};
|
||||
use gpui::{
|
||||
elements::Empty, AppContext, Drawable, Element, Entity, ModelHandle, Task, View,
|
||||
elements::Empty, AnyElement, AppContext, Element, Entity, ModelHandle, Task, View,
|
||||
ViewContext, ViewHandle, WeakViewHandle,
|
||||
};
|
||||
use project::{Project, ProjectEntryId, ProjectPath, WorktreeId};
|
||||
|
@ -929,8 +929,8 @@ pub(crate) mod test {
|
|||
"TestItem"
|
||||
}
|
||||
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> Element<Self> {
|
||||
Empty::new().into_element()
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
Empty::new().into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -947,9 +947,9 @@ pub(crate) mod test {
|
|||
detail: Option<usize>,
|
||||
_: &theme::Tab,
|
||||
_: &AppContext,
|
||||
) -> Element<V> {
|
||||
) -> AnyElement<V> {
|
||||
self.tab_detail.set(detail);
|
||||
Empty::new().into_element()
|
||||
Empty::new().into_any()
|
||||
}
|
||||
|
||||
fn for_each_project_item(
|
||||
|
|
|
@ -140,7 +140,7 @@ pub mod simple_message_notification {
|
|||
elements::{Flex, MouseEventHandler, Padding, ParentElement, Svg, Text},
|
||||
impl_actions,
|
||||
platform::{CursorStyle, MouseButton},
|
||||
Action, AppContext, Drawable, Entity, View, ViewContext,
|
||||
Action, AppContext, Element, Entity, View, ViewContext,
|
||||
};
|
||||
use menu::Cancel;
|
||||
use serde::Deserialize;
|
||||
|
@ -229,7 +229,7 @@ pub mod simple_message_notification {
|
|||
"MessageNotification"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> gpui::Element<Self> {
|
||||
fn render(&mut self, cx: &mut gpui::ViewContext<Self>) -> gpui::AnyElement<Self> {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
let theme = &theme.simple_message_notification;
|
||||
|
||||
|
@ -317,7 +317,7 @@ pub mod simple_message_notification {
|
|||
} else {
|
||||
CursorStyle::Arrow
|
||||
})
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1356,7 +1356,7 @@ impl Pane {
|
|||
});
|
||||
}
|
||||
|
||||
fn render_tabs(&mut self, cx: &mut ViewContext<Self>) -> impl Drawable<Self> {
|
||||
fn render_tabs(&mut self, cx: &mut ViewContext<Self>) -> impl Element<Self> {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
||||
let pane = cx.handle().downgrade();
|
||||
|
@ -1445,9 +1445,9 @@ impl Pane {
|
|||
tooltip_theme,
|
||||
cx,
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
} else {
|
||||
mouse_event_handler.into_element()
|
||||
mouse_event_handler.into_any()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1495,7 +1495,7 @@ impl Pane {
|
|||
.with_border(filler_style.container.border)
|
||||
})
|
||||
.flex(1., true)
|
||||
.into_named_element("filler"),
|
||||
.into_any_named("filler"),
|
||||
);
|
||||
|
||||
row
|
||||
|
@ -1546,7 +1546,7 @@ impl Pane {
|
|||
hovered: bool,
|
||||
tab_style: &theme::Tab,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
let title = item.tab_content(detail, &tab_style, cx);
|
||||
Self::render_tab_with_title(title, item, pane, first, hovered, tab_style, cx)
|
||||
}
|
||||
|
@ -1559,20 +1559,20 @@ impl Pane {
|
|||
hovered: bool,
|
||||
tab_style: &theme::Tab,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Element<Workspace> {
|
||||
) -> AnyElement<Workspace> {
|
||||
let title = item.dragged_tab_content(detail, &tab_style, cx);
|
||||
Self::render_tab_with_title(title, item, pane, first, hovered, tab_style, cx)
|
||||
}
|
||||
|
||||
fn render_tab_with_title<T: View>(
|
||||
title: Element<T>,
|
||||
title: AnyElement<T>,
|
||||
item: &Box<dyn ItemHandle>,
|
||||
pane: WeakViewHandle<Pane>,
|
||||
first: bool,
|
||||
hovered: bool,
|
||||
tab_style: &theme::Tab,
|
||||
cx: &mut ViewContext<T>,
|
||||
) -> Element<T> {
|
||||
) -> AnyElement<T> {
|
||||
let mut container = tab_style.container.clone();
|
||||
if first {
|
||||
container.border.left = false;
|
||||
|
@ -1636,7 +1636,7 @@ impl Pane {
|
|||
})
|
||||
}
|
||||
})
|
||||
.into_named_element("close-tab-icon")
|
||||
.into_any_named("close-tab-icon")
|
||||
.constrained()
|
||||
} else {
|
||||
Empty::new().constrained()
|
||||
|
@ -1648,14 +1648,14 @@ impl Pane {
|
|||
.with_style(container)
|
||||
.constrained()
|
||||
.with_height(tab_style.height)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_tab_bar_buttons(
|
||||
&mut self,
|
||||
theme: &Theme,
|
||||
cx: &mut ViewContext<Self>,
|
||||
) -> Element<Self> {
|
||||
) -> AnyElement<Self> {
|
||||
Flex::row()
|
||||
// New menu
|
||||
.with_child(render_tab_bar_button(
|
||||
|
@ -1701,15 +1701,19 @@ impl Pane {
|
|||
.contained()
|
||||
.with_style(theme.workspace.tab_bar.pane_button_container)
|
||||
.flex(1., false)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn render_blank_pane(&mut self, theme: &Theme, _cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render_blank_pane(
|
||||
&mut self,
|
||||
theme: &Theme,
|
||||
_cx: &mut ViewContext<Self>,
|
||||
) -> AnyElement<Self> {
|
||||
let background = theme.workspace.background;
|
||||
Empty::new()
|
||||
.contained()
|
||||
.with_background_color(background)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1722,7 +1726,7 @@ impl View for Pane {
|
|||
"Pane"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
enum MouseNavigationHandler {}
|
||||
|
||||
MouseEventHandler::<MouseNavigationHandler, _>::new(0, cx, |_, cx| {
|
||||
|
@ -1750,11 +1754,8 @@ impl View for Pane {
|
|||
),
|
||||
);
|
||||
|
||||
let mut tab_row = Flex::row().with_child(
|
||||
self.render_tabs(cx)
|
||||
.flex(1., true)
|
||||
.into_named_element("tabs"),
|
||||
);
|
||||
let mut tab_row = Flex::row()
|
||||
.with_child(self.render_tabs(cx).flex(1., true).into_any_named("tabs"));
|
||||
|
||||
if self.is_active {
|
||||
tab_row.add_child(self.render_tab_bar_buttons(&theme, cx))
|
||||
|
@ -1765,7 +1766,7 @@ impl View for Pane {
|
|||
.constrained()
|
||||
.with_height(theme.workspace.tab_bar.height)
|
||||
.flex(1., false)
|
||||
.into_named_element("tab bar")
|
||||
.into_any_named("tab bar")
|
||||
})
|
||||
.with_child({
|
||||
enum PaneContentTabDropTarget {}
|
||||
|
@ -1797,7 +1798,7 @@ impl View for Pane {
|
|||
.flex(1., true)
|
||||
})
|
||||
.with_child(ChildView::new(&self.tab_context_menu, cx))
|
||||
.into_element()
|
||||
.into_any()
|
||||
} else {
|
||||
enum EmptyPane {}
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
|
@ -1808,7 +1809,7 @@ impl View for Pane {
|
|||
.on_down(MouseButton::Left, |_, _, cx| {
|
||||
cx.focus_parent_view();
|
||||
})
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
})
|
||||
.on_down(
|
||||
|
@ -1824,7 +1825,7 @@ impl View for Pane {
|
|||
cx.dispatch_action(GoForward { pane: Some(pane) })
|
||||
}
|
||||
})
|
||||
.into_named_element("pane")
|
||||
.into_any_named("pane")
|
||||
}
|
||||
|
||||
fn focus_in(&mut self, focused: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
||||
|
@ -1876,7 +1877,7 @@ fn render_tab_bar_button<A: Action + Clone>(
|
|||
cx: &mut ViewContext<Pane>,
|
||||
action: A,
|
||||
context_menu: Option<ViewHandle<ContextMenu>>,
|
||||
) -> Element<Pane> {
|
||||
) -> AnyElement<Pane> {
|
||||
enum TabBarButton {}
|
||||
|
||||
Stack::new()
|
||||
|
@ -1902,7 +1903,7 @@ fn render_tab_bar_button<A: Action + Clone>(
|
|||
context_menu.map(|menu| ChildView::new(&menu, cx).aligned().bottom().right()),
|
||||
)
|
||||
.flex(1., false)
|
||||
.into_named_element("tab bar button")
|
||||
.into_any_named("tab bar button")
|
||||
}
|
||||
|
||||
impl ItemNavHistory {
|
||||
|
@ -2008,11 +2009,11 @@ impl NavHistory {
|
|||
|
||||
pub struct PaneBackdrop<V: View> {
|
||||
child_view: usize,
|
||||
child: Element<V>,
|
||||
child: AnyElement<V>,
|
||||
}
|
||||
|
||||
impl<V: View> PaneBackdrop<V> {
|
||||
pub fn new(pane_item_view: usize, child: Element<V>) -> Self {
|
||||
pub fn new(pane_item_view: usize, child: AnyElement<V>) -> Self {
|
||||
PaneBackdrop {
|
||||
child,
|
||||
child_view: pane_item_view,
|
||||
|
@ -2020,7 +2021,7 @@ impl<V: View> PaneBackdrop<V> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<V: View> Drawable<V> for PaneBackdrop<V> {
|
||||
impl<V: View> Element<V> for PaneBackdrop<V> {
|
||||
type LayoutState = ();
|
||||
|
||||
type PaintState = ();
|
||||
|
|
|
@ -5,7 +5,7 @@ use gpui::{
|
|||
geometry::{rect::RectF, vector::Vector2F},
|
||||
platform::MouseButton,
|
||||
scene::MouseUp,
|
||||
AppContext, Drawable, EventContext, MouseState, Quad, View, ViewContext, WeakViewHandle,
|
||||
AppContext, Element, EventContext, MouseState, Quad, View, ViewContext, WeakViewHandle,
|
||||
};
|
||||
use project::ProjectEntryId;
|
||||
use settings::Settings;
|
||||
|
@ -27,7 +27,7 @@ pub fn dragged_item_receiver<Tag, D, F>(
|
|||
) -> MouseEventHandler<Tag, Pane>
|
||||
where
|
||||
Tag: 'static,
|
||||
D: Drawable<Pane>,
|
||||
D: Element<Pane>,
|
||||
F: FnOnce(&mut MouseState, &mut ViewContext<Pane>) -> D,
|
||||
{
|
||||
MouseEventHandler::<Tag, _>::above(region_id, cx, |state, cx| {
|
||||
|
|
|
@ -71,7 +71,7 @@ impl PaneGroup {
|
|||
active_call: Option<&ModelHandle<ActiveCall>>,
|
||||
active_pane: &ViewHandle<Pane>,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Element<Workspace> {
|
||||
) -> AnyElement<Workspace> {
|
||||
self.root.render(
|
||||
project,
|
||||
theme,
|
||||
|
@ -132,7 +132,7 @@ impl Member {
|
|||
active_call: Option<&ModelHandle<ActiveCall>>,
|
||||
active_pane: &ViewHandle<Pane>,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Element<Workspace> {
|
||||
) -> AnyElement<Workspace> {
|
||||
enum FollowIntoExternalProject {}
|
||||
|
||||
match self {
|
||||
|
@ -207,7 +207,7 @@ impl Member {
|
|||
.aligned()
|
||||
.bottom()
|
||||
.right()
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ impl Member {
|
|||
.aligned()
|
||||
.bottom()
|
||||
.right()
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
),
|
||||
ParticipantLocation::External => Some(
|
||||
Label::new(
|
||||
|
@ -239,7 +239,7 @@ impl Member {
|
|||
.aligned()
|
||||
.bottom()
|
||||
.right()
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
),
|
||||
}
|
||||
} else {
|
||||
|
@ -249,7 +249,7 @@ impl Member {
|
|||
Stack::new()
|
||||
.with_child(ChildView::new(pane, cx).contained().with_border(border))
|
||||
.with_children(leader_status_box)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
Member::Axis(axis) => axis.render(
|
||||
project,
|
||||
|
@ -361,7 +361,7 @@ impl PaneAxis {
|
|||
active_call: Option<&ModelHandle<ActiveCall>>,
|
||||
active_pane: &ViewHandle<Pane>,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Element<Workspace> {
|
||||
) -> AnyElement<Workspace> {
|
||||
let last_member_ix = self.members.len() - 1;
|
||||
Flex::new(self.axis)
|
||||
.with_children(self.members.iter().enumerate().map(|(ix, member)| {
|
||||
|
@ -382,12 +382,12 @@ impl PaneAxis {
|
|||
Axis::Vertical => border.bottom = true,
|
||||
Axis::Horizontal => border.right = true,
|
||||
}
|
||||
member = member.contained().with_border(border).into_element();
|
||||
member = member.contained().with_border(border).into_any();
|
||||
}
|
||||
|
||||
FlexItem::new(member).flex(flex, true)
|
||||
}))
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ impl View for SharedScreen {
|
|||
"SharedScreen"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
enum Focus {}
|
||||
|
||||
let frame = self.frame.clone();
|
||||
|
@ -91,7 +91,7 @@ impl View for SharedScreen {
|
|||
.with_style(cx.global::<Settings>().theme.shared_screen)
|
||||
})
|
||||
.on_down(MouseButton::Left, |_, _, cx| cx.focus_parent_view())
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ impl Item for SharedScreen {
|
|||
_: Option<usize>,
|
||||
style: &theme::Tab,
|
||||
_: &AppContext,
|
||||
) -> gpui::Element<V> {
|
||||
) -> gpui::AnyElement<V> {
|
||||
Flex::row()
|
||||
.with_child(
|
||||
Svg::new("icons/disable_screen_sharing_12.svg")
|
||||
|
@ -128,7 +128,7 @@ impl Item for SharedScreen {
|
|||
)
|
||||
.aligned(),
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
|
||||
fn set_nav_history(&mut self, history: ItemNavHistory, _: &mut ViewContext<Self>) {
|
||||
|
|
|
@ -188,7 +188,7 @@ impl View for Sidebar {
|
|||
"Sidebar"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
if let Some(active_item) = self.active_item() {
|
||||
enum ResizeHandleTag {}
|
||||
let style = &cx.global::<Settings>().theme.workspace.sidebar;
|
||||
|
@ -202,9 +202,9 @@ impl View for Sidebar {
|
|||
style.initial_size,
|
||||
cx,
|
||||
)
|
||||
.into_element()
|
||||
.into_any()
|
||||
} else {
|
||||
Empty::new().into_element()
|
||||
Empty::new().into_any()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,7 @@ impl View for SidebarButtons {
|
|||
"SidebarToggleButton"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let theme = &cx.global::<Settings>().theme;
|
||||
let tooltip_style = theme.tooltip.clone();
|
||||
let theme = &theme.workspace.status_bar.sidebar_buttons;
|
||||
|
@ -294,7 +294,7 @@ impl View for SidebarButtons {
|
|||
))
|
||||
.contained()
|
||||
.with_style(group_style)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ use gpui::{
|
|||
vector::{vec2f, Vector2F},
|
||||
},
|
||||
json::{json, ToJson},
|
||||
AnyViewHandle, Element, Entity, SceneBuilder, SizeConstraint, Subscription, View, ViewContext,
|
||||
ViewHandle, WindowContext,
|
||||
AnyElement, AnyViewHandle, Entity, SceneBuilder, SizeConstraint, Subscription, View,
|
||||
ViewContext, ViewHandle, WindowContext,
|
||||
};
|
||||
use settings::Settings;
|
||||
|
||||
|
@ -46,7 +46,7 @@ impl View for StatusBar {
|
|||
"StatusBar"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let theme = &cx.global::<Settings>().theme.workspace.status_bar;
|
||||
|
||||
StatusBarElement {
|
||||
|
@ -57,7 +57,7 @@ impl View for StatusBar {
|
|||
.contained()
|
||||
.with_margin_right(theme.item_spacing)
|
||||
}))
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
|
||||
right: Flex::row()
|
||||
.with_children(self.right_items.iter().rev().map(|i| {
|
||||
|
@ -66,13 +66,13 @@ impl View for StatusBar {
|
|||
.contained()
|
||||
.with_margin_left(theme.item_spacing)
|
||||
}))
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
}
|
||||
.contained()
|
||||
.with_style(theme.container)
|
||||
.constrained()
|
||||
.with_height(theme.height)
|
||||
.into_element()
|
||||
.into_any()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,11 +145,11 @@ impl From<&dyn StatusItemViewHandle> for AnyViewHandle {
|
|||
}
|
||||
|
||||
struct StatusBarElement {
|
||||
left: Element<StatusBar>,
|
||||
right: Element<StatusBar>,
|
||||
left: AnyElement<StatusBar>,
|
||||
right: AnyElement<StatusBar>,
|
||||
}
|
||||
|
||||
impl Drawable<StatusBar> for StatusBarElement {
|
||||
impl Element<StatusBar> for StatusBarElement {
|
||||
type LayoutState = ();
|
||||
type PaintState = ();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{ItemHandle, Pane};
|
||||
use gpui::{
|
||||
elements::*, platform::CursorStyle, platform::MouseButton, Action, AnyViewHandle, AppContext,
|
||||
Element, Entity, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
|
||||
elements::*, platform::CursorStyle, platform::MouseButton, Action, AnyElement, AnyViewHandle,
|
||||
AppContext, Entity, View, ViewContext, ViewHandle, WeakViewHandle, WindowContext,
|
||||
};
|
||||
use settings::Settings;
|
||||
|
||||
|
@ -59,7 +59,7 @@ impl View for Toolbar {
|
|||
"Toolbar"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let theme = &cx.global::<Settings>().theme.workspace.toolbar;
|
||||
|
||||
let mut primary_left_items = Vec::new();
|
||||
|
@ -77,9 +77,9 @@ impl View for Toolbar {
|
|||
.contained()
|
||||
.with_margin_right(spacing);
|
||||
if let Some((flex, expanded)) = flex {
|
||||
primary_left_items.push(left_item.flex(flex, expanded).into_element());
|
||||
primary_left_items.push(left_item.flex(flex, expanded).into_any());
|
||||
} else {
|
||||
primary_left_items.push(left_item.into_element());
|
||||
primary_left_items.push(left_item.into_any());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,9 +90,9 @@ impl View for Toolbar {
|
|||
.with_margin_left(spacing)
|
||||
.flex_float();
|
||||
if let Some((flex, expanded)) = flex {
|
||||
primary_right_items.push(right_item.flex(flex, expanded).into_element());
|
||||
primary_right_items.push(right_item.flex(flex, expanded).into_any());
|
||||
} else {
|
||||
primary_right_items.push(right_item.into_element());
|
||||
primary_right_items.push(right_item.into_any());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ impl View for Toolbar {
|
|||
ChildView::new(item.as_any(), cx)
|
||||
.constrained()
|
||||
.with_height(theme.height)
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ impl View for Toolbar {
|
|||
.with_children(secondary_item)
|
||||
.contained()
|
||||
.with_style(container_style)
|
||||
.into_named_element("toolbar")
|
||||
.into_any_named("toolbar")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ fn nav_button<A: Action + Clone>(
|
|||
tooltip_action: A,
|
||||
action_name: &str,
|
||||
cx: &mut ViewContext<Toolbar>,
|
||||
) -> Element<Toolbar> {
|
||||
) -> AnyElement<Toolbar> {
|
||||
MouseEventHandler::<A, _>::new(0, cx, |state, _| {
|
||||
let style = if enabled {
|
||||
style.style_for(state, false)
|
||||
|
@ -207,7 +207,7 @@ fn nav_button<A: Action + Clone>(
|
|||
)
|
||||
.contained()
|
||||
.with_margin_right(spacing)
|
||||
.into_named_element("nav button")
|
||||
.into_any_named("nav button")
|
||||
}
|
||||
|
||||
impl Toolbar {
|
||||
|
|
|
@ -2075,7 +2075,7 @@ impl Workspace {
|
|||
self.leader_state.followers.contains(&peer_id)
|
||||
}
|
||||
|
||||
fn render_titlebar(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render_titlebar(&self, theme: &Theme, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
// TODO: There should be a better system in place for this
|
||||
// (https://github.com/zed-industries/zed/issues/1290)
|
||||
let is_fullscreen = cx.window_is_fullscreen();
|
||||
|
@ -2105,7 +2105,7 @@ impl Workspace {
|
|||
})
|
||||
.constrained()
|
||||
.with_height(theme.workspace.titlebar.height)
|
||||
.into_named_element("titlebar")
|
||||
.into_any_named("titlebar")
|
||||
}
|
||||
|
||||
fn active_item_path_changed(&mut self, cx: &mut ViewContext<Self>) {
|
||||
|
@ -2173,7 +2173,7 @@ impl Workspace {
|
|||
fn render_disconnected_overlay(
|
||||
&self,
|
||||
cx: &mut ViewContext<Workspace>,
|
||||
) -> Option<Element<Workspace>> {
|
||||
) -> Option<AnyElement<Workspace>> {
|
||||
if self.project.read(cx).is_read_only() {
|
||||
enum DisconnectedOverlay {}
|
||||
Some(
|
||||
|
@ -2189,7 +2189,7 @@ impl Workspace {
|
|||
})
|
||||
.with_cursor_style(CursorStyle::Arrow)
|
||||
.capture_all()
|
||||
.into_named_element("disconnected overlay"),
|
||||
.into_any_named("disconnected overlay"),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
|
@ -2200,7 +2200,7 @@ impl Workspace {
|
|||
&self,
|
||||
theme: &theme::Workspace,
|
||||
cx: &AppContext,
|
||||
) -> Option<Element<Workspace>> {
|
||||
) -> Option<AnyElement<Workspace>> {
|
||||
if self.notifications.is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
@ -2218,7 +2218,7 @@ impl Workspace {
|
|||
.aligned()
|
||||
.bottom()
|
||||
.right()
|
||||
.into_element(),
|
||||
.into_any(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -2826,7 +2826,7 @@ impl View for Workspace {
|
|||
"Workspace"
|
||||
}
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Element<Self> {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> AnyElement<Self> {
|
||||
let theme = cx.global::<Settings>().theme.clone();
|
||||
Stack::new()
|
||||
.with_child(
|
||||
|
@ -2923,7 +2923,7 @@ impl View for Workspace {
|
|||
)
|
||||
.with_children(DragAndDrop::render(cx))
|
||||
.with_children(self.render_disconnected_overlay(cx))
|
||||
.into_named_element("workspace")
|
||||
.into_any_named("workspace")
|
||||
}
|
||||
|
||||
fn focus_in(&mut self, view: AnyViewHandle, cx: &mut ViewContext<Self>) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue