Compiling checkpoint

This commit is contained in:
Nathan Sobo 2023-08-13 21:20:41 -06:00
parent be7a43c81c
commit 2d17e9685f
11 changed files with 375 additions and 345 deletions

View file

@ -1,52 +1,94 @@
#![allow(dead_code, unused_variables)]
use gpui::{elements::Empty, Element};
use element::{AnyElement, Element};
use frame::frame;
use log::LevelFilter;
use simplelog::SimpleLogger;
use taffy::tree::NodeId;
fn main() {
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
gpui::App::new(()).unwrap().run(|cx| {
cx.platform().activate(true);
// cx.add_window(
// WindowOptions {
// titlebar: Some(TitlebarOptions {
// appears_transparent: true,
// ..Default::default()
// }),
// ..Default::default()
// },
// |_| view(|_| Playground::new()),
// Default::default(),
// // |_| view(|_| Playground::new()),
// );
});
}
use std::marker::PhantomData;
use themes::ThemeColors;
use themes::{rose_pine, ThemeColors};
mod adapter;
mod color;
mod element;
mod frame;
mod style;
mod themes;
mod tokens;
#[derive(Element, Clone)]
pub struct Playground<V: 'static>(PhantomData<V>);
pub struct Playground<V: 'static>(AnyElement<V>);
impl<V> Playground<V> {
pub fn new() -> Self {
Self(PhantomData)
impl<V: 'static> gpui::Element<V> for Playground<V> {
type LayoutState = NodeId;
type PaintState = ();
fn layout(
&mut self,
constraint: gpui::SizeConstraint,
view: &mut V,
cx: &mut gpui::LayoutContext<V>,
) -> (gpui::geometry::vector::Vector2F, Self::LayoutState) {
todo!()
}
pub fn render(&mut self, _: &mut V, _: &mut gpui::ViewContext<V>) -> impl Element<V> {
Empty::new()
// workspace(&rose_pine::dawn())
fn paint(
&mut self,
scene: &mut gpui::SceneBuilder,
bounds: gpui::geometry::rect::RectF,
visible_bounds: gpui::geometry::rect::RectF,
layout: &mut Self::LayoutState,
view: &mut V,
cx: &mut gpui::PaintContext<V>,
) -> Self::PaintState {
todo!()
}
fn rect_for_text_range(
&self,
range_utf16: std::ops::Range<usize>,
bounds: gpui::geometry::rect::RectF,
visible_bounds: gpui::geometry::rect::RectF,
layout: &Self::LayoutState,
paint: &Self::PaintState,
view: &V,
cx: &gpui::ViewContext<V>,
) -> Option<gpui::geometry::rect::RectF> {
todo!()
}
fn debug(
&self,
bounds: gpui::geometry::rect::RectF,
layout: &Self::LayoutState,
paint: &Self::PaintState,
view: &V,
cx: &gpui::ViewContext<V>,
) -> gpui::serde_json::Value {
todo!()
}
}
// fn workspace<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
impl<V> Playground<V> {
pub fn new() -> Self {
Self(workspace(&rose_pine::moon()).into_any())
}
}
fn workspace<V: 'static>(theme: &ThemeColors) -> impl Element<V> {
frame()
}
// todo!()
// // column()
// // .size(auto())