clay_layout/elements/
mod.rs1use crate::bindings::*;
2
3pub mod containers;
4pub mod custom;
5pub mod image;
6pub mod rectangle;
7pub mod text;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10#[repr(u8)]
11pub enum ElementConfigType {
12 Rectangle = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_RECTANGLE,
13 BorderContainer = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_BORDER_CONTAINER,
14 FloatingContainer = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_FLOATING_CONTAINER,
15 ScrollContainer = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_SCROLL_CONTAINER,
16 Image = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_IMAGE,
17 Text = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_TEXT,
18 Custom = Clay__ElementConfigType_CLAY__ELEMENT_CONFIG_TYPE_CUSTOM,
19 Id = 65,
21 Layout = 66,
22}
23
24#[derive(Debug, Copy, Clone, PartialEq)]
25pub enum CornerRadius {
26 All(f32),
28 Individual {
29 top_left: f32,
30 top_right: f32,
31 bottom_left: f32,
32 bottom_right: f32,
33 },
34}
35
36impl From<CornerRadius> for Clay_CornerRadius {
37 fn from(value: CornerRadius) -> Self {
38 match value {
39 CornerRadius::All(radius) => Self {
40 topLeft: radius,
41 topRight: radius,
42 bottomLeft: radius,
43 bottomRight: radius,
44 },
45 CornerRadius::Individual {
46 top_left,
47 top_right,
48 bottom_left,
49 bottom_right,
50 } => Self {
51 topLeft: top_left,
52 topRight: top_right,
53 bottomLeft: bottom_left,
54 bottomRight: bottom_right,
55 },
56 }
57 }
58}
59impl From<Clay_CornerRadius> for CornerRadius {
60 fn from(value: Clay_CornerRadius) -> Self {
61 if value.topLeft == value.topRight
62 && value.topRight == value.bottomLeft
63 && value.bottomLeft == value.bottomRight
64 {
65 Self::All(value.topLeft)
66 } else {
67 Self::Individual {
68 top_left: value.topLeft,
69 top_right: value.topRight,
70 bottom_left: value.bottomLeft,
71 bottom_right: value.bottomRight,
72 }
73 }
74 }
75}