dash-frontend: Top panel title

This commit is contained in:
Aleksander
2026-01-27 18:43:34 +01:00
parent 2c60196ead
commit 19083cfd83
12 changed files with 87 additions and 39 deletions

View File

@@ -75,6 +75,10 @@ impl WidgetMap {
self.0.get(handle)?.get_as::<T>()
}
pub fn cast_as<T: 'static>(&self, handle: WidgetID) -> anyhow::Result<RefMut<'_, T>> {
self.get_as(handle).context("Widget cast failed")
}
pub fn get(&self, handle: WidgetID) -> Option<&Widget> {
self.0.get(handle)
}

View File

@@ -1,3 +1,4 @@
use anyhow::Context;
use glam::Vec2;
use taffy::{NodeId, TaffyTree};
@@ -248,10 +249,18 @@ impl dyn WidgetObj {
any.downcast_ref::<T>()
}
pub fn cast<T: 'static>(&self) -> anyhow::Result<&T> {
self.get_as().context("cast failed")
}
pub fn get_as_mut<T: 'static>(&mut self) -> Option<&mut T> {
let any = self.as_any_mut();
any.downcast_mut::<T>()
}
pub fn cast_mut<T: 'static>(&mut self) -> anyhow::Result<&mut T> {
self.get_as_mut().context("cast failed")
}
}
struct InvokeData<'a, 'b, U1: 'static, U2: 'static> {