nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Widgets.PaneGrid

Description

Interactive pane grid with resizable dividers, modelled on iced's PaneGrid.

The grid is a binary split tree (GridNode) persisted per widget as a Data.Dynamic value in the widget store.

Panes are rendered through the user-provided pgViewPane, which receives a PaneGridCtx with immediate-mode actions to split, close, maximize, or restore the pane. Dividers can be dragged to resize; panes can be grabbed by their pick rect and dropped onto another pane (center = swap, edge = split) or onto the grid's outer edge to restructure the whole grid at top level; arrow keys navigate between panes; mx maximizeclose and Escape restores while the grid is focused.

Synopsis

Documentation

data GridAxis Source #

Divider orientation. AxisV draws a vertical divider (panes left/right), AxisH draws a horizontal divider (panes stacked top/bottom).

Constructors

AxisV 
AxisH 

data PaneGridConfig (es :: [Effect]) Source #

Configuration for a pane grid. pgViewPane can run arbitrary widget code, so the config carries the caller's effect row.

Constructors

PaneGridConfig 

Fields

  • pgLayout :: !(Layout -> Layout)

    Layout modifier for the grid container (default id); pass fillW . fillH to fill the parent area.

  • pgSpacing :: !Float

    Gutter between panes per split level (default 4).

  • pgMinSize :: !Float

    Minimum physical size any pane may shrink to (default 40).

  • pgLeeway :: !Float

    Extra grab margin on each side of a divider, added to pgSpacing to form the divider's real layout gutter. The resize cursor and grab work anywhere in that gutter while only pgSpacing is drawn crisp, so the interaction space is far wider than the visible line (default 6).

  • pgEdgeBand :: !Float

    Thickness of the grid's outer edge that acts as a top-level drop zone (default 20). Dragging a pane into this band restructures the whole grid instead of a single pane: the tree is wrapped in a new top-level split with the dragged pane on that side.

  • pgViewPane :: !(Word64 -> PaneGridCtx es -> Eff es PaneView)

    Renders the content of one pane.

data PaneGridCtx (es :: [Effect]) Source #

Actions handed to a pane so it can mutate the grid immediately.

Constructors

PaneGridCtx 

Fields

data PaneView Source #

What a pane renders to this frame. The pane's content (including any title bar / header) is drawn entirely by the caller in pgViewPane; a header is purely optional and nothing here depends on one existing.

Constructors

PaneView 

Fields

  • pvTitle :: !Text

    Label shown (abbreviated to fit) on the compact drag indicator.

  • pvDraggable :: !Bool

    Grab the pane anywhere inside its own region to drag-and-drop it. This is the easy way to reorder panes without drawing a dedicated handle. Interactive children keep their pointer presses. Pane still needs a drag only on a sub-region? see pvDragPick.

  • pvDragPick :: !(Maybe Rect)

    Optional absolute sub-region (e.g. just a title bar; position it via pgcRect) that also starts a drag. Both handles combine: the pane drags if the press lands in this rect or (when pvDraggable) anywhere in the pane. Nothing here and pvDraggable False makes the pane immovable.

Instances

Instances details
Eq PaneView Source # 
Instance details

Defined in NanoUI.Widgets.PaneGrid

Show PaneView Source # 
Instance details

Defined in NanoUI.Widgets.PaneGrid

data PaneGridResponse Source #

Outcome of one frame of the grid. The pane list, focus, and maximize fields report the state after this pass: actions run by pane content (pgcSplit, pgcClose, ...) and the keyboard handling below take effect in these values and from the next frame's layout onward.

Constructors

PaneGridResponse 

Fields

paneGrid :: forall (es :: [Effect]). Ui :> es => PaneGridConfig es -> Eff es PaneGridResponse Source #