diff --git a/crates/warpui_core/src/core/view/tui.rs b/crates/warpui_core/src/core/view/tui.rs index cc8706050a..81c76ac5b3 100644 --- a/crates/warpui_core/src/core/view/tui.rs +++ b/crates/warpui_core/src/core/view/tui.rs @@ -41,6 +41,16 @@ pub trait TuiView: Entity { ctx.set.insert(Self::ui_name()); ctx } + + /// Returns the ids of child views this view directly owns via + /// [`ViewHandle`]s that are not registered in the structural parent/child + /// graph, regardless of whether they are currently being rendered. + /// + /// See [`View::child_view_ids`](crate::View::child_view_ids) for the full + /// contract. The semantics are identical for TUI views. + fn child_view_ids(&self, _app: &AppContext) -> Vec { + Vec::new() + } } /// The object-safe, type-erased TUI view object stored per window: the TUI @@ -66,6 +76,7 @@ pub trait AnyTuiView { view_id: EntityId, ); fn keymap_context(&self, app: &AppContext) -> keymap::Context; + fn child_view_ids(&self, app: &AppContext) -> Vec; } impl AnyTuiView for T @@ -113,4 +124,8 @@ where fn keymap_context(&self, app: &AppContext) -> keymap::Context { TuiView::keymap_context(self, app) } + + fn child_view_ids(&self, app: &AppContext) -> Vec { + TuiView::child_view_ids(self, app) + } } diff --git a/crates/warpui_core/src/core/window.rs b/crates/warpui_core/src/core/window.rs index b1824b9df3..c428c8c0c7 100644 --- a/crates/warpui_core/src/core/window.rs +++ b/crates/warpui_core/src/core/window.rs @@ -195,4 +195,12 @@ impl StoredView { StoredView::Tui(_) => None, } } + + pub fn child_view_ids(&self, app: &AppContext) -> Vec { + match self { + StoredView::Gui(view) => view.child_view_ids(app), + #[cfg(feature = "tui")] + StoredView::Tui(view) => view.child_view_ids(app), + } + } }