This commit is contained in:
JMARyA 2025-01-15 18:53:55 +01:00
parent ed739d792f
commit e9a9dad037
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
19 changed files with 278 additions and 177 deletions

View file

@ -16,12 +16,14 @@ impl Render for SpaceBetweenWidget {
}
impl SpaceBetweenWidget {
pub fn x(mut self, x: ScreenValue) -> Self {
#[must_use]
pub const fn x(mut self, x: ScreenValue) -> Self {
self.1 = Some(x);
self
}
pub fn y(mut self, y: ScreenValue) -> Self {
#[must_use]
pub const fn y(mut self, y: ScreenValue) -> Self {
self.2 = Some(y);
self
}
@ -36,11 +38,11 @@ impl UIWidget for SpaceBetweenWidget {
let mut ret = Vec::new();
if let Some(x) = &self.1 {
ret.push(format!("space-x-{}", x.to_string()));
ret.push(format!("space-x-{}", x.to_value()));
}
if let Some(y) = &self.2 {
ret.push(format!("space-y-{}", y.to_string()));
ret.push(format!("space-y-{}", y.to_value()));
}
ret
@ -108,44 +110,45 @@ pub enum ScreenValue {
}
impl ScreenValue {
pub fn to_string(&self) -> &str {
#[must_use]
pub const fn to_value(&self) -> &str {
match self {
ScreenValue::_0 => "0",
ScreenValue::_0p5 => "0.5",
ScreenValue::_1 => "1",
ScreenValue::_1p5 => "1.5",
ScreenValue::_2 => "2",
ScreenValue::_2p5 => "2.5",
ScreenValue::_3 => "3",
ScreenValue::_3p5 => "3.5",
ScreenValue::_4 => "4",
ScreenValue::_5 => "5",
ScreenValue::_6 => "6",
ScreenValue::_7 => "7",
ScreenValue::_8 => "8",
ScreenValue::_9 => "9",
ScreenValue::_10 => "10",
ScreenValue::_11 => "11",
ScreenValue::_12 => "12",
ScreenValue::_14 => "14",
ScreenValue::_16 => "16",
ScreenValue::_20 => "20",
ScreenValue::_24 => "24",
ScreenValue::_28 => "28",
ScreenValue::_32 => "32",
ScreenValue::_36 => "36",
ScreenValue::_40 => "40",
ScreenValue::_44 => "44",
ScreenValue::_48 => "48",
ScreenValue::_52 => "52",
ScreenValue::_56 => "56",
ScreenValue::_60 => "60",
ScreenValue::_64 => "64",
ScreenValue::_72 => "72",
ScreenValue::_80 => "80",
ScreenValue::_90 => "90",
ScreenValue::px => "px",
ScreenValue::reverse => "reverse",
Self::_0 => "0",
Self::_0p5 => "0.5",
Self::_1 => "1",
Self::_1p5 => "1.5",
Self::_2 => "2",
Self::_2p5 => "2.5",
Self::_3 => "3",
Self::_3p5 => "3.5",
Self::_4 => "4",
Self::_5 => "5",
Self::_6 => "6",
Self::_7 => "7",
Self::_8 => "8",
Self::_9 => "9",
Self::_10 => "10",
Self::_11 => "11",
Self::_12 => "12",
Self::_14 => "14",
Self::_16 => "16",
Self::_20 => "20",
Self::_24 => "24",
Self::_28 => "28",
Self::_32 => "32",
Self::_36 => "36",
Self::_40 => "40",
Self::_44 => "44",
Self::_48 => "48",
Self::_52 => "52",
Self::_56 => "56",
Self::_60 => "60",
Self::_64 => "64",
Self::_72 => "72",
Self::_80 => "80",
Self::_90 => "90",
Self::px => "px",
Self::reverse => "reverse",
}
}
}