#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct ElementId(pub u64);
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Bounds {
pub x: i32,
pub y: i32,
pub width: i32,
pub height: i32,
}
impl Bounds {
pub fn center(&self) -> (i32, i32) {
(self.x + self.width / 2, self.y + self.height / 2)
}
pub fn is_visible(&self) -> bool {
self.width > 0 && self.height > 0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Role {
Button,
Link,
TextInput,
MenuItem,
Tab,
Checkbox,
Radio,
ComboBox,
ListItem,
TreeItem,
Other,
}
#[derive(Debug, Clone)]
pub struct Element {
pub id: ElementId,
pub role: Role,
pub name: Option<String>,
pub bounds: Bounds,
}