Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions crates/warpui_core/src/core/view/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<EntityId> {
Vec::new()
}
}

/// The object-safe, type-erased TUI view object stored per window: the TUI
Expand All @@ -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<EntityId>;
}

impl<T> AnyTuiView for T
Expand Down Expand Up @@ -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<EntityId> {
TuiView::child_view_ids(self, app)
}
}
8 changes: 8 additions & 0 deletions crates/warpui_core/src/core/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,12 @@ impl StoredView {
StoredView::Tui(_) => None,
}
}

pub fn child_view_ids(&self, app: &AppContext) -> Vec<EntityId> {
match self {
StoredView::Gui(view) => view.child_view_ids(app),
#[cfg(feature = "tui")]
StoredView::Tui(view) => view.child_view_ids(app),
}
}
}
Loading