pub trait Panel: Panel {
// Provided methods
fn tab_name(&self, cx: &App) -> Option<SharedString> { ... }
fn title(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> impl IntoElement { ... }
fn title_style(&self, cx: &App) -> Option<TitleStyle> { ... }
fn title_suffix(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Option<impl IntoElement> { ... }
fn toolbar_buttons(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Option<Vec<Button>> { ... }
fn dropdown_menu(
&mut self,
menu: PopupMenu,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> PopupMenu { ... }
fn zoom_control(&self, cx: &App) -> Option<PanelControl> { ... }
fn inner_padding(&self, cx: &App) -> bool { ... }
}Expand description
What a panel draws, on top of the behavior gpui_base::dock::Panel
defines.
Everything here has a default, so a panel that only implements base’s trait plus this one gets an unnamed title and no chrome.
Provided Methods§
Sourcefn tab_name(&self, cx: &App) -> Option<SharedString>
fn tab_name(&self, cx: &App) -> Option<SharedString>
The short name shown when a tab bar has no room for the full title.
Used by an already-collapsed tab group, where only the strip of tabs is on screen.
Sourcefn title(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> impl IntoElement
fn title( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> impl IntoElement
The panel’s title, as an element rather than a string so a panel can draw an icon, a badge, or a styled fragment in the tab.
Sourcefn title_style(&self, cx: &App) -> Option<TitleStyle>
fn title_style(&self, cx: &App) -> Option<TitleStyle>
Colors for the title, for a panel that wants its tab to stand out.
Sourcefn title_suffix(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> Option<impl IntoElement>
fn title_suffix( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> Option<impl IntoElement>
An element pinned to the trailing end of the title bar.
Buttons for the title bar’s toolbar.
Entries the panel adds to the title bar’s ellipsis menu.
Sourcefn zoom_control(&self, cx: &App) -> Option<PanelControl>
fn zoom_control(&self, cx: &App) -> Option<PanelControl>
Where the zoom affordance appears, or None for nowhere.
None withholds the whole affordance, not just the button: the
ToggleZoom action refuses to zoom a panel that
offers no control, so either answer alone is enough to mean “never
zoom”. Zooming out is never refused — a panel that stops offering
the control while zoomed would otherwise strand the user with no way
back.
gpui_base::dock::Panel::zoomable is the other half: it decides
whether zooming happens at all, and base refuses a zoom that fails it
however the zoom was asked for.
Sourcefn inner_padding(&self, cx: &App) -> bool
fn inner_padding(&self, cx: &App) -> bool
Whether the tab group pads the panel’s content when it draws it inside a tab bar.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".