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§
sourcefn title(&mut self, tab: &mut Self::Tab) -> WidgetText
fn title(&mut self, tab: &mut Self::Tab) -> WidgetText
The title to be displayed.
Provided Methods§
Content inside context_menu.
sourcefn on_close(&mut self, _tab: &mut Self::Tab) -> bool
fn on_close(&mut self, _tab: &mut Self::Tab) -> bool
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.
sourcefn on_add(&mut self, _node: NodeIndex)
fn on_add(&mut self, _node: NodeIndex)
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.
sourcefn add_popup(&mut self, _ui: &mut Ui, _node: NodeIndex)
fn add_popup(&mut self, _ui: &mut Ui, _node: NodeIndex)
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.
sourcefn force_close(&mut self, _tab: &mut Self::Tab) -> bool
fn force_close(&mut self, _tab: &mut Self::Tab) -> bool
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.
sourcefn inner_margin_override(&self, style: &Style) -> Margin
fn inner_margin_override(&self, style: &Style) -> Margin
Sets the margins between tab’s borders and its contents.
sourcefn clear_background(&self, _tab: &Self::Tab) -> bool
fn clear_background(&self, _tab: &Self::Tab) -> bool
Whether the tab will be cleared with the color specified in Style::tab_background_color