dash-frontend: clock, wgui: refactoring, non-panicking casts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user