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

Single-use lazy owner of one Application and ManagedScene; no second runtime. Construct and operate on the UI thread. Moving preserves affinity and stable callback storage; move assignment is deliberately unavailable. Destruction during an operation, on another thread, or within a tree frame follows ManagedScene's terminate contract. Recipe/capture construction may throw before a checked boundary. Fluent failures are sticky and observable through checked()/run(). Foreign-thread fluent calls leave state untouched; checked operations there return WRONG_THREAD. More...

#include <ui_scene.hpp>

Public Member Functions

 Scene (Scene &&other) noexcept
 Transfer a UI-affine owner between operations, including between session steps. Wrong-thread moves and moves from inside an operation or callback terminate.
Scene & operator= (Scene &&)=delete
 Scene (const Scene &)=delete
Scene & operator= (const Scene &)=delete
 ~Scene ()
 Cancel and finish an active session, then close its managed owner before releasing Application. Destruction is UI-only, outside operations/frames; the borrowed ready terminal must still be alive.
DynamicRef get (std::string_view name, std::source_location origin=std::source_location::current())
template<class T>
requires std::derived_from<T, Widget>
Ref< T > get (std::string_view name, std::source_location origin=std::source_location::current())
Scene & prepare (std::source_location origin=std::source_location::current()) &
Scene && prepare (std::source_location origin=std::source_location::current()) &&
std::expected< void, ManagedError > prepareChecked (std::source_location origin=std::source_location::current())
std::expected< void, ManagedError > checked () const
std::expected< std::reference_wrapper< ManagedScene >, ManagedError > managed () const
std::expected< ManagedDiagnosticBatch, TreeError > diagnostics () const
Scene & theme (StyleSheet sheet, std::source_location origin=std::source_location::current()) &
Scene && theme (StyleSheet sheet, std::source_location origin=std::source_location::current()) &&
Scene & styleLayers (StyleLayerOptions options={}, std::source_location origin=std::source_location::current()) &
 Opt into independent theme/application/user ownership at the existing configuration boundary.
Scene && styleLayers (StyleLayerOptions options={}, std::source_location origin=std::source_location::current()) &&
SceneRef ref () const
Scene & style (const StyleStage &stage, std::source_location origin=std::source_location::current()) &
Scene && style (const StyleStage &stage, std::source_location origin=std::source_location::current()) &&
template<class Source>
requires std::constructible_from<StyleStage, Source &&, const StyleOptions &, std::source_location>
Scene & style (Source &&source, const StyleOptions &options, std::source_location origin=std::source_location::current()) &
template<class Source>
requires std::constructible_from<StyleStage, Source &&, const StyleOptions &, std::source_location>
Scene && style (Source &&source, const StyleOptions &options, std::source_location origin=std::source_location::current()) &&
Scene & styleLayer (StyleTier tier, std::string name, StyleSheet sheet, std::source_location origin=std::source_location::current()) &
 Add one scene-owned override; enable styleLayers() before this configuration.
Scene && styleLayer (StyleTier tier, std::string name, StyleSheet sheet, std::source_location origin=std::source_location::current()) &&
Scene & onError (ManagedErrorHandler observer, std::source_location origin=std::source_location::current()) &
Scene && onError (ManagedErrorHandler observer, std::source_location origin=std::source_location::current()) &&
Scene & reportOnError (SceneReportHandler sink={}, std::source_location origin=std::source_location::current()) &
Scene && reportOnError (SceneReportHandler sink={}, std::source_location origin=std::source_location::current()) &&
template<detail::SceneConfiguration Callback>
Scene & configure (Callback callback, std::source_location origin=std::source_location::current()) &
template<detail::SceneConfiguration Callback>
Scene && configure (Callback callback, std::source_location origin=std::source_location::current()) &&
template<detail::SceneStop Callback>
Scene & onStop (Callback callback, std::source_location origin=std::source_location::current()) &
template<detail::SceneStop Callback>
Scene && onStop (Callback callback, std::source_location origin=std::source_location::current()) &&
template<class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (KeySelection selection, Info info, Callback callback, std::source_location origin=std::source_location::current()) &
template<class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (KeySelection selection, Info info, Callback callback, std::source_location origin=std::source_location::current()) &&
template<portals::detail::ShortcutSource Source, class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (Source &&source, Info info, Callback callback, std::source_location origin=std::source_location::current()) &
template<portals::detail::ShortcutSource Source, class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (Source &&source, Info info, Callback callback, std::source_location origin=std::source_location::current()) &&
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (const KeySelection &selection, Callback callback, std::source_location origin=std::source_location::current()) &
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (const KeySelection &selection, Callback callback, std::source_location origin=std::source_location::current()) &&
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (KeyEvent chord, Callback callback, std::source_location origin=std::source_location::current()) &
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (KeyEvent chord, Callback callback, std::source_location origin=std::source_location::current()) &&
template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (Source &&source, Callback callback, std::source_location origin=std::source_location::current()) &
template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (Source &&source, Callback callback, std::source_location origin=std::source_location::current()) &&
template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (Source &&source, Callback callback, ShortcutBehavior behavior, ShortcutOptions options={}, std::source_location origin=std::source_location::current()) &
template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (Source &&source, Callback callback, ShortcutBehavior behavior, ShortcutOptions options={}, std::source_location origin=std::source_location::current()) &&
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (std::initializer_list< key::Chord > source, Callback callback, std::source_location origin=std::source_location::current()) &
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (std::initializer_list< key::Chord > source, Callback callback, std::source_location origin=std::source_location::current()) &&
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & onKey (std::initializer_list< key::Chord > source, Callback callback, ShortcutBehavior behavior, ShortcutOptions options={}, std::source_location origin=std::source_location::current()) &
template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && onKey (std::initializer_list< key::Chord > source, Callback callback, ShortcutBehavior behavior, ShortcutOptions options={}, std::source_location origin=std::source_location::current()) &&
std::expected< ApplicationStats, ManagedError > run (std::stop_token stop={}, std::source_location origin=std::source_location::current())
std::expected< ApplicationStats, ManagedError > run (ApplicationTerminal &terminal, std::stop_token stop={}, std::source_location origin=std::source_location::current())
std::expected< void, ManagedError > start (ApplicationReadyTerminal &terminal, std::stop_token stop={}, std::source_location origin=std::source_location::current())
std::expected< ApplicationStep, ManagedError > step (std::source_location origin=std::source_location::current())
std::expected< void, ManagedError > quit (std::source_location origin=std::source_location::current())
 Request orderly exit through the existing application cancellation path.
int runApp (std::stop_token stop={}, std::source_location origin=std::source_location::current())
 Run a standalone scene with standard post-restoration error reporting.
int runApp (ApplicationTerminal &terminal, std::stop_token stop={}, std::source_location origin=std::source_location::current())
int runApp (int argc, const char *const *argv, CommandLineParser parser, std::stop_token stop={}, std::source_location origin=std::source_location::current())
 Parse copied process arguments once before preparing the application or mounting widgets.
int runApp (ApplicationTerminal &terminal, int argc, const char *const *argv, CommandLineParser parser, std::stop_token stop={}, std::source_location origin=std::source_location::current())
 Same preflight boundary with a borrowed custom terminal.
Scene & applicationOptions (std::function< ApplicationOptions()> provider, std::source_location origin=std::source_location::current()) &
 Store a lazy application policy provider, invoked after CLI preflight and before Application::create.
std::expected< void, ManagedError > close (std::source_location origin=std::source_location::current())

Friends

struct detail::SceneAccess

Detailed Description

Single-use lazy owner of one Application and ManagedScene; no second runtime. Construct and operate on the UI thread. Moving preserves affinity and stable callback storage; move assignment is deliberately unavailable. Destruction during an operation, on another thread, or within a tree frame follows ManagedScene's terminate contract. Recipe/capture construction may throw before a checked boundary. Fluent failures are sticky and observable through checked()/run(). Foreign-thread fluent calls leave state untouched; checked operations there return WRONG_THREAD.

Constructor & Destructor Documentation

◆ Scene()

portals::ui::Scene::Scene ( Scene && other)
noexcept

Transfer a UI-affine owner between operations, including between session steps. Wrong-thread moves and moves from inside an operation or callback terminate.

Parameters
otherSource owner, left empty with checked CLOSED results.

Member Function Documentation

◆ applicationOptions()

Scene & portals::ui::Scene::applicationOptions ( std::function< ApplicationOptions()> provider,
std::source_location origin = std::source_location::current() ) &

Store a lazy application policy provider, invoked after CLI preflight and before Application::create.

Parameters
providerOwning callback; borrowed captures must outlive synchronous preparation.
originRegistration call site.
Returns
This stationary scene; registration follows the same admission rules as other configuration.

◆ checked()

std::expected< void, ManagedError > portals::ui::Scene::checked ( ) const
Returns
First facade failure or success; WRONG_THREAD/CLOSED for foreign/moved-from handles.

◆ close()

std::expected< void, ManagedError > portals::ui::Scene::close ( std::source_location origin = std::source_location::current())
Parameters
originCleanup call site.
Returns
Idempotent explicit cleanup result; active sessions and reentry return WOULD_BLOCK without retirement. The first facade failure remains observable through checked()/run().

◆ configure() [1/2]

template<detail::SceneConfiguration Callback>
Scene & portals::ui::Scene::configure ( Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackOwning action taking ManagedScene&, optionally followed by Application&, returning void or exactly expected<void, ManagedError>. The one-argument form has priority.
Parameters
callbackConfiguration invoked once, in registration order after complete mount.
originRegistration call site retained across lazy preparation.
Returns
This owner; captures are owned, while explicitly borrowed services must outlive use. Ignoring low-level results inside a void callback remains the caller's responsibility. Rejected short text mutations latch the first setup failure before observers. The current void callback finishes normally; subsequent setup/run is skipped without rollback. Expected permits explicit early return. Returning the exact internally reported short error preserves its collector receipt and avoids a duplicate. A fresh equal-valued error or a manual reportError followed by a returned error remains a distinct boundary. Isolation covers entered execution and facade-owned stored captures. Caller arguments, temporaries and arbitrary by-value custom callback parameter destructors outside that execution follow the active setup. Moving a custom callable does not promise an inert moved-from destructor. Application is borrowed on UI and must not escape this facade's lifetime. Stop its external work with onStop before managed nodes/models retire; it does not grant worker-thread access. The borrow supplies UI services, not an independent runner: do not call Application::run directly.

◆ configure() [2/2]

template<detail::SceneConfiguration Callback>
Scene && portals::ui::Scene::configure ( Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackConfiguration callable accepted by the lvalue overload.
Parameters
callbackOwning configuration.
originRegistration call site.
Returns
Consuming owner for temporary fluent chains. The lvalue overload's boundary for custom callback parameter destruction also applies here.

◆ diagnostics()

std::expected< ManagedDiagnosticBatch, TreeError > portals::ui::Scene::diagnostics ( ) const
Returns
Existing collector snapshot, or the pre-owner primary and independent shutdown failure. The primary fallback is always retained; the optional shutdown diagnostic follows maxErrors and increments droppedErrors when that budget has no remaining slot. Notification flags are preserved. Allocation failure is NO_MEMORY. Snapshotting never prepares or reports an error.

◆ get() [1/2]

template<class T>
requires std::derived_from<T, Widget>
Ref< T > portals::ui::Scene::get ( std::string_view name,
std::source_location origin = std::source_location::current() )
Template Parameters
TPublic Widget subtype required by checked runtime conversion.
Parameters
nameCase-sensitive ID copied before deferred resolution.
originLookup site retained through typed publication.
Returns
Typed weak observation, never rebound after successful publication; errors stop startup.

◆ get() [2/2]

DynamicRef portals::ui::Scene::get ( std::string_view name,
std::source_location origin = std::source_location::current() )
Parameters
nameCase-sensitive ID copied before deferred resolution after mount.
originLookup call site retained in diagnostics.
Returns
Dynamic weak observation; missing/duplicate names stop startup before terminal acquisition. Does not prepare. Construction may allocate; foreign-thread/closed access yields a failed observation.

◆ managed()

std::expected< std::reference_wrapper< ManagedScene >, ManagedError > portals::ui::Scene::managed ( ) const
Returns
Borrowed prepared owner, or typed affinity/lifecycle error; does not prepare or record a failure. The reference is UI-only and must not outlive this facade. Runtime mutations use existing boundaries.

◆ onError() [1/2]

Scene & portals::ui::Scene::onError ( ManagedErrorHandler observer,
std::source_location origin = std::source_location::current() ) &
Parameters
observerOwning non-veto observer; exceptions remain separate from the original cause.
originRegistration call site retained on failure.
Returns
This owner; registration after sticky failure may deliver its pending notification once.

◆ onError() [2/2]

Scene && portals::ui::Scene::onError ( ManagedErrorHandler observer,
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
observerOwning observer.
originRegistration call site.
Returns
Consuming owner for temporary fluent chains.

◆ onKey() [1/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( const KeySelection & selection,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackExisting owning compact action, optionally taking const KeyEvent&.
Parameters
selectionImmutable owning alternatives; its native phase mask applies to each sequence stroke.
callbackAction transferred into deferred scene configuration.
originRegistration call site, independent of helper construction.
Returns
This owner, retaining typed helper errors in the existing collector.

◆ onKey() [2/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( const KeySelection & selection,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackExisting owning compact action, optionally taking const KeyEvent&.
Parameters
selectionImmutable owning alternatives; its native phase mask applies to each sequence stroke.
callbackAction transferred into deferred scene configuration.
originRegistration call site, independent of helper construction.
Returns
Consuming owner for temporary fluent chains.

◆ onKey() [3/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( KeyEvent chord,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackExisting compact void/expected<void, TreeError>/EditorCommandResult action.
Parameters
chordExact key/scalar/modifiers; PRESS and REPEAT retain the existing admission contract.
callbackOwning handler, optionally receiving the borrowed KeyEvent&.
originRegistration call site retained across lazy preparation.
Returns
This owner; delegates the existing bounded newest-match-first onKey composition.

◆ onKey() [4/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( KeyEvent chord,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackExisting compact key action.
Parameters
chordExact admitted chord.
callbackOwning handler.
originRegistration call site.
Returns
Consuming owner for temporary fluent chains.

◆ onKey() [5/16]

template<class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( KeySelection selection,
Info info,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
InfoConsuming annotated metadata.
CallbackExact managed action.
Parameters
selectionOwning shortcut receipt.
infoMetadata resolved after mount.
callbackOne canonical action.
originRegistration site.
Returns
This facade.

◆ onKey() [6/16]

template<class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( KeySelection selection,
Info info,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
InfoConsuming metadata.
CallbackExact managed action.
Parameters
selectionShortcut receipt.
infoMetadata.
callbackAction.
originCall site.
Returns
This consuming facade.

◆ onKey() [7/16]

template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( Source && source,
Callback callback,
ShortcutBehavior behavior,
ShortcutOptions options = {},
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
SourceConstexpr chord, owning alternatives or string-view-convertible runtime text.
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceShortcut source normalized and owned before deferral; no source text is retained.
callbackChecked action invoked at most once per matching event.
behaviorPRESS-only admission unless repeat is explicitly enabled.
optionsPositive finite parser budgets.
originRegistration call site preserved through setup and input diagnostics.
Returns
This owner. Newest registration wins through the existing managed input slot.

◆ onKey() [8/16]

template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( Source && source,
Callback callback,
ShortcutBehavior behavior,
ShortcutOptions options = {},
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
SourceConstexpr chord, owning alternatives or string-view-convertible runtime text.
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceShortcut source normalized and owned before deferral; no source text is retained.
callbackChecked action invoked at most once per matching event.
behaviorPRESS-only admission unless repeat is explicitly enabled.
optionsPositive finite parser budgets.
originRegistration call site preserved through setup and input diagnostics.
Returns
Consuming owner for fluent chains. Newest registration wins through the existing managed input slot.

◆ onKey() [9/16]

template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( Source && source,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
SourceConstexpr chord, owning alternatives or string-view-convertible runtime text.
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceShortcut source normalized and owned before deferral; no source text is retained.
callbackChecked action invoked at most once per matching event.
originRegistration call site preserved through setup and input diagnostics.
Returns
This owner. Newest registration wins through the existing managed input slot.

◆ onKey() [10/16]

template<portals::detail::ShortcutSource Source, class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( Source && source,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
SourceConstexpr chord, owning alternatives or string-view-convertible runtime text.
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceShortcut source normalized and owned before deferral; no source text is retained.
callbackChecked action invoked at most once per matching event.
originRegistration call site preserved through setup and input diagnostics.
Returns
Consuming owner for fluent chains. Newest registration wins through the existing managed input slot.

◆ onKey() [11/16]

template<portals::detail::ShortcutSource Source, class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( Source && source,
Info info,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
SourceExisting shortcut source.
InfoAnnotated metadata.
CallbackManaged action.
Parameters
sourceNormalized immediately.
infoDeferred metadata.
callbackAction.
originCall site.
Returns
This facade.

◆ onKey() [12/16]

template<portals::detail::ShortcutSource Source, class Info, class Callback>
requires std::same_as<std::remove_cvref_t<Info>, ui::KeyInfo> && portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( Source && source,
Info info,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
SourceExisting shortcut source.
InfoAnnotated metadata.
CallbackManaged action.
Parameters
sourceNormalized immediately.
infoDeferred metadata.
callbackAction.
originCall site.
Returns
This consuming facade.

◆ onKey() [13/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( std::initializer_list< key::Chord > source,
Callback callback,
ShortcutBehavior behavior,
ShortcutOptions options = {},
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceAlternatives borrowed for this call and copied before deferral.
callbackChecked action invoked at most once per matching event.
behaviorPRESS-only admission unless repeat is explicitly enabled.
optionsPositive finite parser budgets.
originRegistration call site preserved through setup and input diagnostics.
Returns
This owner. Newest registration wins through the existing managed input slot.

◆ onKey() [14/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( std::initializer_list< key::Chord > source,
Callback callback,
ShortcutBehavior behavior,
ShortcutOptions options = {},
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceAlternatives borrowed for this call and copied before deferral.
callbackChecked action invoked at most once per matching event.
behaviorPRESS-only admission unless repeat is explicitly enabled.
optionsPositive finite parser budgets.
originRegistration call site preserved through setup and input diagnostics.
Returns
Consuming owner for fluent chains. Newest registration wins through the existing managed input slot.

◆ onKey() [15/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene & portals::ui::Scene::onKey ( std::initializer_list< key::Chord > source,
Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceAlternatives borrowed for this call and copied before deferral.
callbackChecked action invoked at most once per matching event.
originRegistration call site preserved through setup and input diagnostics.
Returns
This owner. Newest registration wins through the existing managed input slot.

◆ onKey() [16/16]

template<class Callback = detail::QuitCommand>
requires portals::detail::ManagedAction<Callback, KeyEvent>
Scene && portals::ui::Scene::onKey ( std::initializer_list< key::Chord > source,
Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackOwning compact action optionally receiving a semantic KeyEvent.
Parameters
sourceAlternatives borrowed for this call and copied before deferral.
callbackChecked action invoked at most once per matching event.
originRegistration call site preserved through setup and input diagnostics.
Returns
Consuming owner for fluent chains. Newest registration wins through the existing managed input slot.

◆ onStop() [1/2]

template<detail::SceneStop Callback>
Scene & portals::ui::Scene::onStop ( Callback callback,
std::source_location origin = std::source_location::current() ) &
inline
Template Parameters
CallbackOwning zero-argument callable returning void or exactly expected<void, ManagedError>.
Parameters
callbackReplacement shutdown action, invoked once before managed root/model retirement, including failed preparation and an unprepared owner's close/destruction. Register before preparation when partial factory work requires cleanup. An earlier callback is retired without being invoked.
originRegistration site retained in shutdown diagnostics.
Returns
This owner. Exceptions become CLEANUP/NO_MEMORY or CALLBACK_FAILED; subtree cleanup still runs. Earlier setup/input/runner failures remain primary, with shutdown failure in cleanup. Runs on UI with empty current-scene/setup contexts. Scene and ManagedScene::run reentry return WOULD_BLOCK and cannot replace the shutdown outcome. Raw Application::run retains its existing no-hook-reentry precondition;

do not start it from shutdown. Captures retire before this owner's Application is released.

◆ onStop() [2/2]

template<detail::SceneStop Callback>
Scene && portals::ui::Scene::onStop ( Callback callback,
std::source_location origin = std::source_location::current() ) &&
inline
Template Parameters
CallbackShutdown callable accepted by the lvalue overload.
Parameters
callbackOwning shutdown action.
originRegistration site.
Returns
Consuming owner for temporary fluent chains, with the same lifetime/error contract.

◆ prepare() [1/2]

Scene & portals::ui::Scene::prepare ( std::source_location origin = std::source_location::current()) &
Parameters
originPreparation call site retained if this boundary fails.
Returns
This owner, preserving the first failure for checked()/run(). Does not open a terminal.

◆ prepare() [2/2]

Scene && portals::ui::Scene::prepare ( std::source_location origin = std::source_location::current()) &&
inline
Parameters
originPreparation call site.
Returns
Consuming owner for temporary fluent chains.

◆ prepareChecked()

std::expected< void, ManagedError > portals::ui::Scene::prepareChecked ( std::source_location origin = std::source_location::current())
Parameters
originPreparation call site retained in the collector.
Returns
Success for an already prepared scene, or first typed failure; no terminal I/O.

◆ quit()

std::expected< void, ManagedError > portals::ui::Scene::quit ( std::source_location origin = std::source_location::current())

Request orderly exit through the existing application cancellation path.

Parameters
originExit request call site.
Returns
Success, WRONG_THREAD, CLOSED, or sticky WOULD_BLOCK during notification/close; read-only reporting rejects with WOULD_BLOCK. Idempotent while live. Before complete preparation only the intent is retained; active callbacks finish normally and no widget or callback capture is retired by this call.

◆ ref()

SceneRef portals::ui::Scene::ref ( ) const
Returns
Weak UI observer of stable state; cleanup and moved-from owners produce CLOSED.

◆ reportOnError() [1/2]

Scene & portals::ui::Scene::reportOnError ( SceneReportHandler sink = {},
std::source_location origin = std::source_location::current() ) &
Parameters
sinkOwning copyable callable accepting const SceneReport&; empty restores the default stderr sink.
originRegistration call site retained on failure.
Returns
This owner. Independent of onError and its registration order; no delivery during registration. Capture construction before entry may throw. Explicitly borrowed services must outlive runApp.

◆ reportOnError() [2/2]

Scene && portals::ui::Scene::reportOnError ( SceneReportHandler sink = {},
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
sinkOwning copyable reporting sink, or empty for the default.
originRegistration call site.
Returns
Consuming owner for temporary fluent chains.

◆ run() [1/2]

std::expected< ApplicationStats, ManagedError > portals::ui::Scene::run ( ApplicationTerminal & terminal,
std::stop_token stop = {},
std::source_location origin = std::source_location::current() )
Parameters
terminalBorrowed existing headless/custom transport; must outlive this call.
stopOptional cancellation.
originRunner call site.
Returns
Same single-use result and cleanup policy as native run.

◆ run() [2/2]

std::expected< ApplicationStats, ManagedError > portals::ui::Scene::run ( std::stop_token stop = {},
std::source_location origin = std::source_location::current() )
Parameters
stopOptional worker-safe cancellation for the single admitted native run.
originRunner call site.
Returns
Statistics or first typed cause plus independent runner/cleanup errors; always closes after admission.

◆ runApp() [1/4]

int portals::ui::Scene::runApp ( ApplicationTerminal & terminal,
int argc,
const char *const * argv,
CommandLineParser parser,
std::stop_token stop = {},
std::source_location origin = std::source_location::current() )

Same preflight boundary with a borrowed custom terminal.

Parameters
terminalBorrowed transport, untouched for help/version or preflight failure.
argcNonnegative count, including the program name when present.
argvBorrowed array copied before invoking parser.
parserOwning parser, invoked synchronously on the scene's UI thread.
stopOptional runner cancellation.
originFinal call site.
Returns
Same zero/two/one status as the native command-line overload.

◆ runApp() [2/4]

int portals::ui::Scene::runApp ( ApplicationTerminal & terminal,
std::stop_token stop = {},
std::source_location origin = std::source_location::current() )
Parameters
terminalBorrowed custom/replay transport, outliving this call.
stopOptional cancellation.
originRunner call site.
Returns
Same exit status, cleanup and reporting policy as native runApp.

◆ runApp() [3/4]

int portals::ui::Scene::runApp ( int argc,
const char *const * argv,
CommandLineParser parser,
std::stop_token stop = {},
std::source_location origin = std::source_location::current() )

Parse copied process arguments once before preparing the application or mounting widgets.

Parameters
argcArgument count including the program name.
argvArguments borrowed only for the initialization copy.
parserOwning lazy parser; exceptions become typed command-line failures.
stopOptional runner cancellation.
originFinal call site.
Returns
Zero for successful run/help/version, two for command-line failure, one for runtime failure.

◆ runApp() [4/4]

int portals::ui::Scene::runApp ( std::stop_token stop = {},
std::source_location origin = std::source_location::current() )

Run a standalone scene with standard post-restoration error reporting.

Parameters
stopOptional worker-safe cancellation.
originRunner call site.
Returns
Zero on successful run, one on a typed failure. reportOnError selects diagnostic delivery. Recoverable-only reports preserve zero status and receive an aggregate summary by default. onError remains the independent operation-reaction channel; the final report is delivered once. Wrong-thread/moved-from calls return one quietly; typed run()/checked() retain their boundary cause.

◆ start()

std::expected< void, ManagedError > portals::ui::Scene::start ( ApplicationReadyTerminal & terminal,
std::stop_token stop = {},
std::source_location origin = std::source_location::current() )
Parameters
terminalReady-only transport borrowed until terminal step or scene destruction.
stopCooperative cancellation retained by the application.
originStart call site retained in diagnostics.
Returns
Success or first typed cause with cleanup details. UI-only and single-use.

◆ step()

std::expected< ApplicationStep, ManagedError > portals::ui::Scene::step ( std::source_location origin = std::source_location::current())
Parameters
originStep call site retained in diagnostics.
Returns
Bounded ready progress or retained terminal result. No current-scene context escapes the call. Reentry and calls before start are rejected without poisoning an active session.

◆ style() [1/4]

Scene & portals::ui::Scene::style ( const StyleStage & stage,
std::source_location origin = std::source_location::current() ) &
Parameters
stageImmutable owning style payload and stage identity.
originRegistration site retained for deferred parse/read/admission failures.
Returns
This owner after registration through the existing atomic styleDocument boundary.

◆ style() [2/4]

Scene && portals::ui::Scene::style ( const StyleStage & stage,
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
stageImmutable owning style payload/identity.
originRegistration site.
Returns
Consuming owner after the same checked registration.

◆ style() [3/4]

template<class Source>
requires std::constructible_from<StyleStage, Source &&, const StyleOptions &, std::source_location>
Scene & portals::ui::Scene::style ( Source && source,
const StyleOptions & options,
std::source_location origin = std::source_location::current() ) &
Template Parameters
SourceInput accepted by an owning StyleStage constructor, available in ui_style.hpp.
Parameters
sourceRuntime bytes, checked descriptor, document or explicit file source.
optionsExisting style admission/source policy.
originRegistration site.
Returns
This owner after the common stage path; source/stage construction may throw before entry.

◆ style() [4/4]

template<class Source>
requires std::constructible_from<StyleStage, Source &&, const StyleOptions &, std::source_location>
Scene && portals::ui::Scene::style ( Source && source,
const StyleOptions & options,
std::source_location origin = std::source_location::current() ) &&
Template Parameters
SourceInput accepted by an owning StyleStage constructor.
Parameters
sourceBytes/descriptor/document/file source.
optionsExisting style policy.
originRegistration site.
Returns
Consuming owner after the same registration path.

◆ styleLayer() [1/2]

Scene & portals::ui::Scene::styleLayer ( StyleTier tier,
std::string name,
StyleSheet sheet,
std::source_location origin = std::source_location::current() ) &

Add one scene-owned override; enable styleLayers() before this configuration.

Parameters
tierAPPLICATION or USER cascade tier; base slots use their explicit managed operations.
nameOwning tier-unique layer name, retained until explicit removal or scene cleanup.
sheetOwning rules, independent of the theme slot and retained by the existing style engine.
originConfiguration call site retained on typed failure.
Returns
This owner. The collector retains errors; use managed().addLayer when a removal handle is needed. Argument construction may throw before entry; copies within the facade are captured as typed errors.

◆ styleLayer() [2/2]

Scene && portals::ui::Scene::styleLayer ( StyleTier tier,
std::string name,
StyleSheet sheet,
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
tierAPPLICATION or USER cascade tier.
nameOwning layer name.
sheetOwning override rules.
originConfiguration call site.
Returns
Consuming owner for temporary fluent chains.

◆ styleLayers() [1/2]

Scene & portals::ui::Scene::styleLayers ( StyleLayerOptions options = {},
std::source_location origin = std::source_location::current() ) &

Opt into independent theme/application/user ownership at the existing configuration boundary.

Parameters
optionsAggregate logical layer budgets, including the two permanent base slots.
originConfiguration call site retained in the collector on failure.
Returns
This owner; queued before prepare, applied immediately afterwards without terminal I/O. The successful transition revokes existing legacy LiveTheme controllers. Equal options are a no-op.

◆ styleLayers() [2/2]

Scene && portals::ui::Scene::styleLayers ( StyleLayerOptions options = {},
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
optionsAggregate logical layer budgets.
originConfiguration call site.
Returns
Consuming owner for temporary fluent chains.

◆ theme() [1/2]

Scene & portals::ui::Scene::theme ( StyleSheet sheet,
std::source_location origin = std::source_location::current() ) &
Parameters
sheetOwning replacement theme; stored before prepare, delegated afterwards.
originMutation call site retained on failure.
Returns
This owner. Permitted runtime theme changes use existing managed boundaries.

◆ theme() [2/2]

Scene && portals::ui::Scene::theme ( StyleSheet sheet,
std::source_location origin = std::source_location::current() ) &&
inline
Parameters
sheetOwning replacement theme.
originMutation call site.
Returns
Consuming owner for temporary fluent chains.

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