barebones/
barebones.rs

1
2extern crate sktablelayout;
3use sktablelayout::*;
4
5fn main() {
6    let mut engine = TableLayout::new();
7    engine.with_cell(CellProperties::new()
8                    .callback(Box::new(|x, y, w, h| println!("{} {} {} {}", x, y, w, h)))
9                    .anchor_right()
10                    .preferred_size(Size{width: 64.0, height: 64.0}));
11    engine.with_cell(CellProperties::new()
12                    .callback(Box::new(|x, y, w, h| println!("{} {} {} {}", x, y, w, h)))
13                    .anchor_right()
14                    .expand_horizontal()
15                    .preferred_size(Size{width: 64.0, height: 64.0}));
16    engine.with_cell(CellProperties::new()
17                    .callback(Box::new(|x, y, w, h| println!("{} {} {} {}", x, y, w, h)))
18                    .anchor_right()
19                    .expand_horizontal()
20                    .fill_horizontal()
21                    .preferred_size(Size{width: 64.0, height: 64.0}));
22    engine.with_row();
23    engine.with_cell(CellProperties::new()
24                    .callback(Box::new(|x, y, w, h| println!("{} {} {} {}", x, y, w, h)))
25                    .colspan(3)
26                    .expand_vertical()
27                    .anchor_bottom()
28                    .fill_horizontal()
29                    .preferred_size(Size{width: 64.0, height: 64.0}));
30    engine.impose(320.0, 240.0);
31}
32