morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::ui::author::Node Class Reference

A view node (spec 5 §9). The kind's own properties come from its builder's options; the properties every node takes come from the member functions, each of which returns a copy with the property set. More...

#include <author.hpp>

Public Member Functions

 Node (Json json, CatalogFacts facts={})
 A node over its JSON, for a kind no builder spells.
Json const & json () const noexcept
 The node's JSON.
CatalogFacts const & facts () const noexcept
 The catalog facts of the models and actions the node names.
Node with (std::string const &key, AnyHandle const &value) const
 A property set to an expression; an absent expression leaves the node as it is.
Node withText (std::string const &key, std::string const &value) const
 A property set to a plain string.
Node id (Element const &element) const
 The element id, by which relations read its values.
Node visible (AnyHandle const &condition) const
 Whether the node shows.
Node enabled (AnyHandle const &condition) const
 Whether the node is enabled.
Node tooltip (AnyHandle const &text) const
 A tooltip.
Node sizing (AnyHandle const &sizing) const
 The width's sizing: "content", {"fixed": n} or {"stretch": w}, such as content(), fixed(n) or stretch() give.
Node sizing (AnyHandle const &width, AnyHandle const &height) const
 The sizing of both dimensions, as a {width, height} record; an absent one is content. Literal sizings (content(), fixed(n), stretch(w)) make a literal record, which the loader checks; another is evaluated at mount.
Node alignSelf (Align align) const
 Where the node sits in its row, column or grid, in place of the container's align.
Node minWidth (int units) const
 The least width, in backend units.
Node maxWidth (int units) const
 The most width, in backend units.
Node minHeight (int units) const
 The least height, in backend units.
Node maxHeight (int units) const
 The most height, in backend units.
Node span (AnyHandle const &columns) const
 The grid columns the node spans.
Node autofocus (AnyHandle const &focus) const
 Whether the node takes focus when it mounts.
Node testId (std::string const &name) const
 A stable identifier for automated tests.
Node surface (std::string const &name) const
 A named token set for the subtree.
Node a11y (AnyHandle const &name, std::string const &role={}) const
 The accessible name and role.
Node drag (AnyHandle const &payload) const
 Makes the node draggable.
Node drop (AnyHandle const &accepts, Commands const &onDrop) const
 Makes the node a drop target.
Node key (std::string const &chord, Commands const &commands) const
 A key binding.
Node readonly (AnyHandle const &condition) const
 Whether an input or text is read-only.
Node required (AnyHandle const &condition) const
 Whether an input or text is required.
Node errors (AnyHandle const &errors) const
 Errors shown on an input or text.
Node stale (AnyHandle const &condition) const
 Whether an input or text shows a value that is being recalculated.

Detailed Description

A view node (spec 5 §9). The kind's own properties come from its builder's options; the properties every node takes come from the member functions, each of which returns a copy with the property set.

Definition at line 1778 of file author.hpp.

Constructor & Destructor Documentation

◆ Node()

morph::ui::author::Node::Node ( Json json,
CatalogFacts facts = {} )
inlineexplicit

A node over its JSON, for a kind no builder spells.

Parameters
jsonThe node.
factsThe catalog facts of the models and actions it names.

Definition at line 1783 of file author.hpp.

Member Function Documentation

◆ json()

Json const & morph::ui::author::Node::json ( ) const
inlinenodiscardnoexcept

The node's JSON.

Returns
The JSON.

Definition at line 1787 of file author.hpp.

◆ facts()

CatalogFacts const & morph::ui::author::Node::facts ( ) const
inlinenodiscardnoexcept

The catalog facts of the models and actions the node names.

Returns
The facts.

Definition at line 1791 of file author.hpp.

◆ with()

Node morph::ui::author::Node::with ( std::string const & key,
AnyHandle const & value ) const
inlinenodiscard

A property set to an expression; an absent expression leaves the node as it is.

Parameters
keyThe property.
valueThe expression.
Returns
The node with it.

Definition at line 1797 of file author.hpp.

◆ withText()

Node morph::ui::author::Node::withText ( std::string const & key,
std::string const & value ) const
inlinenodiscard

A property set to a plain string.

Parameters
keyThe property.
valueThe string.
Returns
The node with it.

Definition at line 1809 of file author.hpp.

◆ id()

Node morph::ui::author::Node::id ( Element const & element) const
inlinenodiscard

The element id, by which relations read its values.

Parameters
elementThe element.
Returns
The node with it.

Definition at line 1818 of file author.hpp.

◆ visible()

Node morph::ui::author::Node::visible ( AnyHandle const & condition) const
inlinenodiscard

Whether the node shows.

Parameters
conditionThe condition.
Returns
The node with it.

Definition at line 1823 of file author.hpp.

◆ enabled()

Node morph::ui::author::Node::enabled ( AnyHandle const & condition) const
inlinenodiscard

Whether the node is enabled.

Parameters
conditionThe condition.
Returns
The node with it.

Definition at line 1828 of file author.hpp.

◆ tooltip()

Node morph::ui::author::Node::tooltip ( AnyHandle const & text) const
inlinenodiscard

A tooltip.

Parameters
textThe text.
Returns
The node with it.

Definition at line 1833 of file author.hpp.

◆ sizing() [1/2]

Node morph::ui::author::Node::sizing ( AnyHandle const & sizing) const
inlinenodiscard

The width's sizing: "content", {"fixed": n} or {"stretch": w}, such as content(), fixed(n) or stretch() give.

Parameters
sizingThe sizing.
Returns
The node with it.

Definition at line 1839 of file author.hpp.

◆ sizing() [2/2]

Node morph::ui::author::Node::sizing ( AnyHandle const & width,
AnyHandle const & height ) const
inlinenodiscard

The sizing of both dimensions, as a {width, height} record; an absent one is content. Literal sizings (content(), fixed(n), stretch(w)) make a literal record, which the loader checks; another is evaluated at mount.

Parameters
widthThe width's sizing.
heightThe height's sizing.
Returns
The node with it.

Definition at line 1847 of file author.hpp.

◆ alignSelf()

Node morph::ui::author::Node::alignSelf ( Align align) const
inlinenodiscard

Where the node sits in its row, column or grid, in place of the container's align.

Parameters
alignThe alignment.
Returns
The node with it.

Definition at line 1872 of file author.hpp.

◆ minWidth()

Node morph::ui::author::Node::minWidth ( int units) const
inlinenodiscard

The least width, in backend units.

Parameters
unitsThe bound, 0 or more.
Returns
The node with it.

Definition at line 1877 of file author.hpp.

◆ maxWidth()

Node morph::ui::author::Node::maxWidth ( int units) const
inlinenodiscard

The most width, in backend units.

Parameters
unitsThe bound, 0 or more.
Returns
The node with it.

Definition at line 1882 of file author.hpp.

◆ minHeight()

Node morph::ui::author::Node::minHeight ( int units) const
inlinenodiscard

The least height, in backend units.

Parameters
unitsThe bound, 0 or more.
Returns
The node with it.

Definition at line 1887 of file author.hpp.

◆ maxHeight()

Node morph::ui::author::Node::maxHeight ( int units) const
inlinenodiscard

The most height, in backend units.

Parameters
unitsThe bound, 0 or more.
Returns
The node with it.

Definition at line 1892 of file author.hpp.

◆ span()

Node morph::ui::author::Node::span ( AnyHandle const & columns) const
inlinenodiscard

The grid columns the node spans.

Parameters
columnsThe span.
Returns
The node with it.

Definition at line 1897 of file author.hpp.

◆ autofocus()

Node morph::ui::author::Node::autofocus ( AnyHandle const & focus) const
inlinenodiscard

Whether the node takes focus when it mounts.

Parameters
focusThe condition.
Returns
The node with it.

Definition at line 1902 of file author.hpp.

◆ testId()

Node morph::ui::author::Node::testId ( std::string const & name) const
inlinenodiscard

A stable identifier for automated tests.

Parameters
nameThe identifier.
Returns
The node with it.

Definition at line 1907 of file author.hpp.

◆ surface()

Node morph::ui::author::Node::surface ( std::string const & name) const
inlinenodiscard

A named token set for the subtree.

Parameters
nameThe token set.
Returns
The node with it.

Definition at line 1912 of file author.hpp.

◆ a11y()

Node morph::ui::author::Node::a11y ( AnyHandle const & name,
std::string const & role = {} ) const
inlinenodiscard

The accessible name and role.

Parameters
nameThe name.
roleThe role; empty for the kind's own.
Returns
The node with it.

Definition at line 1918 of file author.hpp.

◆ drag()

Node morph::ui::author::Node::drag ( AnyHandle const & payload) const
inlinenodiscard

Makes the node draggable.

Parameters
payloadThe payload a drop receives.
Returns
The node with it.

Definition at line 1934 of file author.hpp.

◆ drop()

Node morph::ui::author::Node::drop ( AnyHandle const & accepts,
Commands const & onDrop ) const
inlinenodiscard

Makes the node a drop target.

Parameters
acceptsThe payloads it accepts.
onDropThe commands run with the payload as event.
Returns
The node with it.

Definition at line 1944 of file author.hpp.

◆ key()

Node morph::ui::author::Node::key ( std::string const & chord,
Commands const & commands ) const
inlinenodiscard

A key binding.

Parameters
chordThe chord, such as Ctrl+S.
commandsThe commands.
Returns
The node with it.

Definition at line 1959 of file author.hpp.

◆ readonly()

Node morph::ui::author::Node::readonly ( AnyHandle const & condition) const
inlinenodiscard

Whether an input or text is read-only.

Parameters
conditionThe condition.
Returns
The node with it.

Definition at line 1969 of file author.hpp.

◆ required()

Node morph::ui::author::Node::required ( AnyHandle const & condition) const
inlinenodiscard

Whether an input or text is required.

Parameters
conditionThe condition.
Returns
The node with it.

Definition at line 1974 of file author.hpp.

◆ errors()

Node morph::ui::author::Node::errors ( AnyHandle const & errors) const
inlinenodiscard

Errors shown on an input or text.

Parameters
errorsThe errors.
Returns
The node with them.

Definition at line 1979 of file author.hpp.

◆ stale()

Node morph::ui::author::Node::stale ( AnyHandle const & condition) const
inlinenodiscard

Whether an input or text shows a value that is being recalculated.

Parameters
conditionThe condition.
Returns
The node with it.

Definition at line 1984 of file author.hpp.


The documentation for this class was generated from the following file: