freya_core/accessibility/focusable.rs
1#[derive(Clone, Debug, PartialEq, Default, Eq)]
2pub enum Focusable {
3 #[default]
4 Unknown,
5 Disabled,
6 Enabled,
7}
8
9impl From<bool> for Focusable {
10 fn from(value: bool) -> Self {
11 if value {
12 Focusable::Enabled
13 } else {
14 Focusable::Disabled
15 }
16 }
17}
18
19impl Focusable {
20 pub fn is_unknown(&self) -> bool {
21 matches!(self, Self::Unknown)
22 }
23
24 pub fn is_enabled(&self) -> bool {
25 matches!(self, Self::Enabled)
26 }
27}