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
56
57
58
59
60
61
62
63
64
use crate::styling::cell::CellAlignment;
use crate::styling::column::Constraint;
pub struct Column {
pub index: usize,
pub(crate) padding: (u16, u16),
pub(crate) cell_alignment: Option<CellAlignment>,
pub(crate) max_content_width: u16,
pub(crate) constraint: Option<Constraint>,
}
impl Column {
pub fn new(index: usize) -> Self {
Column {
index: index,
padding: (1, 1),
constraint: None,
max_content_width: 0,
cell_alignment: None,
}
}
pub fn set_padding(&mut self, padding: (u16, u16)) -> &mut Self {
self.padding = padding;
self
}
pub fn get_max_content_width(&self) -> u16 {
self.max_content_width
}
pub fn set_constraint(&mut self, constraint: Constraint) -> &mut Self {
self.constraint = Some(constraint);
self
}
pub fn get_constraint(&mut self) -> Option<&Constraint> {
self.constraint.as_ref()
}
pub fn set_cell_alignment(&mut self, alignment: Option<CellAlignment>) {
self.cell_alignment = alignment;
}
}