Struct iced::widget::pane_grid::State[]

pub struct State<T> { /* fields omitted */ }

The state of a PaneGrid.

It keeps track of the state of each Pane and the position of each Split.

The State needs to own any mutable contents a Pane may need. This is why this struct is generic over the type T. Values of this type are provided to the view function of PaneGrid::new for displaying each Pane.

Implementations

impl<T> State<T>

pub fn new(first_pane_state: T) -> (State<T>, Pane)

Creates a new State, initializing the first pane with the provided state.

Alongside the State, it returns the first Pane identifier.

pub fn with_configuration(config: impl Into<Configuration<T>>) -> State<T>

Creates a new State with the given Configuration.

pub fn len(&self) -> usize

Returns the total amount of panes in the State.

pub fn get(&self, pane: &Pane) -> Option<&T>

Returns the internal state of the given Pane, if it exists.

pub fn get_mut(&mut self, pane: &Pane) -> Option<&mut T>

Returns the internal state of the given Pane with mutability, if it exists.

pub fn iter(&self) -> impl Iterator<Item = (&Pane, &T)>

Returns an iterator over all the panes of the State, alongside its internal state.

pub fn iter_mut(&mut self) -> impl Iterator<Item = (&Pane, &mut T)>

Returns a mutable iterator over all the panes of the State, alongside its internal state.

pub fn layout(&self) -> &Node

Returns the layout of the State.

pub fn adjacent(&self, pane: &Pane, direction: Direction) -> Option<Pane>

Returns the adjacent Pane of another Pane in the given direction, if there is one.

pub fn split(
    &mut self,
    axis: Axis,
    pane: &Pane,
    state: T
) -> Option<(Pane, Split)>

Splits the given Pane into two in the given Axis and initializing the new Pane with the provided internal state.

pub fn swap(&mut self, a: &Pane, b: &Pane)

Swaps the position of the provided panes in the State.

If you want to swap panes on drag and drop in your PaneGrid, you will need to call this method when handling a DragEvent.

pub fn resize(&mut self, split: &Split, ratio: f32)

Resizes two panes by setting the position of the provided Split.

The ratio is a value in [0, 1], representing the exact position of a Split between two panes.

If you want to enable resize interactions in your PaneGrid, you will need to call this method when handling a ResizeEvent.

pub fn close(&mut self, pane: &Pane) -> Option<(T, Pane)>

Closes the given Pane and returns its internal state and its closest sibling, if it exists.

Trait Implementations

impl<T> Clone for State<T> where
    T: Clone

impl<T> Debug for State<T> where
    T: Debug

Auto Trait Implementations

impl<T> RefUnwindSafe for State<T> where
    T: RefUnwindSafe

impl<T> Send for State<T> where
    T: Send

impl<T> Sync for State<T> where
    T: Sync

impl<T> Unpin for State<T> where
    T: Unpin

impl<T> UnwindSafe for State<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast<T> for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Upcast<T> for T

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,