Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::ui::ct Namespace Reference

Compile-time descriptions translated into the existing owning UI recipes at runtime. More...

Classes

struct  Literal
 Owning fixed-size bytes usable as a structural template argument. More...
class  Element
 Immutable-through-accessors static node; no live widgets, models, slots or callbacks. More...
class  StaticScene
 Validated static scene value; runtime recipes and mounted ownership remain separate. More...

Functions

template<Literal Id = "", std::size_t N>
consteval auto label (const char(&text)[N], ControlStyle style=ControlStyle{}, SizePolicy policy=DEFAULT_CONTENT_POLICY)
template<Literal Id = "", std::size_t N>
consteval auto button (const char(&text)[N], ControlStyle style=ControlStyle{}, SizePolicy policy=DEFAULT_CONTENT_POLICY)
template<Literal Id = "", std::size_t N>
consteval auto lineEdit (const char(&initial)[N], EditMode mode=EditMode::IMMEDIATE, ControlStyle style=ControlStyle{}, SizePolicy policy=DEFAULT_EDITOR_POLICY)
template<Literal Id = "", detail::StaticElement... Children>
consteval auto row (LinearOptions options, Children... children)
template<Literal Id = "", detail::StaticElement... Children>
consteval auto row (Children... children)
template<Literal Id = "", detail::StaticElement... Children>
consteval auto column (LinearOptions options, Children... children)
template<Literal Id = "", detail::StaticElement... Children>
consteval auto column (Children... children)
template<detail::StaticElement Root>
consteval auto scene (Root root)
template<Literal Id, class T>
auto reference (ui::Ref< T > value)
template<Literal Id, class Callback>
requires portals::detail::ManagedAction<Callback, ClickEvent>
auto onClick (Callback value)
template<Literal Id>
auto bind (ManagedState< std::string > value)
template<detail::StaticElement Root, detail::RuntimeAdapter... Adapters>
auto describe (const StaticScene< Root > &value, Adapters... adapters)

Detailed Description

Compile-time descriptions translated into the existing owning UI recipes at runtime.

Function Documentation

◆ bind()

template<Literal Id>
auto portals::ui::ct::bind ( ManagedState< std::string > value)
Template Parameters
IdRequired nonempty LineEdit identity, checked during describe().
Parameters
valueExisting scene-owned text observation; must belong to the receiving ManagedScene.
Returns
Runtime adapter; the model supplies initial text instead of the descriptor's initial bytes.

◆ button()

template<Literal Id = "", std::size_t N>
auto portals::ui::ct::button ( const char(&) text[N],
ControlStyle style = ControlStyle{},
SizePolicy policy = DEFAULT_CONTENT_POLICY )
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
NCaption array extent including its terminator.
Parameters
textConstant caption bytes copied now, Unicode-validated at runtime mount.
styleOwning manual appearances.
policyOwning validated constraints, in terminal cells.
Returns
Constant-built unbound Button; add a runtime onClick adapter when needed.

◆ column() [1/2]

template<Literal Id = "", detail::StaticElement... Children>
auto portals::ui::ct::column ( Children... children)
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
ChildrenFactory-produced static node types.
Parameters
childrenOwning static children in insertion order.
Returns
Constant-built Column using existing default linear settings.

◆ column() [2/2]

template<Literal Id = "", detail::StaticElement... Children>
auto portals::ui::ct::column ( LinearOptions options,
Children... children )
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
ChildrenFactory-produced static node types.
Parameters
optionsExisting validated vertical layout settings.
childrenOwning static children, mounted top to bottom.
Returns
Constant-built Column description.

◆ describe()

template<detail::StaticElement Root, detail::RuntimeAdapter... Adapters>
auto portals::ui::ct::describe ( const StaticScene< Root > & value,
Adapters... adapters )
Template Parameters
RootValidated static root type.
AdaptersExplicit runtime adapter types; IDs and target types are compile-time checked.
Parameters
valueOwning static scene borrowed only while constructing the returned runtime recipe.
adaptersOwning runtime values consumed into existing recipes; duplicate kind/ID pairs are errors.
Returns
Existing move-only Description suitable for ui::mount or ui::scene; allocation/capture moves may throw before those checked boundaries, just as with dynamic factories. Mount preserves transactional refs, subtree rollback, Unicode errors, UI affinity and scene-owned callback cleanup. No static storage is borrowed by the returned recipe and no second retained tree survives mount.

◆ label()

template<Literal Id = "", std::size_t N>
auto portals::ui::ct::label ( const char(&) text[N],
ControlStyle style = ControlStyle{},
SizePolicy policy = DEFAULT_CONTENT_POLICY )
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
NCaption array extent including its terminator.
Parameters
textConstant bytes copied into the result; Unicode validity is checked at runtime mount.
styleOwning manual appearances.
policyOwning validated constraints, in terminal cells.
Returns
A constant-built Label description with owning bytes.

◆ lineEdit()

template<Literal Id = "", std::size_t N>
auto portals::ui::ct::lineEdit ( const char(&) initial[N],
EditMode mode = EditMode::IMMEDIATE,
ControlStyle style = ControlStyle{},
SizePolicy policy = DEFAULT_EDITOR_POLICY )
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
NInitial text extent including its terminator.
Parameters
initialConstant initial bytes; ignored when an explicit runtime state binding is supplied.
modeExisting confirmation policy; IMMEDIATE preserves the dynamic factory default.
styleOwning manual appearances.
policyOwning validated constraints, in terminal cells.
Returns
Constant-built editor description; other editor options use existing runtime factories.

◆ onClick()

template<Literal Id, class Callback>
requires portals::detail::ManagedAction<Callback, ClickEvent>
auto portals::ui::ct::onClick ( Callback value)
Template Parameters
IdRequired nonempty Button identity, checked during describe().
CallbackExisting void/expected/EditorCommandResult action, optionally borrowing ClickEvent.
Parameters
valueOwning action; explicit borrowed services must outlive invocation.
Returns
Runtime adapter; captures transfer to ManagedScene at mount, with existing teardown semantics.

◆ reference()

template<Literal Id, class T>
auto portals::ui::ct::reference ( ui::Ref< T > value)
Template Parameters
IdRequired nonempty static identity.
TExisting widget type, checked against the target during describe().
Parameters
valueShared UI-thread reference slot; empty until the complete runtime mount succeeds.
Returns
Runtime adapter owning a slot copy; no scene or widget ownership is retained.

◆ row() [1/2]

template<Literal Id = "", detail::StaticElement... Children>
auto portals::ui::ct::row ( Children... children)
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
ChildrenFactory-produced static node types.
Parameters
childrenOwning static children in insertion order.
Returns
Constant-built Row using existing default linear settings.

◆ row() [2/2]

template<Literal Id = "", detail::StaticElement... Children>
auto portals::ui::ct::row ( LinearOptions options,
Children... children )
consteval
Template Parameters
IdOptional style/adapter identity, unique when nonempty.
ChildrenFactory-produced static node types.
Parameters
optionsExisting validated horizontal layout settings.
childrenOwning static children, mounted left to right.
Returns
Constant-built Row description.

◆ scene()

template<detail::StaticElement Root>
auto portals::ui::ct::scene ( Root root)
consteval
Template Parameters
RootFactory-produced static node type.
Parameters
rootOwning static tree; duplicate nonempty IDs are compilation errors.
Returns
Validated constant-built scene ready for runtime describe().