Newer
Older
use orbtk::*;
struct MainView;
impl Widget for MainView {
type Template = Template;
fn create() -> Self::Template {
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Template::new()
.child(
Grid::create()
.columns(
Columns::create()
.column("*")
.column("Auto")
.column(50.0)
.build(),
)
.rows(Rows::create().row("*").row("*").build())
.child(
Grid::create()
.selector("lynch")
.margin((10.0, 0.0, 0.0, 4.0))
.attach_property(GridColumn(0))
.child(
TextBlock::create()
.text("(0,0)")
.horizontal_alignment("Center")
.vertical_alignment("Center"),
),
)
.child(
Grid::create()
.selector("bluebayoux")
.margin(10.0)
.attach_property(GridColumn(1))
.child(
TextBlock::create()
.text("(1,0)")
.horizontal_alignment("Center")
.vertical_alignment("Center"),
),
)
.child(
Grid::create()
.selector("linkwater")
.attach_property(GridColumn(2))
.child(
TextBlock::create()
.text("(2,0)")
.selector("linkwater")
.horizontal_alignment("Center")
.vertical_alignment("Center"),
),
)
.child(
Grid::create()
.selector("goldendream")
.attach_property(GridColumn(0))
.attach_property(GridRow(1))
.attach_property(ColumnSpan(3))
.child(
TextBlock::create()
.text("(0,1) - ColumnSpan 3")
.selector("goldendream")
.horizontal_alignment("Center")
.vertical_alignment("Center"),
),
),
)
.debug_name("MainView")
}
}
fn main() {
let mut application = Application::default();
application
.create_window()
.bounds(Bounds::new(100.0, 100.0, 420.0, 730.0))
.title("OrbTk - grid example")
.root(MainView::create())
.theme(
.debug_flag(false)
.build();
application.run();
}