pub trait TabGroupRenderer: 'static {
// Required method
fn render_tab_bar(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement;
// Provided methods
fn frame(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div> { ... }
fn content_frame(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div> { ... }
fn render_active_panel(
&self,
panel: AnyView,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement { ... }
fn render_drop_indicator(
&self,
indicator: DropIndicator,
window: &mut Window,
cx: &mut App,
) -> Option<AnyElement> { ... }
fn render_empty(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> Option<AnyElement> { ... }
}Expand description
Everything gpui_base::dock exports, so a consumer never has to depend
on the foundation crate directly to write a skin or read a container’s
state. Kept in step with base’s own list by
every_base_dock_export_is_reachable_from_here.
Two names are handled elsewhere and one is deliberately absent:
base’s Panel and PanelView arrive as BasePanel and BasePanelView
because this module’s Panel/PanelView are the presentation halves that
extend them, and base’s Dock — a plain state struct holding one dock’s
open, collapsible, size and resizing flags — is not re-exported at all,
because the name meant a panel container in every released version of this
crate and handing it back with a different meaning is worse than dropping
it. A skin reads a dock through DockContext.
Appearance for a tab group. Base draws none of it.
The two frame hooks return the element itself rather than wrapping one, because base attaches focus, keyboard grouping, and drop handling to the very elements the skin styles: a wrapper would put the hit area and the painted area on different elements.
Required Methods§
fn render_tab_bar( &self, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> AnyElement
Provided Methods§
Sourcefn frame(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div>
fn frame( &self, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> Stateful<Div>
The group’s outer frame, which base tracks focus on.
Identified rather than plain, so a skin can add a role, a tooltip, or
scroll tracking; Stateful<Div> does everything base needs from it.
Appearance only. The group is laid out as a column that fills its slot
around whatever this returns, because a group that does not is a strip
of tabs with no content under it.
Sourcefn content_frame(
&self,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> Stateful<Div>
fn content_frame( &self, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> Stateful<Div>
The region below the tab bar, which base installs drop handling on.
Sourcefn render_active_panel(
&self,
panel: AnyView,
group: &TabGroupContext,
window: &mut Window,
cx: &mut App,
) -> AnyElement
fn render_active_panel( &self, panel: AnyView, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> AnyElement
How the displayed panel’s view is placed in the content region. The skin receives the view rather than an element so it can decide how the view is cached and stretched.
fn render_drop_indicator( &self, indicator: DropIndicator, window: &mut Window, cx: &mut App, ) -> Option<AnyElement>
fn render_empty( &self, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> Option<AnyElement>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".