dash-frontend: Top panel title
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user