Skip to main content

TabGroupRenderer

Trait TabGroupRenderer 

Source
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

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§

Source

fn render_tab_bar( &self, group: &TabGroupContext, window: &mut Window, cx: &mut App, ) -> AnyElement

Provided Methods§

Source

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.

Source

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.

Source

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.

Source

fn render_drop_indicator( &self, indicator: DropIndicator, window: &mut Window, cx: &mut App, ) -> Option<AnyElement>

Source

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".

Implementors§