use super::{
flow::FlowFunction,
primitive::{BasePrimitive, Primitive},
};
use crate::ui::{
components::{curve::Curve, image::Image, shape::Shape, text::Text, text_field::TextField},
flow::{Offset, Size},
primitive::{Primitives, Shapes},
Container,
};
pub trait Element {
fn primitive(&self) -> BasePrimitive;
}
use std::num::NonZeroU32;
pub type Id = NonZeroU32;
pub trait ElementHandle {
fn id(&self) -> Id;
}
pub struct ConcreteElement {
pub(crate) primitive: Primitives,
}
impl ConcreteElement {
pub fn container(container: Container) -> Self {
let primitive = Primitives::Container(container);
Self { primitive }
}
pub fn shape(shape: Shape) -> Self {
let primitive = Primitives::Shape(shape);
Self { primitive }
}
pub fn curve(curve: Curve) -> Self {
let primitive = Primitives::Curve(curve);
Self { primitive }
}
pub fn image(image: Image) -> Self {
let primitive = Primitives::Image(image);
Self { primitive }
}
pub fn text(text: Text) -> Self {
let primitive = Primitives::Text(text);
Self { primitive }
}
pub fn text_field(text_field: TextField) -> Self {
let primitive = Primitives::TextField(text_field);
Self { primitive }
}
}