GGUI namespace

Namespaces

namespace FieldTypes
Types with built-in editors (EditorRegistry::AddDefaults).
namespace GGDock
Builders for describing a layout in code.
namespace GGGraphKeys
The graph's keys, rebindable.
namespace GGKeys
The keys, by name: letters, digits (D0 to D9), the function keys, editing and arrow keys, and the number pad (Num0 to Num9, NumEnter...).
namespace GGNav
The UI's own keys as rebindable actions, e.g. ui.KeyBinding(GGNav::Accept).
namespace Hints
Hints read by the built-in editors.
namespace ItemViews
Lists, trees, and tiles as they are, for tools and tests. Each takes the node ui.List, ui.Tree, or ui.Tiles returned.
namespace KeptBlocks
KeptBlocks: pooled memory for things a document stores on an author's behalf (handler and component captures, ui.State values) when they don't fit inline.
namespace LogViews
Log views as they are, for tools and tests. Each takes the node ui.LogView returned.
namespace PropertyGrids
Property grids as they are, for tools and tests. Each takes the node ui.Properties returned.
namespace Splits
Splits as they are, for tools and tests.
namespace StyleKeywords
namespace Tables
Tables as they are, for tools and tests. Each takes the node ui.Table returned.
namespace TextFields
Text widgets as they are, for tools, tests, and other widgets.

Classes

struct AccessInfo
Per-node accessibility data.
struct AccessProps
ui.Accessible: overrides for the element being built.
struct AskProps
Properties of ui.Ask: a dialog with a message and one button per choice.
struct AtlasPage
One page of rendered glyphs: one byte per pixel, how much of the pixel the glyph covers.
struct BigAtLeast
1 if Left >= Right, else 0.
struct BigField
BigField: a field holding a BigNumber.
struct BigRatio
Numerator / Denominator, clamped to 0..1.
struct BindingReader
How bindings read data. Supplied by the integration layer per update.
struct BindingStats
What one UpdateBindings call did.
struct BoxProps
Properties of a container: ui.Row, ui.Column, ui.Stack.
struct BuildStats
What a build changed. A no-op build leaves everything but Reused at zero.
struct ButtonProps
Properties of ui.Button.
struct CanvasProps
Properties of ui.Canvas.
struct CarouselProps
Properties of ui.Carousel: one option shown, with arrows to the others.
struct CellValue
One cell. Text is only valid until the next call into the source.
class ChildrenRef
ChildrenRef: container content built immediately.
struct ChoiceProps
Properties of ui.Choice: every option shown, one chosen.
struct ColorProps
ui.Color: a swatch that opens a colour picker.
struct ColumnInfo
A column of a data source.
struct CommandEvent
A command running (ui.Command).
struct CommandLineProps
Properties of ui.CommandLine.
template<typename T>
struct CommitOnly
OnCommit([](float value) { ... }): only the final value.
class CompletionVisitor
Non-owning callable (name, argument hint). Called during the call it is passed to, never stored.
class ComponentFn
ComponentFn: the function a component re-runs.
struct DialogProps
Properties of ui.Dialog: a modal dialog, centred in the window. Nothing behind it takes input until it closes.
struct DispatchStats
What one UIContext::Dispatch did.
struct DockProps
Properties of ui.Dock.
struct DocumentProps
ui.Document props: the screen the document inside is laid out on.
struct DragBridge
Lets a host route a drag between documents (windows). Called from the source document while it handles input.
struct DragSourceProps
Properties of ui.DragSource.
struct DropdownProps
Properties of ui.Dropdown: the chosen option, and a menu of the others.
struct DropEvent
A drag over, or dropped on, a target.
template<typename T>
class DropOverFn
A drop target's hover callback: [=](const T& value, const DropEvent& at) { ... }.
template<typename T>
struct DropTargetProps
Properties of ui.DropTarget for values of type T.
template<typename T>
struct Editable
A value bundled with how to write it. Return one from a helper when there is one correct way to change something (a reflected field, a setting).
class EditorRegistry
EditorRegistry: maps field types to editor widgets.
struct EmbedProps
ui.Embed: an area something else draws and takes the pointer in (another UI library, a native view). The document draws nothing there and publishes where it is (GGSnapshot::Embeds).
struct FieldInfo
One field of a type. The strings are only valid during the visit.
struct FieldSource
An object with fields to show: how to enumerate them, read them, and report edits.
class FieldVisitor
Non-owning callable taking a FieldInfo. Called during the call it is passed to, never stored.
struct FileDialogProps
What a file dialog asks for.
struct FileFilter
A file type offered by a dialog. Extensions are separated by ; ("png;jpg").
struct FileRequest
A dialog request as handed to the platform backend.
struct FontStyle
Which font, and how big.
class GGActionMap
GGActionMap: registered actions and their current chords.
class GGBinding
GGBinding: an expression (or a lambda) plus the target it reads from.
class GGCanvas
What a canvas's drawing function draws with.
struct GGCaptured
GGCaptured: out-of-line storage for a handler's or component function's captures.
class GGCapturedRef
Ref-counted pointer to a GGCaptured.
template<typename T, const std::string_view* Words, size_t Count>
struct GGChoiceTraits
An enum written as one of its words, by value.
struct GGChord
A key plus modifiers (UIMods).
struct GGClassInfo
A widget class: the code behind a widget asset that names it ("class": "PlayerHud").
struct GGClassResolver
Finds widget classes by name. Set by the host. Without one, an asset naming a class is reported.
struct GGClip
Tracks played together over a length of time, and what it does at times along it.
struct GGColor
sRGB, straight alpha.
struct GGColumns
Grid columns: a count of equal columns (.Columns = 8), or a size per column (.Columns = { GGSize::Fixed(120), GGSize::Grow() }). Fit sizes a column to its widest cell.
struct GGCommandChecker
Checks a command action against the commands the host knows: false, with why, for a command it hasn't got or a field the command hasn't. Set by the host.
struct GGCommandSource
Command completion and execution. Called during the UI update.
struct GGContextInfo
A context an asset declares: its name, and what it is (an entity type, a component, a view model).
struct GGContextResolver
Resolves the fields contexts read. Set by the host (the engine resolves against reflection).
struct GGContextValue
Game state given to an asset: what its formulas read Ctx.Component.Field from.
struct GGCurve
A curve asset (.tnxcurve): a motion over time that a track plays in place of its own keys, scaled and stretched where it is used. Its keys are in time order, their tangents worked out.
struct GGDataSource
Items, how they relate, and what each shows. Implemented by the integration layer, one per relation.
struct GGDockDrag
Drag payload for a panel's tab. Public so the host can route it between windows.
struct GGDockLayout
A layout: one root node per window. Windows[0] is the main window.
struct GGDockNode
One node of a layout description: a tab group, or a split of child nodes.
class GGDockSpace
GGDockSpace: the registered panels and their current layout, across all dock windows.
class GGDocument
The document inside a ui.Document, kept by whoever shows it. Used on the parent's UI update thread only. Not shown, it keeps what it built; destroyed, it leaves the parent.
template<typename T>
class GGDoes
The second argument of a value widget: what an edit does.
struct GGEdges
Per-side spacing, e.g. padding.
template<typename T>
struct GGEdits
Handlers for every phase of an edit. Each takes the value, or nothing.
class GGExpr
GGExpr: a value computed from fields and constants.
struct GGFieldHint
A hint attached to a field, with its value.
template<typename T>
struct GGFieldTraits
How a type is a property. Defined for each type a property can have; not otherwise, so a field of a type with no traits doesn't compile when its widget is registered.
class GGFileHandle
What ui.Files() returns. Capture it in handlers.
class GGFiles
GGFiles: the platform file dialog, requested now and answered later. Thread-safe.
struct GGFont
A font by the name the font loader registered: .Font = FontNamed("mono").
struct GGGraphLink
A wire: from an Out pin to an In pin.
struct GGGraphView
Where a graph is looking and what is selected. Owned by the graph's owner, which keeps it for as long as the graph is shown, and written by the graph.
class GGHandler
GGHandler: an event handler stored on a node.
template<typename T>
struct GGHint
A hint of value type T: a number type, bool, or std::string_view. Declared as a constant; its address is its identity.
struct GGHintInfo
Type-erased part of a hint. Identity is the address of the constant.
struct GGInputAction
Something a key or gamepad button does: its name, title, and default bindings. Declared as a constant; the strings must outlive every use.
struct GGInputDevice
What the player is using: prompts show its keys or buttons.
struct GGInputInfo
An input an asset declares: its name and what it takes.
class GGInputValue
A value given to one of an asset's inputs, or one of its literals.
struct GGItemFeed
The items a list shows, kept by whoever makes them.
struct GGItemQuery
Where a list's items come from, as its asset says.
struct GGItemSources
Finds the items for a query. Set by the host. Null, with why, for a source it hasn't got. A feed returned stays valid while the host lives.
class GGKeptText
A GGText kept past the call it was given in (a dialog's question, built later): its format and arguments copied. Text() is valid while it lives.
struct GGKeyframe
A value at a time. Ease shapes the way into it from the key before.
struct GGLine
One log line. The strings are valid until the next call into the source.
struct GGLineSource
Lines to show, oldest first. Indices are stable: a dropped line's index is never reused.
struct GGListItem
One item of a list: its key, which selection and focus follow, and what the item's widget reads as Item.
struct GGLiveToken
A token that follows game data: the binding's number, or for a choice IfTrue while the binding is non-zero and IfFalse otherwise (a token written "=select(Player.CHealth.Low, '@danger', '@ok')").
class GGLooks
GGLooks: a per-document cache of resolved styles.
struct GGMemberInputs
What a widget member of a class gives the element built as it: its contexts and inputs, and those of its own widget members.
class GGNoticeHandle
What ui.Notices() returns. Capture it in handlers.
class GGNotices
GGNotices: the notices currently showing. Thread-safe.
template<typename T>
struct GGNumberTraits
The traits of a number type.
struct GGPanel
A dockable panel. Declare as a constant; the strings must outlive every use.
struct GGPictureLook
How an image or a progress bar is drawn beyond its basics. Kept with the node's image input and carried into the snapshot; the fields marked bindable follow GGProperty bindings.
struct GGPoint
A point on a canvas, in UI units from its top left.
class GGPropertyFn
Custom value cell: [=](UI& ui, const FieldInfo& field) { ... }.
struct GGRect
A node's rect in document space, in UI units, pixel-snapped.
struct GGReferenceResolver
Finds an asset's current name from its persistent ID, so a file that references assets by ID ({ "guid": "...", "name": "StatBar" }) keeps working when they are renamed. Set by the host.
struct GGRegionInfo
A region of an asset: an element the host adds widgets to ("region": true).
class GGRevision
GGRevision: a change counter the UI can watch.
struct GGSheetError
A style sheet parse error.
template<typename T>
class GGShows
The first argument of a value widget: what it shows.
struct GGSize
Size along one axis. A bare number is a fixed size (.Width = 84); otherwise GGSize::Grow() etc., or the short names in GGUI::StyleKeywords.
struct GGSlotFill
Content for a slot of a used asset: { "Content", [=](UI& ui) { ... } }.
class GGSnapshot
A document as other threads see it. See the file description.
struct GGSort
Sort order for a list's items, or for a tree's items under each parent.
template<typename T>
class GGState
GGState<T>: a value that lives with an element and survives re-runs.
class GGStringTable
One language. Not thread-safe: fill it before use, and change a table that is in use only on the thread that updates its documents.
struct GGStroke
How a line is drawn.
struct GGStyle
A rule's properties. Only the ones it sets apply (see UIStyle.h).
struct GGStyleOrigin
One resolved property and the rule it came from. For tools.
struct GGStyleScope
Rules and tokens that reach only the elements carrying a scope class: a widget asset's styles, the tokens a use gives it, or tokens set in code (ui.Tokens).
class GGStyleScopes
A set of style scopes, found by class. Touch it when a scope's sheet changes in place.
template<typename T>
struct GGStyleValue
One rule property: unset, a literal value, or a token.
struct GGTableColumn
A column a table shows.
class GGText
Text passed to a widget: a key to look up (what strings convert to), a format with values, or verbatim data. Only valid for the duration of the call.
struct GGTextArg
A value for a named placeholder: an integer, a real, text, or a bound number.
struct GGToken
A named style value (colour, length, number). Rules reference tokens; a theme defines them.
struct GGTokenInfo
A token's current value. For tools.
struct GGTokenSet
A token given a value for everything one element builds (ui.Tokens, UseProps::Tokens): { "bar-fill", GGColor::Hex(0x4C8DFFFF) }, { "bar-radius", 3.0f }, or another token's value, GGTokenSet::Alias("bar-fill", "danger").
struct GGTrack
One property of one element over time: keys, or a curve.
struct GGTransform
A group transform: an element and everything in it drawn scaled, then skewed, then turned, about a point, with nothing laid out again.
struct GGTransitions
Per-property transition durations for a rule:
struct GGValue
A typed value handed to code outside the UI (FieldSource::SetValue).
template<NumberType T>
class GGVectorDoes
What a ui.Vector's edit does: a lambda taking the component's index and new value.
struct GGVersion
A version of GG-UI.
struct GGWidgetAction
An element was used: a button clicked, something dropped. The host decides what it does.
struct GGWidgetField
One property a widget type takes: a reflected field of its props, or an argument of its call (a Label's text, a Progress's value).
class GGWidgetFile
A widget asset's JSON and the tree of elements read out of it.
struct GGWidgetInput
What a use gives an asset: { { "Value", binding }, { "Max", 100.0f } }.
class GGWidgetLibrary
Named widget assets, loaded from file text. Hot reload is loading a file again.
struct GGWidgetProblem
Something wrong with an asset or a use of one.
class GGWidgetRegistry
Every element type widget assets can use, and the properties each takes.
struct GGWidgetType
A type of element: a built-in one, or a code widget.
struct GlyphQuad
One glyph to draw: where it goes, and where it is in the atlas.
struct GlyphSource
Where paint gets the glyphs of shaped text. The text engine supplies one.
class GlyphVisitor
Non-owning callable taking a glyph quad. Called during the call it is passed to, never stored.
struct GraphConnectEvent
New wires. Replaces: wires picked up with Ctrl+drag, which these take the place of.
struct GraphLinkProps
Properties of ui.GraphLink.
struct GraphLinksEvent
Wires cut.
struct GraphMoveEvent
The selection was dragged by DX, DY graph units. Reported once, at release.
struct GraphNodeProps
Properties of ui.GraphNode.
struct GraphNodesEvent
Nodes to delete, duplicate or copy.
struct GraphPointEvent
A paste, at a graph point.
struct GraphProps
Properties of ui.Graph: what its gestures report, and how it looks.
struct GridProps
ui.Grid props. Children fill it row by row.
template<typename TEvent>
class HandlerOf
A handler of events of type TEvent: a lambda taking the event, or nothing.
struct ImageInfo
What an image is: its texture, its region within it, and its size.
struct ImageProps
Image and viewport props.
struct ImageSource
Issues and describes images. Set on a document by the host.
struct InputEvent
One input, in document space (UI units, origin top left).
struct ItemMove
Rows a view reports moved (its OnMove).
class ItemMoveFn
Row-move callback: [=](std::span<const ItemID> items, ItemID onto, GGDropPlace place) { ... }.
class ItemSet
ItemSet: a set of items owned by the caller, used for selection and expansion.
class ItemVisitor
Non-owning callable taking an ItemID. Called during the call it is passed to, never stored.
struct KeyBindingProps
Properties of ui.KeyBinding, which shows an action's chord and rebinds it.
struct KeyEvent
A key, as a key handler hears it.
class KeyRouter
KeyRouter: is this key the UI's or the game's?
struct LayoutInput
Layout inputs stored per node (what BoxProps becomes).
template<typename T>
class LayoutSolver
struct LayoutStats
What one UpdateLayout call did.
struct ListProps
Properties of ui.List.
struct LogViewProps
Properties of ui.LogView.
struct MenuItemProps
Properties of ui.MenuItem.
class MutationQueue
Changes to a node tree requested from any thread, applied by the UI update. See the file description.
template<typename T>
class NodeChain
NodeChain<T>: a short list of values per node.
struct NodeChunk
64 nodes, structure-of-arrays. One bit per slot in each mask. Defined in the header so node lookups inline.
struct NodeHandle
A node, as everything outside the storage holds it: its slot and the generation of the slot, so a stale handle is told apart from whatever reused the slot.
template<typename T>
class NodeRows
One value per node, in chunks aligned with NodeStorage's.
template<typename T>
class NodeSparse
NodeSparse<T>: a value for the few nodes that have one.
class NodeStorage
The nodes of one document, and how they are joined. See the file description.
struct NodeStorageListener
Notified of every tree change, whoever makes it. Anything keeping per-node rows beside the storage listens here to reset them.
struct NoticeProps
How a notice is shown.
struct NumberFormat
How a bound number is shown as text.
struct NumberProps
ui.Number: a numeric field that can be typed or dragged.
struct PaintDelta
What changed between one snapshot's primitives and the next, so a consumer keeping a copy (a GPU buffer) can update it incrementally.
struct PaintInput
Per-node paint inputs, beyond the rect.
struct PaintLayer
Another document's primitives drawn over this one at (X, Y): a popup layer.
struct PaintNested
A document drawn inside a node of this one (ui.Document): its primitives are the node's, at Box corner + (X, Y) + Zoom * position, under clips made from its own within the node's.
struct PaintState
PaintState: slot bookkeeping carried from one paint of a document to the next.
struct PaintStats
What one paint did.
struct PaintStyle
The resolved appearance of a style class. Layout props are not here; they are the builder's.
struct PanelProps
How a panel behaves.
struct PickerProps
ui.Picker: a button showing the chosen item's name that opens a searchable list of the source's items. Also accepts a row dragged from a list.
struct PinProps
Properties of ui.Pin.
struct PlaceProps
ui.Place props: an overlay on a box's content. Takes no space among its siblings. Drawn in build order like them, so one built after the content is in front; Layer overrides that.
struct PointerEvent
A pointer event, as a handler hears it.
class PointerRouter
PointerRouter: does the UI take this input, or does the game?
struct PopupProps
Properties of a popup: where it goes by what it belongs to.
struct PrimitiveRange
A run of primitive slots (GGSnapshot::Primitives).
struct ProgressProps
Properties of ui.Progress.
struct PropertiesProps
Properties of ui.Properties: a property grid, a FieldSource's fields as a two-column table of name and editor.
struct ReferenceImage
An image the reference rasterizer drew.
struct ReferenceTextures
Texture access for the rasterizer: the glyph atlas and the texture table.
struct RichTextProps
Properties of ui.RichText: how the text is laid out, as TextProps, and what clicking one of its links does.
class Scope
An open container. Closes on destruction.
struct SearchFieldProps
Properties of ui.SearchField: one line with a clear button.
template<typename T, uint32_t PerChunk>
class SharedChunks
SharedChunks: an indexed array in ref-counted chunks shared between consecutive snapshots.
class ShowsText
What a text widget shows: plain text or a TextBuffer.
struct SliderProps
Properties of ui.Slider.
class SnapshotChain
SnapshotChain: the latest snapshot, published by one thread and read by others.
struct SnapshotEmbed
A ui.Embed area as shown: on screen, clipped, in UI units.
struct SnapshotImage
What an image or viewport node shows.
struct SnapshotMark
An overlay drawn on a text widget.
struct SnapshotNode
One node as a snapshot holds it.
class SnapshotOrder
Draw order: slots of GGSnapshot::Primitives, back to front. Shared between snapshots while the set of visible things and their order doesn't change.
class SnapshotRead
A read lock on a snapshot: it can't change or be reused while this exists.
class SnapshotRows
A snapshot's node rows. Copying copies every row; the snapshot being written shares with the previous one instead (ShareFrom).
struct SnapshotRun
Where a node's primitives are: a range of GGSnapshot::Primitives slots it owns for as long as it is visible, plus the clips it and its children draw under.
struct SnapshotScroll
A scrolling box's offset and content size. Scroll bars are drawn from this.
struct SnapshotSpace
Scroll offset of a scrolling box (SnapSpace), in whole pixels so pixel-snapped content stays snapped.
struct SnapshotSpan
One span of rich text as drawn: its class (text colour, background), or the image in its box.
struct SnapshotToolMark
A debug overlay drawn by a tool: an outline or a tint.
struct SplitProps
Properties of ui.Split: two panes and a divider between them.
class StyleTable
StyleTable: tokens and layered rules.
struct SwatchProps
ui.Swatch: a box whose colour is data rather than style (a user-picked colour, a team colour). With bGradient it runs from the colour to To.
struct TableProps
TableProps: a source's items as rows, with columns under a header.
struct TabProps
Properties of one ui.Tab.
struct TabsProps
Properties of ui.Tabs.
class TemplateEntity
TemplateEntity: a placeholder for "the entity this instance is drawn for".
struct TemplateError
A call a template can't support.
struct TextAnchor
Handle to an anchor. Only valid with the buffer that created it.
struct TextAreaProps
Properties of ui.TextArea: several lines of text, scrolling when they don't fit.
class TextBuffer
Editable UTF-8 text with anchors, undo, and a line index. See the file description.
struct TextChange
Lines affected by a transaction: LinesBefore lines from FirstLine became LinesAfter.
struct TextEdit
Replace [Start, End) with Text. Start == End inserts; empty Text deletes.
struct TextEditRules
What edits a TextEditState allows.
class TextEditState
A caret and selection over a TextBuffer, and the edits made at them. See the file description.
class TextEngine
Fonts, shaping, and the glyph atlas, behind the UI core's text interfaces. See the file description.
struct TextFieldProps
Properties of ui.TextField: one line of editable text.
struct TextInputEvent
Text delivered to the focused widget.
struct TextMeasurer
Text measurement backend. MeasureFixedMetric is used until one is set.
struct TextMetrics
How big measured text is.
struct TextPiece
Where part of a span was put: one per line it is on. Relative to the text's top left, UI units; as high as a line of its font, and as wide as its glyphs and padding, or its box.
struct TextProps
Properties of ui.Label.
struct TextRequest
Text to measure: what it says and how it is set.
struct TextSpan
Part of a paragraph styled apart from the rest, or an inline box: what rich text is made of.
struct TilesProps
TilesProps: a source's items as a grid of equal-sized tiles (ui.Tiles). For asset browsers.
struct ToggleProps
Properties of ui.Toggle.
struct ToolbarProps
Properties of ui.Toolbar.
struct ToolButtonProps
Properties of ui.ToolButton.
struct TreeProps
Properties of ui.Tree.
class UI
The builder a widget function is handed. See the file description.
struct UIClip
One clip table entry: a document-space rect plus an offset applied to everything drawn under it.
class UIContext
One UI document: the tree and everything stored per node. See the file description.
struct UIPrimitive
UIPrimitive: one instanced quad. 48 bytes; the layout is shared with the shaders.
struct UseProps
Properties of a ui.Use: which asset, its inputs and contexts, and what fills its slots and regions (a fill named after a region is built inside it, after its own children).
struct ValueBits
Type-erased value storage. Only the matching ValueService reads it.
struct ValueOps
Per-type operations, as the core calls them.
template<ValueType T>
struct ValueService
The arithmetic for T: its ops table, and its values in and out of ValueBits. Specialised for each ValueType in ValueService.cpp.
template<NumberType T>
struct VectorChange
Vector edit callback: [](int axis, float value) { ... }, value in the components' type.
struct VectorProps
ui.Vector: labelled numeric fields side by side (position, size, rotation).
struct ViewportSize
A viewport's size after layout, in physical pixels. The renderer sizes its target to match.
struct WidgetDef
The core's view of a widget kind: state size, construct/destruct, and one function pointer per hook the struct has. Generated by WidgetDefOf<T>; never written by hand.
template<typename T>
class WidgetHost
What a widget's hooks are given: its node, its typed state, and the document services it may use.
class WidgetHostBase
The document API available to every widget. WidgetHost<T> adds the typed state.
template<typename T>
class WidgetScope
WidgetScope<T>: a widget's node while it is being built, plus its state.

Enums

enum class GGProperty: uint8_t { Opacity, Fill, OffsetX, OffsetY, Visible, ScrollX, ScrollY, Value, Greyscale, Segments, TrailDelay, TrailTime, Token0, Token1, Token2, Token3, Token4, Token5, Token6, Token7, Region0, Region1, Region2, Region3, ScaleX, ScaleY, Rotation, Width, Height, Gap, Present, Text, Arg0, Arg1, Arg2, Arg3, Count }
Bindable properties, grouped by what a change costs.
enum class PropertyClass: uint8_t { Paint, Layout }
What a property's change costs.
enum class NumberNotation: uint8_t { Decimal, Suffix, Scientific }
How a number is written.
enum class GGSelect: uint8_t { One, Many }
How many rows can be selected.
enum class GGEditPhase: uint8_t { Begin, Change, Commit, Cancel }
Phase of an edit reported to a source. Same phases as every value widget.
enum class LayoutNumeric: uint8_t { Float, Fixed }
The numbers a document's layout is computed in (UIContext::SetLayoutNumeric).
enum StyledSpace: uint8_t { SpacePadding = 1 << 0, SpaceGap = 1 << 1, SpaceMinWidth = 1 << 2, SpaceMinHeight = 1 << 3, SpaceWidth = 1 << 4, SpaceHeight = 1 << 5, SpaceAlign = 1 << 6, SpaceJustify = 1 << 7 }
Spacing and layout properties a style can supply.
enum class PrimitiveKind: uint8_t { Solid, Glyph, GlyphDistance, Image, Shadow, Line, Triangle, Arc }
What a primitive draws.
enum PrimitiveFlags: uint16_t { PrimitiveGradient = 1 << 0, PrimitiveDilate = 1 << 1 }
How a primitive draws, beyond its kind (UIPrimitive::Flags).
enum SnapshotFlags: uint8_t { SnapVisible = 1 << 0, SnapClips = 1 << 1, SnapClickable = 1 << 2, SnapShown = 1 << 3, SnapBlocks = 1 << 4, SnapScrolls = 1 << 5, SnapFocusable = 1 << 6, SnapSpace = 1 << 7 }
What a row is (SnapshotNode::Flags).
enum SnapshotMore: uint8_t { SnapTransform = 1 << 0 }
More of a row's flags (SnapshotNode::More).
enum SnapshotRunFlags: uint8_t { RunShown = 1 << 0, RunOwnsClip = 1 << 1, RunOwnsSelf = 1 << 2 }
A node's primitive run's flags (SnapshotRun::Flags).
enum class TextMarkKind: uint8_t { Selection, Caret, Underline, Highlight }
Overlays drawn on a text widget: selection, caret, IME underline.
enum class AnchorBias: uint8_t { Before, After }
Which side an anchor ends up on when text is inserted exactly at it, or when the text around it is replaced.
enum class TextEditKind: uint8_t { Other, Typing, DeleteBack, DeleteForward }
How a transaction merges with the previous one in undo history.
enum class TextMove: uint8_t { Left, Right, WordLeft, WordRight, LineStart, LineEnd, DocumentStart, DocumentEnd, Up, Down }
Where a caret move goes.
enum class TextAccepts: uint8_t { Any, Digits, Number }
Input filter.
enum class GGSlot: uint8_t { Primary, Alternate }
An action has two chords: a primary, shown in menus and tooltips, and an alternate. Either runs it.
enum class GGAnimated: uint8_t { Opacity, OffsetX, OffsetY, Scale, ScaleX, ScaleY, Rotation, SkewX, SkewY, Fill, Accent, Color, Border, Radius, Count }
What a track animates.
enum class GGTrigger: uint8_t { Rises, Falls, Changes, Enters, Leaves }
What starts or stops a clip by itself (UIContext::DeclareTrigger).
enum NodeDirty: uint8_t { DirtyLayout = 1 << 0, DirtyPaint = 1 << 1 }
What about a node needs redoing.
enum class GGDockSide: uint8_t { Center, Left, Right, Top, Bottom }
Where a panel lands in a tab group: Center joins the tabs, a side splits the group. By pointer, Center is a drop on the tab strip; a drop on the middle of a panel floats the tab.
enum class GGDropPlace: uint8_t { Before, After, Inside }
Where a moved row goes, by the row it is dropped on.
enum class PointerButton: uint8_t { None = 0, Left = 1, Middle = 2, Right = 3 }
Numbered as the platform numbers them.
enum class InputKind: uint8_t { PointerMove, PointerDown, PointerUp, PointerLeave, Wheel, KeyDown, KeyUp, Text, Compose, Paste }
What an input is.
enum class UIKey: uint8_t { None, Tab, Enter, Space, Escape, Left, Right, Up, Down, Home, End, PageUp, PageDown, Backspace, Delete, A, C, V, X, Y, Z, Count }
Keys the UI gives its own meaning to. The host maps platform keys and gamepad buttons onto these: d-pad = arrows, accept = Enter, cancel = Escape.
enum UIMods: uint16_t { ModShift = 1 << 0, ModControl = 1 << 1, ModAlt = 1 << 2 }
Modifier bits (InputEvent::Mods, PointerEvent::Mods), for keys and the pointer alike.
enum class GGReaction: uint8_t { Blocks, Cursor, Disabled, Click, Press, Release, Drag, Hover, Move, Focusable, FocusScope, Focus, Key, ClosesPopup, Wheel, EditBegin, EditChange, EditCommit, EditCancel, Count }
Reaction slots an element can have. Several are flags rather than events.
enum class CursorShape: uint8_t { Arrow, Text, Wait, Crosshair, Progress, ResizeNWSE, ResizeNESW, ResizeEW, ResizeNS, Move, NotAllowed, Hand, Hidden, Count }
Cursor shown over an element. Same values and order as the platform layer's, so the host passes the number straight through.
enum NodeState: uint8_t { StateChecked = 1 << 0, StateHovered = 1 << 1, StateFocusVisible = 1 << 2, StatePressed = 1 << 3, StateDisabled = 1 << 4, StateDropTarget = 1 << 5 }
Interaction state bits. Paint-only: a change never triggers layout.
enum FocusScopeFlags: uint8_t { FocusScopeTrap = 1 << 0, FocusScopeRestore = 1 << 1 }
ui.FocusScope options.
enum class GGPinSide: uint8_t { In, Out }
Which way a pin's wires go.
enum class GGHintFor: uint8_t { Any, Number, Text, Flag }
The kind of value a hint applies to.
enum class GGNotice: uint8_t { Info, Success, Warning, Error }
What a notice is about, which picks its style class.
enum class GGSplit: uint8_t { Columns, Rows }
Which way a split divides its space.
enum class GGSide: uint8_t { Below, Above, Right, Left }
Preferred side of the anchor element. Flips when there is no room.
enum class PopupKind: uint8_t { Popup, Menu, Tooltip, Dialog }
What a popup is.
enum class PopupTrigger: uint8_t { Click, Context, Hover, State, Drag, Notice }
What opens a popup.
enum class GGAlign: uint8_t { Start, Center, End, Stretch, Baseline }
Where children go along an axis, or a popup along its anchor's side.
enum class SizeMode: uint8_t { Fit, Fixed, Grow, Percent }
How a size along one axis is worked out.
enum GGStyleProperty: uint8_t { StyleFill = 1 << 0, StyleBorder = 1 << 1, StyleText = 1 << 2, StyleAccent = 1 << 3, StyleKnob = 1 << 4, StyleRadius = 1 << 5, StyleOutline = 1 << 6, StyleShadow = 1 << 7, StyleAll = 0xFF }
Style properties that can be transitioned. Each covers all of its parts: StyleBorder is colour and width, StyleShadow is colour, blur, and offset.
enum class GGEase: uint8_t { Out, InOut, Linear, In, Step }
How a change runs over its time.
enum class WidgetType: WidgetTypeID { Root, Box, Text, Button, Component, Progress, Image, Viewport, Toggle, Slider, Canvas }
The kinds of node the core itself makes.
enum class GGPad: uint8_t { None, South, East, West, North, Back, Start, LeftShoulder, RightShoulder, LeftTrigger, RightTrigger, LeftStick, RightStick, Up, Down, Left, Right }
A gamepad button, named by where it is (South is the bottom face button), whatever it is labelled on a given pad.
enum class GGPadFamily: uint8_t { Generic, Xbox, PlayStation, Nintendo }
How a gamepad labels its buttons.
enum class Direction: uint8_t { Row, Column, Stack, Grid }
How a container places its children.
enum class GGAnchor: uint8_t { None, TopLeft, Top, TopRight, Left, Center, Right, BottomLeft, Bottom, BottomRight }
Anchor point for an overlay (ui.Place).
enum class GGRole: uint8_t { None, Document, Group, Text, Button, ProgressBar, List, ListItem, Tree, TreeItem, Image, Switch, Slider, SpinButton, Menu, MenuItem, Tooltip, ComboBox, RadioGroup, Radio, Separator, TextBox, Table, ColumnHeader, TabList, Tab }
What an element is to assistive technology.
enum AccessState: uint8_t { AccessFocusable = 1 << 0, AccessExpanded = 1 << 1, AccessCollapsed = 1 << 2, AccessDisabled = 1 << 3, AccessChecked = 1 << 4, AccessFocused = 1 << 5 }
An element's state, for assistive technology (AccessInfo::State).
enum class Overflow: uint8_t { Visible, Clip, Scroll, Pan }
What a container does with content larger than itself.
enum class GGScaleFit: uint8_t { Contain, Width, Height }
How a ScaleBox fits its content (ui.ScaleBox).
enum class ImageID: uint32_t { None = 0 }
Handle to an image: a file, an atlas region, or a render target. Issued by the ImageSource (Paint.h); the core never sees files or GPU objects.
enum class GGFillToward: uint8_t { Right, Left, Up, Down }
The way a progress bar fills.
enum class GGFit: uint8_t { Contain, Cover, Fill, None }
How an image fits a box with a different aspect ratio.
enum class ValueKind: uint8_t { Bool, Int, Float, Int64, Double, Fixed }
A value's type, for tools and for sources receiving an edit.
enum class GGInputType: uint8_t { Number, BigNumber, Integer, Bool, Text, Colour, Image, Widget, Context }
What an asset's input takes.
enum class GGPropKind: uint8_t { Number, Integer, Bool, Size, Edges, Choice, Text, Color, Image, Name, Object, List, Actions }
What kind of value a property is: how it is read, written, and edited.
enum class GGPropGroup: uint8_t { Element, Layout, Look, Content, Behaviour, Transform }
Where the designer's Details shows a property.

Typedefs

using FieldID = uint32_t
A field a binding reads, as the integration layer numbers it.
using BindTarget = uint64_t
Whose fields a binding reads: an entity handle's bits, or any other 64-bit identity.
using ItemID = uint64_t
An item of a data source: the same in every source that shows it.
using ItemRowFn = Detail::KeptItemFn<ItemID>
A list or tree row's content, stored by the view: [=](UI& ui, ItemID item) { ... }.
using ItemCellFn = Detail::KeptItemFn<ItemID, uint32_t>
A table cell's content, stored by the table: [=](UI& ui, ItemID item, uint32_t column) { ... }.
using TypeID = uint64_t
A field's type, as editors are registered for it. Assigned by the integration layer; usually TypeIDOf(name).
using EditorFn = void(*)(UI&ui, const FieldSource&source, const FieldInfo&field)
Builds the editor of field of source.
using NodeIndex = uint32_t
A node's slot: chunk * 64 + slot. What rows and links store.
using WidgetTypeID = uint16_t
What kind of element a node is (a box, a label, a widget), as the builder records it.
using SnapshotPrimitives = SharedChunks<UIPrimitive, 256>
A snapshot's primitives, by slot.
using SnapshotRuns = SharedChunks<SnapshotRun, NodeStorage::SlotsPerChunk>
A snapshot's primitive runs, by node slot.
using SnapshotSpaces = SharedChunks<SnapshotSpace, NodeStorage::SlotsPerChunk>
A snapshot's scroll spaces, by node slot.
using TextPos = uint32_t
byte offset into a buffer's text
using CommandHandler = HandlerOf<CommandEvent>
A command's handler (ui.Command).
using GGKey = uint16_t
USB HID keyboard usage: identifies the physical key, regardless of layout.
using PointerHandler = HandlerOf<PointerEvent>
A handler of pointer events.
using HoverHandler = HandlerOf<bool>
A hover handler: true when the pointer entered, false when it left.
using FocusHandler = HandlerOf<bool>
A focus handler: true when it gained focus, false when it lost it.
using KeyHandler = HandlerOf<KeyEvent>
A handler of keys.
using FileChoiceFn = std::function<void(std::span<const std::string_view> paths)>
Receives the chosen paths; empty if the dialog was cancelled.
using GGWidgetInputs = std::vector<GGWidgetInput>
What a use gives an asset.
using FontID = uint16_t
A loaded font, by the order it was loaded in from 0.

Functions

auto KeepReader(const BindingReader& next) -> const BindingReader*
For a reader made over another: keeps next for as long as the program runs and returns where it is.
auto operator/(BigField numerator, BigField denominator) -> BigRatio
numerator over denominator, clamped to 0..1.
auto operator>=(BigField left, BigField right) -> BigAtLeast
1 if left is at least right, else 0.
auto operator<=(BigField left, BigField right) -> BigAtLeast
1 if left is at most right, else 0.
auto GGBind(BindTarget target, const GGExpr& expression) -> GGBinding
A binding of expression over target's fields.
auto GGBind(BindTarget target, BigField field) -> GGBinding
A big field's value (see BigField).
auto GGBind(BindTarget target, BigRatio ratio) -> GGBinding
A ratio of two big fields, 0..1.
auto GGBind(BindTarget target, BigAtLeast comparison) -> GGBinding
1 if one big field is at least another, else 0.
template<typename TFn>
auto BindLambda(BindTarget target, TFn fn) -> GGBinding
Escape hatch: fn(reader, target, bValid) computes the value. CPU only, and evaluated every update because its dependencies are unknown.
auto ClassOf(GGProperty property) -> PropertyClass constexpr
What a change of property costs.
auto NameOf(GGProperty property) -> const char*
The property's name, for diagnostics.
auto TypeIDOf(std::string_view name) -> TypeID constexpr
The TypeID of a type named name.
auto GetVersion() -> GGVersion
The version this build of GG-UI is.
void MeasureFixedMetric(const TextRequest& request, TextMetrics& out)
Built-in measurer: 8 units per character, 16-unit lines, baseline at 12.
auto SameLook(const PaintStyle& a, const PaintStyle& b) -> bool
Whether a and b draw the same.
auto BlendLooks(const PaintStyle& from, const PaintStyle& to, float elapsed, PaintStyle& out) -> bool
The style elapsed seconds into a transition from from to to, using to's durations. Returns false once the transition is complete (out is then to).
auto ReadStyleColour(std::string_view text, GGColor& out) -> bool
Parses a literal colour (#RRGGBB, rgb(...), transparent; not a token).
void SetThirdCorner(UIPrimitive& primitive, float x, float y)
The third corner of a Triangle primitive.
auto ThirdCornerY(const UIPrimitive& primitive) -> float
The y of a Triangle primitive's third corner; its x is Parameter.
auto IsPointShape(const UIPrimitive& primitive) -> bool
Points of a Line or Triangle primitive (X/Y, Width/Height, and a triangle's third corner) are positions; everything else's rect is a position and a size.
auto DrawsSomething(const UIPrimitive& primitive) -> bool
False for an empty primitive, which is what a reserved but unused slot holds.
auto PaintSnapshot(GGSnapshot& snapshot, const StyleTable* styles, const GlyphSource* glyphs = nullptr, const GGSnapshot* previous = nullptr, std::span<const PaintLayer> layers = {}, uint64_t paintedWith = ~0ull, PaintState* state = nullptr, std::span<const PaintNested> nested = {}) -> PaintStats
Fill snapshot's primitives and clip table from its nodes. styles may be null (every class gets the default style) and so may glyphs (text draws as blocks).
auto RasterizeReference(const GGSnapshot& snapshot, GGColor background = GGColor(0, 0, 0, 255), const ReferenceTextures* textures = nullptr) -> ReferenceImage
Draw snapshot's primitives over background, at the snapshot's surface size and scale. Glyphs are skipped without textures, and images are white.
auto IsColour(GGAnimated property) -> bool constexpr
True for the properties whose keys are colours.
auto GGEased(float t, GGEase ease) -> float
t (0 to 1) shaped by ease.
void GGSample(const GGTrack& track, float time, float& number, GGColor& colour)
What track sets at time: its number, or its colour.
auto HashStyleName(std::string_view name) -> uint64_t
HashString of a class, part, or token name (UITypes.h).
auto Token(std::string_view name) -> GGToken
The token named name, in a rule: .Fill = Token("accent").
auto FontNamed(std::string_view name) -> GGFont
The font registered as name. Also records the name, so tools can show which font a style refers to.
auto FontNameOf(uint64_t font) -> std::string_view
Name a font was requested by; empty if never requested. Thread-safe.
auto Transition(uint8_t properties, float seconds, GGEase ease = GGEase::Out) -> GGTransitions constexpr
properties take seconds to change, eased by ease.
auto ClassKey(std::string_view classes) -> uint64_t
The key a node stores for its class text.
void ClassKeyParts(uint64_t key, std::vector<uint64_t>& classes, uint64_t& part)
Split a key into its classes and part (0 = none). An unregistered key is a single class: itself.
auto IsSpace(Overflow overflow) -> bool constexpr
Content in its own space, moved (and with Pan, zoomed) without being laid out again.
auto SiteID(const std::source_location& where) -> uint64_t
Identifies the source location an element is built at. Elements are keyed by it, so identity survives an if removing a sibling without the author writing a key.
auto HashString(std::string_view text) -> uint64_t constexpr
FNV-1a. Used for style class names and other string identities.
template<typename TFn>
auto OnCommit(TFn fn) -> auto
A value widget's second argument that hears only the final value of an edit.
template<typename T>
auto GGEdit(const GGBinding& reads, const GGDoes<T>& writes) -> Editable<T>
An Editable: reads, written by writes.
template<typename T>
auto WidgetDefOf() -> const WidgetDef&
Builds the WidgetDef for a widget struct from the hooks it defines.
auto GGDidYouMean(std::string_view written, std::span<const std::string_view> known) -> std::string
(did you mean "Value"?) when written is close to one of known, otherwise nothing. For messages about names.
auto GGWriteWidgetFile(const JsonValue& file) -> std::string
file (a widget asset's JSON, read with JsonReadOptions::bKeepComments) as the designer saves it: an outline with one element to a line, its children each on a line of their own a tab deeper, children its last key; other values on one line while they fit.
auto GGFieldKey(std::string_view field) -> std::string
A field name as the file writes it: bWrap is "wrap", MaxLines "maxLines", ZOrder "zOrder".
auto GGFieldDisplay(std::string_view field) -> std::string
As the designer shows it: bWrap is "Wrap", MaxLines "Max Lines".
auto GGReaderKeys() -> std::span<const std::string_view>
Every key the widget file reader takes, on some element (for checking the registry against it).
auto GGReadSize(const JsonValue& value, GGSize& out, std::string& why) -> bool
A size as the file writes it: a number, "grow", "grow 2", "fit", or "50%". False, with why, if it isn't one. The loader reads with these too, so a file means the same wherever it is read.
auto GGWriteSize(const GGSize& size) -> JsonValue
size as the file writes it.
auto GGReadEdges(const JsonValue& value, GGEdges& out, std::string& why) -> bool
Edges as the file writes them: a number, [across, down], or [left, top, right, bottom]. False, with why, if they aren't.
auto GGWriteEdges(const GGEdges& edges) -> JsonValue
edges as the file writes them, as short as it can.
auto GGReadColor(const JsonValue& value, GGColor& out, std::string& why) -> bool
A colour as the file writes it: any colour a style sheet takes (#RRGGBB, #RRGGBBAA, rgb(...)). False, with why, if it isn't one.
auto GGWriteColor(const GGColor& color) -> JsonValue
color as the file writes it.
auto GGReadChoice(const JsonValue& value, std::span<const std::string_view> words, int& out, std::string& why) -> bool
One of words, as its index. "centre" is read as "center", as the file allows.
auto GGGroupOf(std::string_view key) -> GGPropGroup
Where a property is shown in the designer's Details, by its key.
template<typename TProps>
void GGAddFields(GGWidgetType& type, std::initializer_list<std::string_view> skip = {})
Add TProps's reflected fields (GG_REGISTER_FIELDS) to type, leaving out skip (keys the element takes another way).
template<typename TProps>
void GGRegisterCodeWidget(std::string_view name, void(*)(UI&ui, const void*props) build, std::string_view group = "Code")
Register a code widget named name, whose props are TProps: build builds it from them. GG_REGISTER_WIDGET calls it.

Variables

ItemID RootItem constexpr
not an item: the parent of top-level items
ItemID NoItem constexpr
the root's parent
FieldID NoField constexpr
A field with nothing for a binding to read.
NodeIndex InvalidNode constexpr
No node.
uint32_t NodeSlotsPerChunk constexpr
Nodes per chunk.
uint32_t GGCodeScopeRank constexpr
Scope ranks.
size_t GGSlotCount constexpr
How many chords an action has.
int StylePropertyCount constexpr
How many GGStyleProperty bits there are.
FontID NoFont constexpr
No font: what LoadFont returns for a file it can't read.