Checkpoint

This commit is contained in:
Nathan Sobo 2023-08-22 09:07:45 -06:00
parent ff7b25c538
commit 53679ce045
8 changed files with 228 additions and 263 deletions

View file

@ -1,8 +1,8 @@
use crate::{
element::{AnyElement, Element, Layout},
element::{AnyElement, Element, Layout, ParentElement},
layout_context::LayoutContext,
paint_context::PaintContext,
style::{Style, StyleRefinement, Styleable},
style::{Style, StyleHelpers, StyleRefinement, Styleable},
};
use anyhow::Result;
use gpui::{platform::MouseMovedEvent, EventContext, LayoutId};
@ -14,14 +14,6 @@ pub struct Div<V> {
children: SmallVec<[AnyElement<V>; 2]>,
}
impl<V> Styleable for Div<V> {
type Style = Style;
fn declared_style(&mut self) -> &mut StyleRefinement {
&mut self.style
}
}
pub fn div<V>() -> Div<V> {
Div {
style: Default::default(),
@ -55,6 +47,22 @@ impl<V: 'static> Element<V> for Div<V> {
}
}
impl<V> Styleable for Div<V> {
type Style = Style;
fn declared_style(&mut self) -> &mut crate::style::StyleRefinement {
&mut self.style
}
}
impl<V> StyleHelpers for Div<V> {}
impl<V: 'static> ParentElement<V> for Div<V> {
fn children_mut(&mut self) -> &mut SmallVec<[AnyElement<V>; 2]> {
&mut self.children
}
}
pub trait Interactive<V> {
fn declared_interactions(&mut self) -> &mut Interactions<V>;