[][src]Struct iced_native::widget::pane_grid::PaneGrid

pub struct PaneGrid<'a, Message, Renderer: Renderer> { /* fields omitted */ }

A collection of panes distributed using either vertical or horizontal splits to completely fill the space available.

Pane grid - Iced

This distribution of space is common in tiling window managers (like awesome, i3, or even tmux).

A PaneGrid supports:

  • Vertical and horizontal splits
  • Tracking of the last active pane
  • Mouse-based resizing
  • Drag and drop to reorganize panes
  • Hotkey support
  • Configurable modifier keys
  • State API to perform actions programmatically (split, swap, resize, etc.)

Example

enum PaneState {
    SomePane,
    AnotherKindOfPane,
}

enum Message {
    PaneDragged(pane_grid::DragEvent),
    PaneResized(pane_grid::ResizeEvent),
}

let (mut state, _) = pane_grid::State::new(PaneState::SomePane);

let pane_grid =
    PaneGrid::new(&mut state, |pane, state| {
        pane_grid::Content::new(match state {
            PaneState::SomePane => Text::new("This is some pane"),
            PaneState::AnotherKindOfPane => Text::new("This is another kind of pane"),
        })
    })
    .on_drag(Message::PaneDragged)
    .on_resize(10, Message::PaneResized);

Implementations

impl<'a, Message, Renderer> PaneGrid<'a, Message, Renderer> where
    Renderer: Renderer
[src]

pub fn new<T>(
    state: &'a mut State<T>,
    view: impl Fn(Pane, &'a mut T) -> Content<'a, Message, Renderer>
) -> Self
[src]

Creates a PaneGrid with the given State and view function.

The view function will be called to display each Pane present in the State.

pub fn width(self, width: Length) -> Self[src]

Sets the width of the PaneGrid.

pub fn height(self, height: Length) -> Self[src]

Sets the height of the PaneGrid.

pub fn spacing(self, units: u16) -> Self[src]

Sets the spacing between the panes of the PaneGrid.

pub fn on_click<F>(self, f: F) -> Self where
    F: 'a + Fn(Pane) -> Message, 
[src]

Sets the message that will be produced when a Pane of the PaneGrid is clicked.

pub fn on_drag<F>(self, f: F) -> Self where
    F: 'a + Fn(DragEvent) -> Message, 
[src]

Enables the drag and drop interactions of the PaneGrid, which will use the provided function to produce messages.

pub fn on_resize<F>(self, leeway: u16, f: F) -> Self where
    F: 'a + Fn(ResizeEvent) -> Message, 
[src]

Enables the resize interactions of the PaneGrid, which will use the provided function to produce messages.

The leeway describes the amount of space around a split that can be used to grab it.

The grabbable area of a split will have a length of spacing + leeway, properly centered. In other words, a length of (spacing + leeway) / 2.0 on either side of the split line.

Trait Implementations

impl<'a, Message, Renderer> From<PaneGrid<'a, Message, Renderer>> for Element<'a, Message, Renderer> where
    Renderer: 'a + Renderer + Renderer,
    Message: 'a, 
[src]

impl<'a, Message, Renderer> Widget<Message, Renderer> for PaneGrid<'a, Message, Renderer> where
    Renderer: Renderer + Renderer
[src]

Auto Trait Implementations

impl<'a, Message, Renderer> !RefUnwindSafe for PaneGrid<'a, Message, Renderer>

impl<'a, Message, Renderer> !Send for PaneGrid<'a, Message, Renderer>

impl<'a, Message, Renderer> !Sync for PaneGrid<'a, Message, Renderer>

impl<'a, Message, Renderer> Unpin for PaneGrid<'a, Message, Renderer> where
    <Renderer as Renderer>::Style: Unpin

impl<'a, Message, Renderer> !UnwindSafe for PaneGrid<'a, Message, Renderer>

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> From<T> for T[src]

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

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<V, T> VZip<V> for T where
    V: MultiLane<T>,