Skip to main content

DockingModel

Struct DockingModel 

Source
pub struct DockingModel(/* private fields */);
Expand description

The shared docking-layout model. Clone = share-by-handle.

Implementations§

Source§

impl DockingModel

Source

pub fn new() -> Self

A fresh model: four empty, hidden sides and the default corner owners.

Source

pub fn version(&self) -> Signal<u64>

Structural version — bump on tab / pane / section / side add-remove. The widget binds this at BindingLevel::Rebuild.

Source

pub fn geometry_version(&self) -> Signal<u64>

Geometry version — bump on side size / visibility / corner change. The widget binds this at BindingLevel::Relayout.

Source

pub fn consume_animate_flag(&self) -> bool

Read-and-reset the “animate the next side show/hide” latch.

Source

pub fn is_registered(&self, id: DockWidgetId) -> bool

Whether a dock id is known (its content factory + meta are registered).

Source

pub fn set_side_rail(&self, side: DockSide, thickness: f32)

Set a side’s activity-rail thickness and presentation. A non-zero rail switches the side to TabPresentation::Rail; the in-side strip is then suppressed.

Source

pub fn set_side_size(&self, side: DockSide, size: f32)

Set a side’s stored content size (px). Relayout only (no rebuild).

Source

pub fn set_side_min_size(&self, side: DockSide, min: f32)

Set a side’s minimum content size (px).

Source

pub fn set_policy(&self, policy: DockPolicy)

Set the app’s DockPolicy — locks down end-user layout edits (the programmatic API keeps working). Structural → rebuild.

Source

pub fn policy(&self) -> DockPolicy

The app’s current DockPolicy (cheap Copy; read by the widgets in build() to gate their user affordances).

Source

pub fn set_side_enabled(&self, side: DockSide, enabled: bool)

Enable / disable a whole side. A disabled side renders nothing, reserves no space, is not a drop target, and rejects placement / moves to it; its docks stay in the model and reappear when re-enabled. Structural → rebuild.

Source

pub fn is_side_enabled(&self, side: DockSide) -> bool

Whether a side is enabled (default true).

Source

pub fn set_side_visible(&self, side: DockSide, visible: bool)

Show / hide a whole side (animated).

Source

pub fn set_side_visible_immediate(&self, side: DockSide, visible: bool)

Show / hide a side immediately (no animation — drag-driven).

Source

pub fn toggle_side_visible(&self, side: DockSide)

Toggle a side’s visibility (animated).

Source

pub fn select_tab(&self, side: DockSide, tab_idx: usize)

Select the active tab of a side. Repaint only (the Switcher swaps via its bound selected_tab signal — no rebuild, no relayout).

Source

pub fn select_tab_by_id(&self, side: DockSide, tab_id: DockTabId)

Select a side’s active tab by id (position-independent — used by the rail / strip, whose visible order may skip hidden tabs).

Source

pub fn set_tab_hidden(&self, tab_id: DockTabId, hidden: bool)

Hide / show one activity (tab). A hidden activity stays registered (so it remains listable + restorable) but is dropped from the rail and tab strip. Hiding the selected tab moves the selection to the nearest still- visible tab. Structural → rebuild.

Source

pub fn is_tab_hidden(&self, tab_id: DockTabId) -> bool

Whether an activity (tab) is currently hidden.

Source

pub fn side_rail_size(&self, side: DockSide) -> DockRailItemSize

Current activity-bar item size for a side.

Source

pub fn set_side_rail_size(&self, side: DockSide, size: DockRailItemSize)

Set a side’s activity-bar item size (reactive → the rail rebuilds).

Source

pub fn rail_size_mode_signal(&self, side: DockSide) -> Signal<DockRailItemSize>

Reactive activity-bar size mode for a side — fires whenever the user switches Default / Compact / Icon + Label (via the context menu or set_side_rail_size). Bind it to adapt any external widget — a rail’s slotted controls, an app toolbar — to the rail’s current item size. (The rail rebuilds its slots on every change, so a slot factory that reads this signal stays in step.)

Source

pub fn side_tab_display(&self, side: DockSide) -> DockTabDisplay

Current dock-tab display mode for a side.

Source

pub fn set_side_tab_display(&self, side: DockSide, display: DockTabDisplay)

Set a side’s dock-tab display mode (reactive → the strip rebuilds).

Source

pub fn set_corner(&self, corner: DockCorner, owner: DockSide)

Set the owner of a corner (must be one of its two adjacent sides).

Source

pub fn open_dock(&self, id: DockWidgetId, loc: DockOpenLocation)

Open (or move) a dock onto a side. Already-open docks are relocated (never duplicated).

Source

pub fn promote_to_tab(&self, id: DockWidgetId, side: DockSide, at_tab: usize)

Drag a dock out into its own new tab on side, inserted at at_tab.

Source

pub fn split_into_tab( &self, id: DockWidgetId, side: DockSide, tab_idx: usize, pane_idx: usize, before: bool, )

Drop a dock into an existing tab’s Splitter as a new Single pane, before (before = true) or after the pane at pane_idx.

Source

pub fn stack_into_tab(&self, id: DockWidgetId, side: DockSide, tab_idx: usize)

Drop a dock into a tab as a new Splitter pane appended after its existing panes (the “centre” drop — join this group without choosing a split direction). Each pane is its own single-item ToolBox.

Source

pub fn move_dock(&self, id: DockWidgetId, loc: DockOpenLocation)

Move a dock to another location (close + open in one notify).

Source

pub fn close_tab(&self, tab_id: DockTabId)

Close a whole tab (and every dock it holds).

Source

pub fn move_tab(&self, tab_id: DockTabId, target_side: DockSide, at_tab: usize)

Move a whole tab (its arrangement + every dock + selection) to another side, re-deriving the Splitter orientation. Inserted at at_tab.

Source

pub fn close_dock(&self, id: DockWidgetId)

Close (remove) a dock from the layout.

Source

pub fn toggle_dock(&self, id: DockWidgetId)

Toggle a dock: close it if open, else open it on its default location.

Source

pub fn reveal_dock(&self, id: DockWidgetId)

Reveal a dock: ensure it is open, show + select its side / tab.

Source

pub fn is_dock_open(&self, id: DockWidgetId) -> bool

Source

pub fn dock_location(&self, id: DockWidgetId) -> Option<DockLoc>

Source

pub fn dock_open_signal(&self, id: DockWidgetId) -> Signal<bool>

A reactive true-while-open signal for an external rail / toolbar.

Source

pub fn is_side_visible(&self, side: DockSide) -> bool

Source

pub fn side_visible_signal(&self, side: DockSide) -> Signal<bool>

Source

pub fn side_selected_tab_signal(&self, side: DockSide) -> Signal<usize>

Source

pub fn side_selected_tab(&self, side: DockSide) -> usize

Source

pub fn side_presentation(&self, side: DockSide) -> TabPresentation

Source

pub fn side_size(&self, side: DockSide) -> f32

Source

pub fn side_min_size(&self, side: DockSide) -> f32

Source

pub fn side_rail_thickness(&self, side: DockSide) -> f32

Source

pub fn side_has_rail(&self, side: DockSide) -> bool

Source

pub fn corner_owner(&self, corner: DockCorner) -> DockSide

Source

pub fn tab_count(&self, side: DockSide) -> usize

Source

pub fn tab_id_at(&self, side: DockSide, idx: usize) -> Option<DockTabId>

The id of the tab at idx in a side’s full tab list. The live inverse of select_tab_by_id — the strip’s index → id selection sync uses it so both directions resolve against the current order and agree across a reorder (a build-time snapshot would disagree and feed back unboundedly).

Source

pub fn set_tab_title(&self, tab_id: DockTabId, title: Option<LocalizedString>)

Give an activity (tab) a stable, explicit name, independent of which dock occupies pane 0 (e.g. a grouped “Source Control” activity holding a file tree and a git pane). Pass None to clear it (the label then derives from the primary dock again). App-config — reconstructed each run, like dock titles; not persisted. Structural → rebuild.

Source

pub fn tab_title(&self, tab_id: DockTabId) -> Option<LocalizedString>

The explicit title set on an activity (None when it derives from its primary dock).

Source

pub fn activity_of(&self, dock_id: DockWidgetId) -> Option<DockTabId>

The activity (tab) currently holding a dock — apps hold stable DockWidgetIds, so this is the bridge to address the enclosing tab.

Source

pub fn set_dock_activity_title( &self, dock_id: DockWidgetId, title: impl Into<LocalizedString>, )

Sugar: name the activity that currently holds dock_id. The natural way to title a grouped activity from app code that holds the dock id.

Source

pub fn enabled_move_targets(&self, from: DockSide) -> Vec<DockSide>

The enabled sides a tab / dock on from can be relocated to (every side except from, keeping only is_side_enabled). The “Move to” menus iterate this so a disabled side is never offered as a silently-rejected target.

Source

pub fn export_state(&self) -> DockLayoutState

Serialize the user-controllable layout state (sizes / visibility / selections / arrangement structure / corners). App-config (rail thickness, mins, content factories) is reconstructed each run.

Source

pub fn import_state(&self, state: &DockLayoutState)

Restore a previously-exported state. Unknown dock ids are dropped, emptied panes / tabs pruned, selections clamped. Bumps version.

Trait Implementations§

Source§

impl Clone for DockingModel

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DockingModel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DockingModel

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more