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.

Re-exports§

pub use state::State;

Modules§

state
The state of a PaneGrid.

Structs§

Content
The content of a Pane.
Controls
The controls of a Pane.
Highlight
The appearance of a highlight of the PaneGrid.
Line
A line.
Pane
A rectangular region in a PaneGrid used to display widgets.
PaneGrid
A collection of panes distributed using either vertical or horizontal splits to completely fill the space available.
ResizeEvent
An event produced during a resize interaction of a PaneGrid.
Split
A divider that splits a region in a PaneGrid into two different panes.
Style
The appearance of a PaneGrid.
TitleBar
The title bar of a Pane.

Enums§

Axis
A fixed reference line for the measurement of coordinates.
Configuration
The arrangement of a PaneGrid.
Direction
A four cardinal direction.
DragEvent
An event produced during a drag and drop interaction of a PaneGrid.
Edge
The edges of an area.
Node
A layout node of a PaneGrid.
Region
The region of a Pane.
Target
The Target area a pane can be dropped on.

Traits§

Catalog
The theme catalog of a PaneGrid.
Draggable
A pane that can be dragged.

Functions§

default
The default style of a PaneGrid.

Type Aliases§

StyleFn
A styling function for a PaneGrid.