tuix_core/state/style/
display.rs

1use crate::Entity;
2use crate::state::animation::Interpolator;
3
4#[derive(Copy, Clone, PartialEq, Debug)]
5pub enum Display {
6    None,
7    Flex,
8}
9
10impl Default for Display {
11    fn default() -> Self {
12        Display::Flex
13    }
14}
15
16impl Interpolator for Display {
17    fn interpolate(start: &Self, end: &Self, t: f32) -> Self {
18        return *end;
19    }
20}
21
22#[derive(Copy, Clone, PartialEq, Debug)]
23pub enum Visibility {
24    Visible,
25    Invisible,
26}
27
28impl Default for Visibility {
29    fn default() -> Self {
30        Visibility::Visible
31    }
32}
33
34impl Interpolator for Visibility {
35    fn interpolate(start: &Self, end: &Self, t: f32) -> Self {
36        return *end;
37    }
38}
39
40#[derive(Copy, Clone, PartialEq, Debug)]
41pub struct Opacity(pub f32);
42
43impl Default for Opacity {
44    fn default() -> Self {
45        Opacity(1.0)
46    }
47}
48
49impl Interpolator for Opacity {
50    fn interpolate(start: &Self, end: &Self, t: f32) -> Self {
51        return Opacity(start.0 + (end.0 - start.0) * t);
52    }
53}
54
55#[derive(Debug, Clone)]
56pub struct FocusOrder {
57    pub next: Entity,
58    pub prev: Entity,
59}
60
61impl Default for FocusOrder {
62    fn default() -> Self {
63        FocusOrder {
64            next: Entity::null(),
65            prev: Entity::null(),
66        }
67    }
68}
69
70#[derive(Debug, Clone, Copy, PartialEq)]
71pub enum BorderCornerShape {
72    Round,
73    Bevel,
74}
75
76impl Default for BorderCornerShape {
77    fn default() -> Self {
78        BorderCornerShape::Round
79    }
80}