pub struct DockLayout { /* private fields */ }Expand description
Everything gpui_base::dock exports, so a consumer never has to depend
on the foundation crate directly to write a skin or read a container’s
state. Kept in step with base’s own list by
every_base_dock_export_is_reachable_from_here.
Two names are handled elsewhere and one is deliberately absent:
base’s Panel and PanelView arrive as BasePanel and BasePanelView
because this module’s Panel/PanelView are the presentation halves that
extend them, and base’s Dock — a plain state struct holding one dock’s
open, collapsible, size and resizing flags — is not re-exported at all,
because the name meant a panel container in every released version of this
crate and handing it back with a different meaning is worse than dropping
it. A skin reads a dock through DockContext.
Describes a layout without constructing any entity.
Building a layout used to require window and cx because every node was
an entity. Now a layout is data, and DockArea reconciles it into entities
when it is installed.
Misuse — a panel added to a split, a child container added to a tab group,
an active index on anything but a tab group — trips a debug_assert! and
is otherwise ignored, matching how the old DockItem::active_index guarded
itself. A type-state builder would reject the same mistakes at compile
time, but it needs four marker types and leaks into every consumer
signature; the runtime assertion is proportionate for a builder whose
misuse shows up on the first debug run.
Implementations§
Source§impl DockLayout
impl DockLayout
Sourcepub fn h_split() -> DockLayout
pub fn h_split() -> DockLayout
A split whose children sit side by side.
Sourcepub fn v_split() -> DockLayout
pub fn v_split() -> DockLayout
A split whose children stack.
Sourcepub fn tabs() -> DockLayout
pub fn tabs() -> DockLayout
A tab group: panels stacked one at a time, selected from a tab bar.
Sourcepub fn tiles() -> DockLayout
pub fn tiles() -> DockLayout
A tiles canvas: panels placed at free coordinates, each dragged and resized on its own.
Sourcepub fn child(self, child: DockLayout, size: Option<Pixels>) -> DockLayout
pub fn child(self, child: DockLayout, size: Option<Pixels>) -> DockLayout
Add a child container to a split. size is the child’s slot along the
split’s axis; None leaves it unconstrained.
Sourcepub fn panel<P>(self, panel: Entity<P>) -> DockLayoutwhere
P: Panel,
pub fn panel<P>(self, panel: Entity<P>) -> DockLayoutwhere
P: Panel,
Add a panel to a tab group.
Sourcepub fn panel_view(self, panel: Arc<dyn PanelView>, cx: &App) -> DockLayout
pub fn panel_view(self, panel: Arc<dyn PanelView>, cx: &App) -> DockLayout
Add an already-wrapped panel handle to a tab group.
The companion to Self::panel, for a layer that hands base its own
concrete handle — see PanelView::as_any — rather than a bare
entity. cx is here because the id has to come from
PanelView::panel_id: unlike Self::panel, there is no entity in
hand to take it from.
Sourcepub fn tile<P>(self, panel: Entity<P>, bounds: Bounds<Pixels>) -> DockLayoutwhere
P: Panel,
pub fn tile<P>(self, panel: Entity<P>, bounds: Bounds<Pixels>) -> DockLayoutwhere
P: Panel,
Place a panel on a tiles canvas.
Sourcepub fn tile_view(
self,
panel: Arc<dyn PanelView>,
bounds: Bounds<Pixels>,
cx: &App,
) -> DockLayout
pub fn tile_view( self, panel: Arc<dyn PanelView>, bounds: Bounds<Pixels>, cx: &App, ) -> DockLayout
Place an already-wrapped panel handle on a tiles canvas. The companion
to Self::tile, for the same reason Self::panel_view is the
companion to Self::panel.
Sourcepub fn active_index(self, ix: usize) -> DockLayout
pub fn active_index(self, ix: usize) -> DockLayout
Which tab is displayed. Out-of-range values are clamped by
normalize once the layout is installed.
Auto Trait Implementations§
impl !RefUnwindSafe for DockLayout
impl !UnwindSafe for DockLayout
impl Freeze for DockLayout
impl Send for DockLayout
impl Sync for DockLayout
impl Unpin for DockLayout
impl UnsafeUnpin for DockLayout
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more