pub struct TableLayout {
pub cell_defaults: CellProperties,
pub row_defaults: BTreeMap<u8, CellProperties>,
pub column_defaults: BTreeMap<u8, CellProperties>,
pub opcodes: Vec<LayoutOp>,
pub row: u8,
pub column: u8,
}
Fields§
§cell_defaults: CellProperties
§row_defaults: BTreeMap<u8, CellProperties>
§column_defaults: BTreeMap<u8, CellProperties>
§opcodes: Vec<LayoutOp>
§row: u8
§column: u8
Implementations§
Source§impl TableLayout
impl TableLayout
Sourcepub fn new() -> TableLayout
pub fn new() -> TableLayout
Examples found in repository?
examples/barebones.rs (line 6)
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}
Sourcepub fn get_rows_cols(&self) -> (u8, u8)
pub fn get_rows_cols(&self) -> (u8, u8)
Calculates the number of rows and columns which exist in this table layout.
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Removes all layout declarations from the table. Does not remove row or column defaults.
Sourcepub fn full_clear(&mut self)
pub fn full_clear(&mut self)
Removes all layout declarations and resets ALL settings to factory default.
Sourcepub fn with_row(&mut self) -> &mut Self
pub fn with_row(&mut self) -> &mut Self
Adds a new row to the layout.
Examples found in repository?
examples/barebones.rs (line 22)
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}
Sourcepub fn with_cell(&mut self, properties: CellProperties) -> &mut Self
pub fn with_cell(&mut self, properties: CellProperties) -> &mut Self
Hands the cell off to the layout.
Examples found in repository?
examples/barebones.rs (lines 7-10)
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}
Sourcepub fn impose(&mut self, width: f32, height: f32)
pub fn impose(&mut self, width: f32, height: f32)
Examples found in repository?
examples/barebones.rs (line 30)
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}
Trait Implementations§
Source§impl Default for TableLayout
impl Default for TableLayout
Source§fn default() -> TableLayout
fn default() -> TableLayout
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TableLayout
impl !RefUnwindSafe for TableLayout
impl !Send for TableLayout
impl !Sync for TableLayout
impl Unpin for TableLayout
impl !UnwindSafe for TableLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more