pub struct DockLayout { /* private fields */ }Expand description
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 tiles() -> Self
pub fn tiles() -> Self
A tiles canvas: panels placed at free coordinates, each dragged and resized on its own.
Sourcepub fn child(self, child: DockLayout, size: Option<Pixels>) -> Self
pub fn child(self, child: DockLayout, size: Option<Pixels>) -> Self
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_view(self, panel: Arc<dyn PanelView>, cx: &App) -> Self
pub fn panel_view(self, panel: Arc<dyn PanelView>, cx: &App) -> Self
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: Panel>(self, panel: Entity<P>, bounds: Bounds<Pixels>) -> Self
pub fn tile<P: Panel>(self, panel: Entity<P>, bounds: Bounds<Pixels>) -> Self
Place a panel on a tiles canvas.
Sourcepub fn tile_view(
self,
panel: Arc<dyn PanelView>,
bounds: Bounds<Pixels>,
cx: &App,
) -> Self
pub fn tile_view( self, panel: Arc<dyn PanelView>, bounds: Bounds<Pixels>, cx: &App, ) -> Self
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) -> Self
pub fn active_index(self, ix: usize) -> Self
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