morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
layout.hpp File Reference

Visual structure (sections, tabs, accordions, column spans) layered over an action's flat field list. More...

#include <cstdint>
#include <iterator>
#include <span>
#include <string_view>

Go to the source code of this file.

Classes

struct  morph::forms::FieldGroup
 One named group of fields in an action's formLayout. More...
struct  morph::forms::FieldSpan
 A field's declared column span in a grid renderer. More...

Enumerations

enum class  morph::forms::GroupKind : std::uint8_t { Section , Tab , Accordion }
 The container kind a FieldGroup renders as. More...

Functions

constexpr std::string_view morph::forms::groupKindName (GroupKind kind) noexcept
 Maps a GroupKind to the string mergeSchemaExtras emits for it in x-layout.groups[].kind.

Detailed Description

Visual structure (sections, tabs, accordions, column spans) layered over an action's flat field list.

morph::forms::schemaJson<A>() (forms.hpp) already lays every field out in a single flat list, ordered by x-order. This header adds two optional compile-time declarations an action may expose: formLayout, a list of FieldGroups that bucket fields into titled sections, tabs, or an accordion panel; and fieldSpans, a list of FieldSpans that widen individual fields in a grid renderer. Both mirror the existing optionalFields convention (forms.hpp) — a static constexpr list mergeSchemaExtras looks for by name, present only when an action opts in.

Absent either declaration, schemaJson<A>()'s output is unchanged: no x-layout, x-group, x-section, or x-colspan key is emitted, and a renderer lays every field out exactly as it does today (flat, x-order order). See docs/spec/forms/forms.md, "Layout & grouping".

Definition in file layout.hpp.

Enumeration Type Documentation

◆ GroupKind

enum class morph::forms::GroupKind : std::uint8_t
strong

The container kind a FieldGroup renders as.

Enumerator
Section 

A titled fieldset, stacked vertically (the default).

Tab 

A pane of a shared tab bar; consecutive Tab groups share one bar.

Accordion 

A collapsible panel.

Definition at line 32 of file layout.hpp.

Function Documentation

◆ groupKindName()

std::string_view morph::forms::groupKindName ( GroupKind kind)
nodiscardconstexprnoexcept

Maps a GroupKind to the string mergeSchemaExtras emits for it in x-layout.groups[].kind.

Parameters
kindGroup kind to name.
Returns
"section", "tab", or "accordion". The default branch (all three enumerators are already listed explicitly) is an out-of-range-value fallback to "section", the renderer's documented downgrade for an unsupported kind.

Definition at line 45 of file layout.hpp.