Checkpoint
This commit is contained in:
parent
ff7b25c538
commit
53679ce045
8 changed files with 228 additions and 263 deletions
|
@ -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>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue