Trait egui_dock::widgets::tab_viewer::TabViewer
source · pub trait TabViewer {
type Tab;
Show 14 methods
// Required methods
fn title(&mut self, tab: &mut Self::Tab) -> WidgetText;
fn ui(&mut self, ui: &mut Ui, tab: &mut Self::Tab);
// Provided methods
fn context_menu(
&mut self,
_ui: &mut Ui,
_tab: &mut Self::Tab,
_surface: SurfaceIndex,
_node: NodeIndex
) { ... }
fn id(&mut self, tab: &mut Self::Tab) -> Id { ... }
fn on_tab_button(&mut self, _tab: &mut Self::Tab, _response: &Response) { ... }
fn closeable(&mut self, _tab: &mut Self::Tab) -> bool { ... }
fn on_close(&mut self, _tab: &mut Self::Tab) -> bool { ... }
fn on_add(&mut self, _surface: SurfaceIndex, _node: NodeIndex) { ... }
fn add_popup(
&mut self,
_ui: &mut Ui,
_surface: SurfaceIndex,
_node: NodeIndex
) { ... }
fn force_close(&mut self, _tab: &mut Self::Tab) -> bool { ... }
fn tab_style_override(
&self,
_tab: &Self::Tab,
_global_style: &TabStyle
) -> Option<TabStyle> { ... }
fn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool { ... }
fn clear_background(&self, _tab: &Self::Tab) -> bool { ... }
fn scroll_bars(&self, _tab: &Self::Tab) -> [bool; 2] { ... }
}
Expand description
Defines how a tab should behave and be rendered inside 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 in the tab bar.
Provided Methods§
sourcefn id(&mut self, tab: &mut Self::Tab) -> Id
fn id(&mut self, tab: &mut Self::Tab) -> Id
Unique ID for this tab.
If not implemented, uses tab title text as an ID source.
Called after each tab button is shown, so you can add a tooltip, check for clicks, etc.
sourcefn closeable(&mut self, _tab: &mut Self::Tab) -> bool
fn closeable(&mut self, _tab: &mut Self::Tab) -> bool
Returns true
if the user of your app should be able to close a given _tab
.
By default true
is always returned.
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 _tab
gets closed by the user.
Returns true
if the tab should close immediately, otherwise false
.
Note: if false
is returned, ui
will still be called once more if this
tab is active.
sourcefn on_add(&mut self, _surface: SurfaceIndex, _node: NodeIndex)
fn on_add(&mut self, _surface: SurfaceIndex, _node: NodeIndex)
sourcefn add_popup(&mut self, _ui: &mut Ui, _surface: SurfaceIndex, _node: NodeIndex)
fn add_popup(&mut self, _ui: &mut Ui, _surface: SurfaceIndex, _node: NodeIndex)
Content of the popup under the add button. Useful for selecting what type of tab to add.
This requires that DockArea::show_add_buttons
and
DockArea::show_add_popup
are set to 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 tab_style_override(
&self,
_tab: &Self::Tab,
_global_style: &TabStyle
) -> Option<TabStyle>
fn tab_style_override( &self, _tab: &Self::Tab, _global_style: &TabStyle ) -> Option<TabStyle>
Sets custom style for given tab.
sourcefn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool
fn allowed_in_windows(&self, _tab: &mut Self::Tab) -> bool
Specifies a tab’s ability to be shown in a window.
Returns false
if this tab should never be turned into a window.
sourcefn clear_background(&self, _tab: &Self::Tab) -> bool
fn clear_background(&self, _tab: &Self::Tab) -> bool
Whether the tab body will be cleared with the color specified in
TabBarStyle::bg_fill
.
sourcefn scroll_bars(&self, _tab: &Self::Tab) -> [bool; 2]
fn scroll_bars(&self, _tab: &Self::Tab) -> [bool; 2]
Returns true
if the horizontal and vertical scroll bars will be shown for tab
.
By default, both scroll bars are shown.