1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::numeric::NumericType;
use crate::{
border::BorderBuilder, brush::Brush, core::color::Color, core::pool::Handle,
numeric::NumericUpDownBuilder, text::TextBuilder, widget::WidgetBuilder, BuildContext,
Thickness, UiNode, VerticalAlignment,
};
pub mod vec2;
pub mod vec3;
pub mod vec4;
pub fn make_numeric_input<T: NumericType>(
ctx: &mut BuildContext,
column: usize,
value: T,
editable: bool,
) -> Handle<UiNode> {
NumericUpDownBuilder::new(
WidgetBuilder::new()
.on_row(0)
.on_column(column)
.with_margin(Thickness {
left: 1.0,
top: 0.0,
right: 1.0,
bottom: 0.0,
}),
)
.with_precision(3)
.with_value(value)
.with_editable(editable)
.build(ctx)
}
pub fn make_mark(
ctx: &mut BuildContext,
text: &str,
column: usize,
color: Color,
) -> Handle<UiNode> {
BorderBuilder::new(
WidgetBuilder::new()
.on_row(0)
.on_column(column)
.with_background(Brush::Solid(color))
.with_foreground(Brush::Solid(Color::TRANSPARENT))
.with_child(
TextBuilder::new(WidgetBuilder::new())
.with_vertical_text_alignment(VerticalAlignment::Center)
.with_text(text)
.build(ctx),
),
)
.build(ctx)
}