Clean up Element API and start on docs
This commit is contained in:
@@ -505,9 +505,9 @@ impl Dock {
|
||||
}
|
||||
|
||||
impl Render for Dock {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
if let Some(entry) = self.visible_entry() {
|
||||
let size = entry.panel.size(cx);
|
||||
|
||||
@@ -594,9 +594,9 @@ impl PanelButtons {
|
||||
}
|
||||
|
||||
impl Render for PanelButtons {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
// todo!()
|
||||
let dock = self.dock.read(cx);
|
||||
let active_index = dock.active_panel_index;
|
||||
@@ -717,9 +717,9 @@ pub mod test {
|
||||
}
|
||||
|
||||
impl Render for TestPanel {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
div()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -910,9 +910,9 @@ pub mod test {
|
||||
}
|
||||
|
||||
impl Render for TestItem {
|
||||
type Element = Focusable<Div>;
|
||||
type Output = Focusable<Div>;
|
||||
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
|
||||
gpui::div().track_focus(&self.focus_handle)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,9 +104,9 @@ impl ModalLayer {
|
||||
}
|
||||
|
||||
impl Render for ModalLayer {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
let Some(active_modal) = &self.active_modal else {
|
||||
return div();
|
||||
};
|
||||
|
||||
@@ -219,9 +219,9 @@ pub mod simple_message_notification {
|
||||
}
|
||||
|
||||
impl Render for MessageNotification {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
v_stack()
|
||||
.elevation_3(cx)
|
||||
.p_4()
|
||||
|
||||
@@ -1868,9 +1868,9 @@ impl FocusableView for Pane {
|
||||
}
|
||||
|
||||
impl Render for Pane {
|
||||
type Element = Focusable<Div>;
|
||||
type Output = Focusable<Div>;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
v_stack()
|
||||
.key_context("Pane")
|
||||
.track_focus(&self.focus_handle)
|
||||
@@ -2750,9 +2750,9 @@ mod tests {
|
||||
}
|
||||
|
||||
impl Render for DraggedTab {
|
||||
type Element = <Tab as RenderOnce>::Rendered;
|
||||
type Output = <Tab as RenderOnce>::Output;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
let ui_font = ThemeSettings::get_global(cx).ui_font.family.clone();
|
||||
let item = &self.pane.read(cx).items[self.ix];
|
||||
let label = item.tab_content(Some(self.detail), false, cx);
|
||||
|
||||
@@ -773,7 +773,7 @@ mod element {
|
||||
impl Element for PaneAxisElement {
|
||||
type State = Rc<RefCell<Option<usize>>>;
|
||||
|
||||
fn layout(
|
||||
fn request_layout(
|
||||
&mut self,
|
||||
state: Option<Self::State>,
|
||||
cx: &mut ui::prelude::WindowContext,
|
||||
|
||||
@@ -66,9 +66,9 @@ impl FocusableView for SharedScreen {
|
||||
}
|
||||
}
|
||||
impl Render for SharedScreen {
|
||||
type Element = Focusable<Div>;
|
||||
type Output = Focusable<Div>;
|
||||
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, _: &mut ViewContext<Self>) -> Self::Output {
|
||||
div().track_focus(&self.focus).size_full().children(
|
||||
self.frame
|
||||
.as_ref()
|
||||
|
||||
@@ -33,9 +33,9 @@ pub struct StatusBar {
|
||||
}
|
||||
|
||||
impl Render for StatusBar {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
div()
|
||||
.py_0p5()
|
||||
.px_1()
|
||||
|
||||
@@ -93,9 +93,9 @@ impl Toolbar {
|
||||
}
|
||||
|
||||
impl Render for Toolbar {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
if !self.has_any_visible_items() {
|
||||
return div();
|
||||
}
|
||||
|
||||
@@ -3489,9 +3489,9 @@ impl FocusableView for Workspace {
|
||||
struct DraggedDock(DockPosition);
|
||||
|
||||
impl Render for Workspace {
|
||||
type Element = Div;
|
||||
type Output = Div;
|
||||
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Output {
|
||||
let mut context = KeyContext::default();
|
||||
context.add("Workspace");
|
||||
|
||||
@@ -4287,7 +4287,7 @@ struct DisconnectedOverlay;
|
||||
impl Element for DisconnectedOverlay {
|
||||
type State = AnyElement;
|
||||
|
||||
fn layout(
|
||||
fn request_layout(
|
||||
&mut self,
|
||||
_: Option<Self::State>,
|
||||
cx: &mut WindowContext,
|
||||
|
||||
Reference in New Issue
Block a user