1 | /// PoolTableDimension is a dimension resolve strategy for [`PoolTable`] |
2 | /// |
3 | /// [`PoolTable`]: crate::tables::PoolTable |
4 | #[derive (Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)] |
5 | pub struct PoolTableDimension { |
6 | width: DimensionPriority, |
7 | height: DimensionPriority, |
8 | } |
9 | |
10 | impl PoolTableDimension { |
11 | /// Creates a new object. |
12 | pub fn new(width: DimensionPriority, height: DimensionPriority) -> Self { |
13 | Self { width, height } |
14 | } |
15 | |
16 | /// Return a width priority. |
17 | pub fn width(&self) -> DimensionPriority { |
18 | self.width |
19 | } |
20 | |
21 | /// Return a height priority. |
22 | pub fn height(&self) -> DimensionPriority { |
23 | self.height |
24 | } |
25 | } |
26 | |
27 | /// A control of width/height logic for situations where we must increase some cell to align columns/row. |
28 | #[derive (Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] |
29 | pub enum DimensionPriority { |
30 | /// Increase first cell width/height in a row/column. |
31 | First, |
32 | /// Increase last cell width/height in a row/column. |
33 | Last, |
34 | /// Increase cells width/height 1 by 1 in a row/column. |
35 | List, |
36 | } |
37 | |