dash-frontend: clock, wgui: refactoring, non-panicking casts

This commit is contained in:
Aleksander
2025-09-16 20:09:13 +02:00
parent 129785daa7
commit 0fdc0e3828
20 changed files with 287 additions and 165 deletions

View File

@@ -1,10 +1,16 @@
use slotmap::Key;
use crate::layout::WidgetID;
use super::{WidgetObj, WidgetState};
pub struct WidgetDiv {}
pub struct WidgetDiv {
id: WidgetID,
}
impl WidgetDiv {
pub fn create() -> WidgetState {
WidgetState::new(Box::new(Self {}))
WidgetState::new(Box::new(Self { id: WidgetID::null() }))
}
}
@@ -12,4 +18,12 @@ impl WidgetObj for WidgetDiv {
fn draw(&mut self, _state: &mut super::DrawState, _params: &super::DrawParams) {
// no-op
}
fn get_id(&self) -> WidgetID {
self.id
}
fn set_id(&mut self, id: WidgetID) {
self.id = id;
}
}