Checkpoint

This commit is contained in:
Nathan Sobo 2023-10-10 22:14:47 -06:00
parent 61b8ad38bd
commit f53b63eaf6
17 changed files with 567 additions and 472 deletions

View file

@ -22,7 +22,7 @@ impl CollabPanel {
}
impl CollabPanel {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
let theme = theme(cx);
// Panel
@ -123,7 +123,7 @@ impl CollabPanel {
label: impl IntoAnyElement<Self>,
expanded: bool,
theme: &Theme,
) -> impl Element<State = Self> {
) -> impl Element<ViewState = Self> {
div()
.h_7()
.px_2()
@ -153,7 +153,7 @@ impl CollabPanel {
avatar_uri: impl Into<SharedString>,
label: impl IntoAnyElement<Self>,
theme: &Theme,
) -> impl Element<State = Self> {
) -> impl Element<ViewState = Self> {
div()
.h_7()
.px_2()

View file

@ -129,10 +129,10 @@ where
deserializer.deserialize_map(SyntaxVisitor)
}
pub fn themed<E, F>(theme: Theme, cx: &mut ViewContext<E::State>, build_child: F) -> Themed<E>
pub fn themed<E, F>(theme: Theme, cx: &mut ViewContext<E::ViewState>, build_child: F) -> Themed<E>
where
E: Element,
F: FnOnce(&mut ViewContext<E::State>) -> E,
F: FnOnce(&mut ViewContext<E::ViewState>) -> E,
{
let child = cx.with_state(theme.clone(), |cx| build_child(cx));
Themed { theme, child }
@ -144,14 +144,14 @@ pub struct Themed<E> {
}
impl<E: Element> Element for Themed<E> {
type State = E::State;
type FrameState = E::FrameState;
type ViewState = E::ViewState;
type ElementState = E::ElementState;
fn layout(
&mut self,
state: &mut E::State,
cx: &mut ViewContext<E::State>,
) -> anyhow::Result<(LayoutId, Self::FrameState)>
state: &mut E::ViewState,
cx: &mut ViewContext<E::ViewState>,
) -> anyhow::Result<(LayoutId, Self::ElementState)>
where
Self: Sized,
{
@ -161,9 +161,9 @@ impl<E: Element> Element for Themed<E> {
fn paint(
&mut self,
bounds: Bounds<Pixels>,
state: &mut Self::State,
frame_state: &mut Self::FrameState,
cx: &mut ViewContext<Self::State>,
state: &mut Self::ViewState,
frame_state: &mut Self::ElementState,
cx: &mut ViewContext<Self::ViewState>,
) -> Result<()>
where
Self: Sized,

View file

@ -25,7 +25,7 @@ impl Workspace {
}
}
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<State = Self> {
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl Element<ViewState = Self> {
themed(rose_pine_dawn(), cx, |cx| {
let theme = theme(cx);
div()
@ -57,7 +57,7 @@ impl Workspace {
struct Titlebar;
pub fn titlebar<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> impl Element<State = S> {
pub fn titlebar<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> impl Element<ViewState = S> {
let ref mut this = Titlebar;
let theme = theme(cx);
div()
@ -75,7 +75,7 @@ impl Titlebar {
fn render<V: 'static + Send + Sync>(
&mut self,
cx: &mut ViewContext<V>,
) -> impl Element<State = V> {
) -> impl Element<ViewState = V> {
let theme = theme(cx);
div()
.flex()
@ -91,7 +91,7 @@ impl Titlebar {
fn left_group<S: 'static + Send + Sync>(
&mut self,
cx: &mut ViewContext<S>,
) -> impl Element<State = S> {
) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
.flex()
@ -174,7 +174,7 @@ impl Titlebar {
fn right_group<S: 'static + Send + Sync>(
&mut self,
cx: &mut ViewContext<S>,
) -> impl Element<State = S> {
) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
.flex()
@ -306,7 +306,9 @@ mod statusbar {
use super::*;
pub fn statusbar<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> impl Element<State = S> {
pub fn statusbar<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
.flex()
@ -319,7 +321,9 @@ mod statusbar {
// .child(right_group(cx))
}
fn left_group<V: 'static + Send + Sync>(cx: &mut ViewContext<V>) -> impl Element<State = V> {
fn left_group<V: 'static + Send + Sync>(
cx: &mut ViewContext<V>,
) -> impl Element<ViewState = V> {
let theme = theme(cx);
div()
.flex()
@ -416,7 +420,9 @@ mod statusbar {
)
}
fn right_group<S: 'static + Send + Sync>(cx: &mut ViewContext<S>) -> impl Element<State = S> {
fn right_group<S: 'static + Send + Sync>(
cx: &mut ViewContext<S>,
) -> impl Element<ViewState = S> {
let theme = theme(cx);
div()
.flex()