iced::widget

Module pane_grid

Source
Expand description

Pane grids let your users split regions of your application and organize layout dynamically.

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

use iced::widget::{pane_grid, text};

struct State {
    panes: pane_grid::State<Pane>,
}

enum Pane {
    SomePane,
    AnotherKindOfPane,
}

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

fn view(state: &State) -> Element<'_, Message> {
    pane_grid(&state.panes, |pane, state, is_maximized| {
        pane_grid::Content::new(match state {
            Pane::SomePane => text("This is some pane"),
            Pane::AnotherKindOfPane => text("This is another kind of pane"),
        })
    })
    .on_drag(Message::PaneDragged)
    .on_resize(10, Message::PaneResized)
    .into()
}

The pane_grid example showcases how to use a PaneGrid with resizing, drag and drop, and hotkey support.

Modules§

Structs§

Enums§

Traits§

Functions§

Type Aliases§