Skip to main content

slt/layout/
command.rs

1use super::*;
2
3/// Main axis direction for a container's children.
4#[non_exhaustive]
5#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub enum Direction {
7    /// Lay out children horizontally (left to right).
8    Row,
9    /// Lay out children vertically (top to bottom).
10    Column,
11}
12
13#[derive(Debug, Clone)]
14pub(crate) enum Command {
15    Text {
16        content: String,
17        cursor_offset: Option<usize>,
18        style: Style,
19        grow: u16,
20        align: Align,
21        wrap: bool,
22        truncate: bool,
23        margin: Margin,
24        constraints: Constraints,
25    },
26    BeginContainer {
27        direction: Direction,
28        gap: u32,
29        align: Align,
30        align_self: Option<Align>,
31        justify: Justify,
32        border: Option<Border>,
33        border_sides: BorderSides,
34        border_style: Style,
35        bg_color: Option<Color>,
36        padding: Padding,
37        margin: Margin,
38        constraints: Constraints,
39        title: Option<(String, Style)>,
40        grow: u16,
41        group_name: Option<String>,
42    },
43    BeginScrollable {
44        grow: u16,
45        border: Option<Border>,
46        border_sides: BorderSides,
47        border_style: Style,
48        padding: Padding,
49        margin: Margin,
50        constraints: Constraints,
51        title: Option<(String, Style)>,
52        scroll_offset: u32,
53    },
54    Link {
55        text: String,
56        url: String,
57        style: Style,
58        margin: Margin,
59        constraints: Constraints,
60    },
61    RichText {
62        segments: Vec<(String, Style)>,
63        wrap: bool,
64        align: Align,
65        margin: Margin,
66        constraints: Constraints,
67    },
68    EndContainer,
69    BeginOverlay {
70        modal: bool,
71    },
72    EndOverlay,
73    Spacer {
74        grow: u16,
75    },
76    FocusMarker(usize),
77    InteractionMarker(usize),
78    RawDraw {
79        draw_id: usize,
80        constraints: Constraints,
81        grow: u16,
82        margin: Margin,
83    },
84}