Skip to main content

embedded_gui/widgets/
cinematic.rs

1use crate::{
2    geometry::Rect,
3    style::Style,
4    widget::{PropertyKey, PropertyValue, Widget},
5};
6
7/// Glance tile HUD component.
8#[derive(Clone, Copy, Debug, PartialEq)]
9pub struct GlanceTileWidget<'a> {
10    pub icon: char,
11    pub title: &'a str,
12    pub subtitle: &'a str,
13    pub highlighted: bool,
14}
15
16impl<'a> Widget for GlanceTileWidget<'a> {
17    fn render_widget_bounds(&self, _bounds: Rect, _style: &Style) {}
18
19    fn get_property(&self, key: PropertyKey) -> Option<PropertyValue<'_>> {
20        match key {
21            PropertyKey::State => Some(PropertyValue::Bool(self.highlighted)),
22            PropertyKey::Text => Some(PropertyValue::Str(self.title)),
23            PropertyKey::Custom(0) => Some(PropertyValue::Char(self.icon)),
24            _ => None,
25        }
26    }
27}