remove modules and have single event manager (atomics feature parity + preparation for local state)

This commit is contained in:
2025-12-12 01:46:24 -05:00
parent a708813ce7
commit 37b1987aa8
17 changed files with 390 additions and 432 deletions

26
core/src/widget/data.rs Normal file
View File

@@ -0,0 +1,26 @@
use std::any::TypeId;
use crate::{Widget, util::HashSet};
pub struct WidgetData {
pub widget: Box<dyn Widget>,
pub label: String,
pub event_mgrs: HashSet<TypeId>,
/// dynamic borrow checking
pub borrowed: bool,
}
impl WidgetData {
pub fn new<W: Widget>(widget: W) -> Self {
let mut label = std::any::type_name::<W>().to_string();
if let (Some(first), Some(last)) = (label.find(":"), label.rfind(":")) {
label = label.split_at(first).0.to_string() + "::" + label.split_at(last + 1).1;
}
Self {
widget: Box::new(widget),
label,
borrowed: false,
event_mgrs: Default::default(),
}
}
}