Skip to main content

SplitterModel

Struct SplitterModel 

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

A shared, cloneable handle to a splitter’s layout state. Clone = share-by-handle (cheap Rc bump).

Implementations§

Source§

impl SplitterModel

Source

pub fn new(n: usize, orientation: Orientation) -> Self

n equal-share panes (each stretch = 1, min = SPLITTER_MIN_PANE_SIZE).

Source

pub fn from_panes(panes: Vec<PaneDescriptor>, orientation: Orientation) -> Self

Build from explicit per-pane descriptors.

Source

pub fn handle_count(&self) -> usize

Number of distinct handles to this model (1 = unshared).

Source

pub fn set_stored_size(&self, index: usize, size: f32)

Source

pub fn set_stored_size_silent(&self, index: usize, size: f32)

Like set_stored_size but without a version bump — for writes made from inside a layout/effect pass that is already relaying out (e.g. capturing the displayed size as the collapse reference), where a bump would re-enter the effect.

Source

pub fn set_pair_sizes(&self, index: usize, size_a: f32, size_b: f32)

Set both sides of handle index (panes index and index+1) in one mutation — a single version bump, so a drag produces exactly one relayout per move.

Source

pub fn set_min_size(&self, index: usize, min: f32)

Source

pub fn set_max_size(&self, index: usize, max: Option<f32>)

Source

pub fn set_stretch(&self, index: usize, stretch: f32)

Source

pub fn set_collapsible(&self, index: usize, collapsible: bool)

Source

pub fn set_collapsed(&self, index: usize, collapsed: bool)

Programmatically collapse/expand pane index, animated. Ignores the collapsible flag (that flag only gates interactive triggers).

Source

pub fn set_collapsed_immediate(&self, index: usize, collapsed: bool)

Collapse/expand pane index instantly (no tween). Used by the drag handlers — the pointer is already the motion.

Source

pub fn toggle_collapsed(&self, index: usize)

Toggle pane index’s collapsed state, animated.

Source

pub fn set_collapsed_size(&self, index: usize, px: f32)

Set the size pane index folds down to when collapsed (default 0). See PaneDescriptor::collapsed_size. No version bump on its own — it only affects the next collapse.

Source

pub fn set_pane_visible(&self, index: usize, visible: bool)

Show or hide pane index (animated). A hidden pane removes both the pane and an adjacent gutter from the layout — it reads as absent, unlike a collapsed pane (which keeps its grabbable gutter). The pane must be pre-mounted in the Splitter; this is the reactive “add / remove a pane from a fixed set” trick (no rebuild).

Source

pub fn is_pane_visible(&self, index: usize) -> bool

Source

pub fn consume_animate_flag(&self) -> bool

Read-and-reset the “animate the next collapse change?” latch. The widget’s collapse effect calls this once per version bump; it resets to true so the default (programmatic) path animates.

Source

pub fn insert_pane(&self, index: usize, desc: PaneDescriptor)

Insert a pane at index (clamped to [0, len]). A None initial_size takes the average of the existing panes’ sizes; the next layout rebalances. The app must rebuild the Splitter widget to supply the new pane’s content (retained-mode: changing a container’s child set is a rebuild; the model keeps the persistent size/collapse state across it).

Source

pub fn remove_pane(&self, index: usize)

Remove the pane at index (no-op if out of range). The app must rebuild the Splitter widget to drop the corresponding content.

Source

pub fn replace_pane_desc(&self, index: usize, desc: PaneDescriptor)

Replace the metadata of pane index (keeps its current size unless the descriptor specifies one).

Source

pub fn set_gutter_thickness(&self, thickness: f32)

Source

pub fn set_snap_offset(&self, offset: f32)

Source

pub fn set_keyboard_step_px(&self, step: f32)

Source

pub fn set_orientation(&self, orientation: Orientation)

Source

pub fn pane_count(&self) -> usize

Source

pub fn stored_size(&self, index: usize) -> f32

Source

pub fn min_size(&self, index: usize) -> f32

Source

pub fn max_size(&self, index: usize) -> Option<f32>

Source

pub fn stretch(&self, index: usize) -> f32

Source

pub fn is_collapsible(&self, index: usize) -> bool

Source

pub fn collapsed_size(&self, index: usize) -> f32

The size pane index folds to when collapsed (default 0). See PaneDescriptor::collapsed_size.

Source

pub fn is_collapsed(&self, index: usize) -> bool

Source

pub fn orientation(&self) -> Orientation

Source

pub fn gutter_thickness(&self) -> f32

Source

pub fn snap_offset(&self) -> f32

Source

pub fn keyboard_step_px(&self) -> f32

Source

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

The reactive version signal. The Splitter widget binds this at BindingLevel::Relayout.

Source

pub fn pane_snapshots(&self) -> Vec<PaneSnapshot>

Immutable per-pane snapshot for the pure sizing engine.

Source

pub fn export_state(&self) -> SplitterState

Snapshot the per-pane sizes + collapsed flags into a serializable SplitterState.

Source

pub fn import_state(&self, state: &SplitterState) -> bool

Restore sizes + collapsed flags from a SplitterState. Returns false (and changes nothing) if the pane count doesn’t match — the structural config must be reconstructed first. Restoration is instant (collapsed panes don’t animate open on load).

Trait Implementations§

Source§

impl Clone for SplitterModel

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 SplitterModel

Source§

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

Formats the value using the given formatter. 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> 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