pub struct ResizableState { /* private fields */ }Expand description
Retained panel sizes and divider focus for one mounted panel group.
Sizes divide the space remaining after the actual divider thicknesses, so
they stay proportional when the application’s window changes size. Moving a
divider grows the adjacent panel and shrinks panels on the other side,
nearest first, within their constraints. To persist a layout, store
Self::sizes from ResizableEvent::Change in application storage and
restore it with Self::set_sizes.
Implementations§
Source§impl ResizableState
impl ResizableState
Sourcepub fn new(
axis: Axis,
panels: impl IntoIterator<Item = ResizablePanel>,
cx: &mut Context<'_, Self>,
) -> Self
pub fn new( axis: Axis, panels: impl IntoIterator<Item = ResizablePanel>, cx: &mut Context<'_, Self>, ) -> Self
Creates a group of at least two panels whose default sizes sum to one.
§Panics
Panics when fewer than two panels are supplied, a default size is outside its panel’s constraints, or the defaults do not sum to one.
pub fn axis(&self) -> Axis
pub fn panel_count(&self) -> usize
Sourcepub fn handle_focus(&self, index: usize) -> &FocusHandle
pub fn handle_focus(&self, index: usize) -> &FocusHandle
Focus handle for the divider following panel index.
pub fn is_disabled(&self) -> bool
Sourcepub fn is_collapsed(&self, panel: usize) -> bool
pub fn is_collapsed(&self, panel: usize) -> bool
Whether a collapsible panel is at its collapsed size.
Sourcepub fn set_sizes(
&mut self,
sizes: Vec<f32>,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_sizes( &mut self, sizes: Vec<f32>, window: &mut Window, cx: &mut Context<'_, Self>, )
Replaces the whole layout, for example from application storage. Programmatic changes remain allowed while user resizing is disabled.
§Panics
The sizes must match the panel count, satisfy each panel’s constraints, and sum to one. A layout that satisfies the fractional limits is then fitted to any pixel limits for the current size.
Sourcepub fn collapse(
&mut self,
panel: usize,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn collapse( &mut self, panel: usize, window: &mut Window, cx: &mut Context<'_, Self>, )
Collapses a collapsible panel, giving its space to its neighbors. Does nothing when the neighbors cannot absorb that space.
Sourcepub fn expand(
&mut self,
panel: usize,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn expand( &mut self, panel: usize, window: &mut Window, cx: &mut Context<'_, Self>, )
Restores a collapsed panel to its last expanded size. Does nothing when the neighbors cannot supply that space.
Sourcepub fn set_disabled(
&mut self,
disabled: bool,
window: &mut Window,
cx: &mut Context<'_, Self>,
)
pub fn set_disabled( &mut self, disabled: bool, window: &mut Window, cx: &mut Context<'_, Self>, )
Disables pointer, keyboard, and accessibility resizing, and normal Tab entry. An already focused divider retains its binding so Tab can exit.
Trait Implementations§
impl EventEmitter<ResizableEvent> for ResizableState
Auto Trait Implementations§
impl !RefUnwindSafe for ResizableState
impl !UnwindSafe for ResizableState
impl Forget for ResizableState
impl Freeze for ResizableStatewhere
*const u8 is !null: Freeze,
PhantomData<ResizablePanel>: Freeze,
PhantomData<f32>: Freeze,
NonZero<u32>: Freeze,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: Freeze,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: Freeze,
PhantomData<FocusHandle>: Freeze,
PhantomData<Bounds<Pixels>>: Freeze,
impl Move for ResizableState
impl Send for ResizableState
impl Sync for ResizableState
impl Unpin for ResizableState
impl UnsafeUnpin for ResizableStatewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<ResizablePanel>: UnsafeUnpin,
PhantomData<f32>: UnsafeUnpin,
NonZeroU32Inner: UnsafeUnpin,
*const ArcInner<RwLock<RawRwLock, FocusMap>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<RawRwLock, FocusMap>>>: UnsafeUnpin,
PhantomData<FocusHandle>: UnsafeUnpin,
PhantomData<Bounds<Pixels>>: UnsafeUnpin,
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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