[][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:

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, focus| {
        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, Option<Focus>) -> 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 modifier_keys(self, modifier_keys: ModifiersState) -> Self[src]

Sets the modifier keys of the PaneGrid.

The modifier keys will need to be pressed to trigger key events.

The default modifier key is Ctrl.

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.

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

Captures hotkey interactions with the PaneGrid, using the provided function to produce messages.

The function will be called when:

  • a Pane is focused
  • a key is pressed
  • all the modifier keys are pressed

If the function returns None, the key press event will be discarded without producing any message.

This method is particularly useful to implement hotkey interactions. For instance, you can use it to enable splitting, swapping, or resizing panes by pressing combinations of keys.

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<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

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, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[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>,