Initial explorations into docks

This commit is contained in:
Mikayla Maki 2022-09-06 18:44:16 -07:00 committed by K Simmons
parent 39d219c898
commit b9a6336995
5 changed files with 123 additions and 135 deletions

View file

@ -0,0 +1,35 @@
use gpui::{elements::ChildView, Element, ElementBox, ViewContext, ViewHandle};
use theme::Theme;
use crate::{Pane, Workspace};
#[derive(PartialEq, Eq)]
pub enum DockPosition {
Bottom,
Right,
Fullscreen,
Hidden,
}
pub struct Dock {
position: DockPosition,
pane: ViewHandle<Pane>,
}
impl Dock {
pub fn new(cx: &mut ViewContext<Workspace>) -> Self {
let pane = cx.add_view(Pane::new);
Self {
pane,
position: DockPosition::Bottom,
}
}
pub fn render(&self, _theme: &Theme, position: DockPosition) -> Option<ElementBox> {
if position == self.position {
Some(ChildView::new(self.pane.clone()).boxed())
} else {
None
}
}
}