#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum Status {
#[default]
Active,
Hovered,
Pressed,
Disabled,
Focused,
}
impl Status {
#[must_use]
pub const fn is_interactive(self) -> bool {
!matches!(self, Self::Disabled)
}
#[must_use]
pub const fn shows_hover(self) -> bool {
matches!(self, Self::Hovered)
}
#[must_use]
pub const fn shows_pressed(self) -> bool {
matches!(self, Self::Pressed)
}
}
impl From<iced::widget::button::Status> for Status {
fn from(status: iced::widget::button::Status) -> Self {
match status {
iced::widget::button::Status::Active => Self::Active,
iced::widget::button::Status::Hovered => Self::Hovered,
iced::widget::button::Status::Pressed => Self::Pressed,
iced::widget::button::Status::Disabled => Self::Disabled,
}
}
}
impl From<iced::widget::text_input::Status> for Status {
fn from(status: iced::widget::text_input::Status) -> Self {
match status {
iced::widget::text_input::Status::Active => Self::Active,
iced::widget::text_input::Status::Hovered => Self::Hovered,
iced::widget::text_input::Status::Focused => Self::Focused,
iced::widget::text_input::Status::Disabled => Self::Disabled,
}
}
}