nano-ui
Safe HaskellNone
LanguageGHC2024

NanoUI.Store

Description

The widget store: per-widget state in maps by value type, keyed by widget id and Slot.

Synopsis

Documentation

data WidgetStore Source #

Widget state for every widget, in maps by value type. Same-type fields that share a widget key use slotKey.

Instances

Instances details
Eq WidgetStore Source # 
Instance details

Defined in NanoUI.Store

Show WidgetStore Source # 
Instance details

Defined in NanoUI.Store

data Slot Source #

Every built-in slot.

Constructors

SlotCursor 
SlotAnchor 
SlotDrag 
SlotDragW 
SlotDrop 
SlotDropPos 
SlotWinSize 
SlotMenuOpen 
SlotMenuPos 
SlotScrollCfg 
SlotScrollOff 
SlotScrollCross 
SlotScrollLinkX 
SlotScrollLinkY 
SlotScrollStep 
SlotScrollAxes 
SlotScrollViewPos 
SlotScrollViewSize 
SlotScrollRange 
SlotScrollContent 
SlotTextAreaRow 
SlotTextAreaCol 
SlotTextAreaPrefCol 
SlotTextAreaScroll 
SlotTextAreaViewport 
SlotTextAreaAnchorRow 
SlotTextAreaAnchorCol 
SlotTextAreaContentW

Cached text-area content extent (max line width, line count * line height) and the node font size they were measured at. Recomputing the width scans every character of the document, so it is cached and only refreshed when the text or font changes.

SlotTextAreaContentH 
SlotTextAreaContentFont 
SlotTextAreaBuffer

Cached TextBuffer for the text area, keyed by its flat Text. Loads and paint reuse it so the document is not re-split into lines every call.

SlotTextAreaChanged

Set (value 1) to signal that the text area's text changed through a path that does not flow through Input (e.g. a context-menu cut/paste). The text area widget reads and clears this on its next frame, so the caller still gets a respChanged pulse for edits that carry no keys or chars.

SlotTextHistory

A text field's undo history with the text it was recorded against, in storeDyn.

SlotTextMode

Which kind of text field a widget id is: 1 single-line, 2 multi-line. Commands sent to the id between frames read it.

SlotTextAreaWidths

A text area's measured line widths, in storeDyn, kept in step with its lines so an edit remeasures only the lines it changed.

SlotTextInputScroll 
SlotSearchCommitted

Search-field debounce bookkeeping. Text slots on the text widget id: the last committed query and the monotonic timestamp of the last edit.

SlotSearchAge 
SlotComboHighlight

Combo box suggestion state (storeInt/storeFloat, keyed by the field widget): the highlighted option index (absolute into the filtered list), the start of the visible window slice (keyboard wheel scrollbar scrolling), and the scrollbar bookkeeping the overlay painter and the widget's thumb-drag gesture share (total filtered count, widest row, x offset, drag axis + grab offset).

SlotComboScroll 
SlotComboCount 
SlotComboScrollX 
SlotComboContentW 
SlotComboDrag 
SlotComboDragOff 
SlotComboCommitted

The last committed value (storeText): typing edits the live field text but only Enter, a row click, or losing focus commits it (Escape reverts).

SlotComboFocus

Had-focus flag (storeInt) so the widget can see the focus-lost transition on the frame after blur and commit then.

SlotComboLive

The field text as the widget last produced it (storeText): a frame-start value that differs from it changed externally (a frame-side row pick or a clipboard menu action), not by typing.

SlotPaneGest

PaneGrid gesture slot (storeInt): 0 none, positive = dragged pane id, negative = split id being resized. Mirrors SlotDrag's press-held-release lifecycle but keyed by the grid widget instead of a per-pane leaf.

SlotPaneGrab

PaneGrid drag grab offset (storePoint): (mouse - pane origin) at grab start.

SlotPaneFocus

PaneGrid keyboard-navigation focus: focused pane id (0 = none, auto-first).

SlotPaneMax

PaneGrid maximize state: maximized pane id (0 = none).

SlotPaneResize

PaneGrid resize start (storePoint): (ratio, main-axis mouse) captured when a divider is first grabbed, so dragging moves it by delta rather than snapping.

SlotPaneNext

PaneGrid id seed (storeInt): next split / pane id to allocate. Strictly monotonic per grid: ids are never reused, so per-pane state keyed by pane id cannot collide with a closed pane's state.

SlotSeen

The value a controlled widget last returned to its caller.

SlotColorBase

A colour picker's opening colour.

SlotNumericHeld

The stepper arrow a numeric field's press holds: 1 up, -1 down.

SlotNumericRepeat

When a numeric field's held stepper arrow next repeats, in monotonic seconds.

Instances

Instances details
Enum Slot Source # 
Instance details

Defined in NanoUI.Store

Methods

succ :: Slot -> Slot #

pred :: Slot -> Slot #

toEnum :: Int -> Slot #

fromEnum :: Slot -> Int #

enumFrom :: Slot -> [Slot] #

enumFromThen :: Slot -> Slot -> [Slot] #

enumFromTo :: Slot -> Slot -> [Slot] #

enumFromThenTo :: Slot -> Slot -> Slot -> [Slot] #

ptrEq :: a -> a -> Bool Source #

Physical-equality shortcut. Pointer equality implies value equality for immutable values, so callers may use True to skip a structural comparison of a field the caller never rebuilt. False only means "compare properly".

eqByPtr :: Eq a => a -> a -> Bool Source #

== with a physical-equality fast path. Unchanged fields of a record-updated store keep their identity, so whole-store comparisons become cheap when only one map was rebuilt.