[go: up one dir, main page]

Trait egui_dock::TabViewer

source ·
pub trait TabViewer {
    type Tab;

    fn ui(&mut self, ui: &mut Ui, tab: &mut Self::Tab);
    fn title(&mut self, tab: &mut Self::Tab) -> WidgetText;

    fn context_menu(&mut self, _ui: &mut Ui, _tab: &mut Self::Tab) { ... }
    fn on_close(&mut self, _tab: &mut Self::Tab) -> bool { ... }
    fn on_add(&mut self, _node: NodeIndex) { ... }
    fn add_popup(&mut self, _ui: &mut Ui, _node: NodeIndex) { ... }
    fn force_close(&mut self, _tab: &mut Self::Tab) -> bool { ... }
    fn inner_margin_override(&self, style: &Style) -> Margin { ... }
    fn clear_background(&self, _tab: &Self::Tab) -> bool { ... }
}
Expand description

How we view a tab when its in a Tree.

Required Associated Types§

Required Methods§

Actual tab content.

The title to be displayed.

Provided Methods§

Content inside context_menu.

This is called when the tabs close button is pressed.

Returns true if the tab should close immediately, false otherwise.

NOTE if returning false ui will still be called once more if this tab is active.

This is called when the tabs add button is pressed.

This requires the dock style’s show_add_buttons to be true.

The _node specifies which Node or split of the tree that this particular add button was pressed on.

Content of add_popup. Displays a popup under the add button. Useful for selecting what type of tab to add.

This requires the dock style’s show_add_buttons and show_add_popup to be true.

This is called every frame after ui is called (if the tab is active).

Returns true if the tab should be forced to close, false otherwise.

In the event this function returns true the tab will be removed without calling on_close.

Sets the margins between tab’s borders and its contents.

Whether the tab will be cleared with the color specified in Style::tab_background_color

Implementors§