use crate::foundation::{NSInteger, NSUInteger};
#[derive(Debug)]
pub enum LayoutConstraintOrientation {
Horizontal,
Vertical,
Unknown(NSInteger)
}
impl From<NSInteger> for LayoutConstraintOrientation {
fn from(i: NSInteger) -> Self {
match i {
0 => Self::Horizontal,
1 => Self::Vertical,
i => Self::Unknown(i)
}
}
}
#[derive(Debug)]
pub enum LayoutRelation {
LessThanOrEqual,
Equal,
GreaterThanOrEqual,
Unknown(NSInteger)
}
impl From<NSInteger> for LayoutRelation {
fn from(i: NSInteger) -> Self {
match i {
-1 => Self::LessThanOrEqual,
0 => Self::Equal,
1 => Self::GreaterThanOrEqual,
i => Self::Unknown(i)
}
}
}
#[derive(Debug)]
pub enum LayoutAttribute {
Left,
Right,
Top,
Bottom,
Leading,
Trailing,
Width,
Height,
CenterX,
CenterY,
LastBaseline,
FirstBaseline,
NotAnAttribute,
Unknown(NSInteger)
}
impl From<NSInteger> for LayoutAttribute {
fn from(i: NSInteger) -> Self {
match i {
1 => Self::Left,
2 => Self::Right,
3 => Self::Top,
4 => Self::Bottom,
5 => Self::Leading,
6 => Self::Trailing,
7 => Self::Width,
8 => Self::Height,
9 => Self::CenterX,
10 => Self::CenterY,
11 => Self::LastBaseline,
12 => Self::FirstBaseline,
0 => Self::NotAnAttribute,
i => Self::Unknown(i)
}
}
}
#[derive(Debug)]
pub enum LayoutFormat {
AlignAllLeft,
AlignAllRight,
AlignAllTop,
AlignAllBottom,
AlignAllLeading,
AlignAllTrailing,
AlignAllCenterX,
AlignAllCenterY,
AlignAllLastBaseline,
DirectionLeadingToTrailing,
DirectionLeftToRight,
DirectionRightToLeft,
Unknown(NSUInteger)
}
impl From<NSUInteger> for LayoutFormat {
fn from(i: NSUInteger) -> Self {
match i {
2 => Self::AlignAllLeft,
4 => Self::AlignAllRight,
8 => Self::AlignAllTop,
16 => Self::AlignAllBottom,
32 => Self::AlignAllLeading,
64 => Self::AlignAllTrailing,
512 => Self::AlignAllCenterX,
1024 => Self::AlignAllCenterY,
2048 => Self::AlignAllLastBaseline,
0 => Self::DirectionLeadingToTrailing,
65536 => Self::DirectionLeftToRight,
131072 => Self::DirectionRightToLeft,
i => Self::Unknown(i)
}
}
}
#[derive(Debug)]
pub enum LayoutPriority {
Required,
High,
Low
}