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
impl SplitterModel
Sourcepub fn new(n: usize, orientation: Orientation) -> Self
pub fn new(n: usize, orientation: Orientation) -> Self
n equal-share panes (each stretch = 1, min = SPLITTER_MIN_PANE_SIZE).
Sourcepub fn from_panes(panes: Vec<PaneDescriptor>, orientation: Orientation) -> Self
pub fn from_panes(panes: Vec<PaneDescriptor>, orientation: Orientation) -> Self
Build from explicit per-pane descriptors.
Sourcepub fn handle_count(&self) -> usize
pub fn handle_count(&self) -> usize
Number of distinct handles to this model (1 = unshared).
pub fn set_stored_size(&self, index: usize, size: f32)
Sourcepub fn set_stored_size_silent(&self, index: usize, size: f32)
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.
Sourcepub fn set_pair_sizes(&self, index: usize, size_a: f32, size_b: f32)
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.
pub fn set_min_size(&self, index: usize, min: f32)
pub fn set_max_size(&self, index: usize, max: Option<f32>)
pub fn set_stretch(&self, index: usize, stretch: f32)
pub fn set_collapsible(&self, index: usize, collapsible: bool)
Sourcepub fn set_collapsed(&self, index: usize, collapsed: bool)
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).
Sourcepub fn set_collapsed_immediate(&self, index: usize, collapsed: bool)
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.
Sourcepub fn toggle_collapsed(&self, index: usize)
pub fn toggle_collapsed(&self, index: usize)
Toggle pane index’s collapsed state, animated.
Sourcepub fn set_collapsed_size(&self, index: usize, px: f32)
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.
Sourcepub fn set_pane_visible(&self, index: usize, visible: bool)
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).
pub fn is_pane_visible(&self, index: usize) -> bool
Sourcepub fn consume_animate_flag(&self) -> bool
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.
Sourcepub fn insert_pane(&self, index: usize, desc: PaneDescriptor)
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).
Sourcepub fn remove_pane(&self, index: usize)
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.
Sourcepub fn replace_pane_desc(&self, index: usize, desc: PaneDescriptor)
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).
pub fn set_gutter_thickness(&self, thickness: f32)
pub fn set_snap_offset(&self, offset: f32)
pub fn set_keyboard_step_px(&self, step: f32)
pub fn set_orientation(&self, orientation: Orientation)
pub fn pane_count(&self) -> usize
pub fn stored_size(&self, index: usize) -> f32
pub fn min_size(&self, index: usize) -> f32
pub fn max_size(&self, index: usize) -> Option<f32>
pub fn stretch(&self, index: usize) -> f32
pub fn is_collapsible(&self, index: usize) -> bool
Sourcepub fn collapsed_size(&self, index: usize) -> f32
pub fn collapsed_size(&self, index: usize) -> f32
The size pane index folds to when collapsed (default 0). See
PaneDescriptor::collapsed_size.
pub fn is_collapsed(&self, index: usize) -> bool
pub fn orientation(&self) -> Orientation
pub fn gutter_thickness(&self) -> f32
pub fn snap_offset(&self) -> f32
pub fn keyboard_step_px(&self) -> f32
Sourcepub fn version(&self) -> Signal<u64>
pub fn version(&self) -> Signal<u64>
The reactive version signal. The Splitter widget binds this at
BindingLevel::Relayout.
Sourcepub fn pane_snapshots(&self) -> Vec<PaneSnapshot>
pub fn pane_snapshots(&self) -> Vec<PaneSnapshot>
Immutable per-pane snapshot for the pure sizing engine.
Sourcepub fn export_state(&self) -> SplitterState
pub fn export_state(&self) -> SplitterState
Snapshot the per-pane sizes + collapsed flags into a serializable
SplitterState.
Sourcepub fn import_state(&self, state: &SplitterState) -> bool
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
impl Clone for SplitterModel
Auto Trait Implementations§
impl !RefUnwindSafe for SplitterModel
impl !Send for SplitterModel
impl !Sync for SplitterModel
impl !UnwindSafe for SplitterModel
impl Freeze for SplitterModel
impl Unpin for SplitterModel
impl UnsafeUnpin for SplitterModel
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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