Newer
Older
use orbtk::*;
struct MainView;
// todo: check running by each system
// todo: use ParentType::Single as default
impl Widget for MainView {
fn create() -> Template {
Template::default().debug_name("MainView").child(
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
Grid::create()
.selector("green")
.property(
Columns::create()
.column("*")
.column("Auto")
.column(50.0)
.build(),
)
.property(Rows::create().row("*").row("*").build())
.child(
Grid::create()
.selector("blue")
.property(GridColumn(0))
.child(TextBlock::create().property(Label::from("(0,0)"))),
)
.child(
Grid::create()
.selector("yellow")
.property(GridColumn(1))
.child(
TextBlock::create()
.property(Label::from("(1,0)"))
.horizontal_alignment("Center")
.vertical_alignment("Center")
),
)
.child(
Grid::create()
.selector("red")
.property(GridColumn(2))
.child(TextBlock::create().property(Label::from("(1,1)"))),
)
.child(
Grid::create()
.selector("olive")
.property(GridColumn(1))
.property(GridRow(1))
.property(ColumnSpan(2))
.child(TextBlock::create().property(Label::from("(1,1)"))),
),
)
}
}
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(
.build();
application.run();
}