|
Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
|
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 |
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.
|
noexcept |
Transfer a UI-affine owner between operations, including between session steps. Wrong-thread moves and moves from inside an operation or callback terminate.
| other | Source owner, left empty with checked CLOSED results. |
| 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.
| provider | Owning callback; borrowed captures must outlive synchronous preparation. |
| origin | Registration call site. |
| std::expected< void, ManagedError > portals::ui::Scene::checked | ( | ) | const |
| std::expected< void, ManagedError > portals::ui::Scene::close | ( | std::source_location | origin = std::source_location::current() | ) |
| origin | Cleanup call site. |
|
inline |
| Callback | Owning action taking ManagedScene&, optionally followed by Application&, returning void or exactly expected<void, ManagedError>. The one-argument form has priority. |
| callback | Configuration invoked once, in registration order after complete mount. |
| origin | Registration call site retained across lazy preparation. |
|
inline |
| Callback | Configuration callable accepted by the lvalue overload. |
| callback | Owning configuration. |
| origin | Registration call site. |
| std::expected< ManagedDiagnosticBatch, TreeError > portals::ui::Scene::diagnostics | ( | ) | const |
| Ref< T > portals::ui::Scene::get | ( | std::string_view | name, |
| std::source_location | origin = std::source_location::current() ) |
| T | Public Widget subtype required by checked runtime conversion. |
| name | Case-sensitive ID copied before deferred resolution. |
| origin | Lookup site retained through typed publication. |
| DynamicRef portals::ui::Scene::get | ( | std::string_view | name, |
| std::source_location | origin = std::source_location::current() ) |
| name | Case-sensitive ID copied before deferred resolution after mount. |
| origin | Lookup call site retained in diagnostics. |
| std::expected< std::reference_wrapper< ManagedScene >, ManagedError > portals::ui::Scene::managed | ( | ) | const |
| Scene & portals::ui::Scene::onError | ( | ManagedErrorHandler | observer, |
| std::source_location | origin = std::source_location::current() ) & |
| observer | Owning non-veto observer; exceptions remain separate from the original cause. |
| origin | Registration call site retained on failure. |
|
inline |
| observer | Owning observer. |
| origin | Registration call site. |
|
inline |
| Callback | Existing owning compact action, optionally taking const KeyEvent&. |
| selection | Immutable owning alternatives; its native phase mask applies to each sequence stroke. |
| callback | Action transferred into deferred scene configuration. |
| origin | Registration call site, independent of helper construction. |
|
inline |
| Callback | Existing owning compact action, optionally taking const KeyEvent&. |
| selection | Immutable owning alternatives; its native phase mask applies to each sequence stroke. |
| callback | Action transferred into deferred scene configuration. |
| origin | Registration call site, independent of helper construction. |
|
inline |
| Callback | Existing compact void/expected<void, TreeError>/EditorCommandResult action. |
| chord | Exact key/scalar/modifiers; PRESS and REPEAT retain the existing admission contract. |
| callback | Owning handler, optionally receiving the borrowed KeyEvent&. |
| origin | Registration call site retained across lazy preparation. |
|
inline |
| Callback | Existing compact key action. |
| chord | Exact admitted chord. |
| callback | Owning handler. |
| origin | Registration call site. |
|
inline |
| Info | Consuming annotated metadata. |
| Callback | Exact managed action. |
| selection | Owning shortcut receipt. |
| info | Metadata resolved after mount. |
| callback | One canonical action. |
| origin | Registration site. |
|
inline |
|
inline |
| Source | Constexpr chord, owning alternatives or string-view-convertible runtime text. |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Shortcut source normalized and owned before deferral; no source text is retained. |
| callback | Checked action invoked at most once per matching event. |
| behavior | PRESS-only admission unless repeat is explicitly enabled. |
| options | Positive finite parser budgets. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Source | Constexpr chord, owning alternatives or string-view-convertible runtime text. |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Shortcut source normalized and owned before deferral; no source text is retained. |
| callback | Checked action invoked at most once per matching event. |
| behavior | PRESS-only admission unless repeat is explicitly enabled. |
| options | Positive finite parser budgets. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Source | Constexpr chord, owning alternatives or string-view-convertible runtime text. |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Shortcut source normalized and owned before deferral; no source text is retained. |
| callback | Checked action invoked at most once per matching event. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Source | Constexpr chord, owning alternatives or string-view-convertible runtime text. |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Shortcut source normalized and owned before deferral; no source text is retained. |
| callback | Checked action invoked at most once per matching event. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Source | Existing shortcut source. |
| Info | Annotated metadata. |
| Callback | Managed action. |
| source | Normalized immediately. |
| info | Deferred metadata. |
| callback | Action. |
| origin | Call site. |
|
inline |
| Source | Existing shortcut source. |
| Info | Annotated metadata. |
| Callback | Managed action. |
| source | Normalized immediately. |
| info | Deferred metadata. |
| callback | Action. |
| origin | Call site. |
|
inline |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Alternatives borrowed for this call and copied before deferral. |
| callback | Checked action invoked at most once per matching event. |
| behavior | PRESS-only admission unless repeat is explicitly enabled. |
| options | Positive finite parser budgets. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Alternatives borrowed for this call and copied before deferral. |
| callback | Checked action invoked at most once per matching event. |
| behavior | PRESS-only admission unless repeat is explicitly enabled. |
| options | Positive finite parser budgets. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Alternatives borrowed for this call and copied before deferral. |
| callback | Checked action invoked at most once per matching event. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Callback | Owning compact action optionally receiving a semantic KeyEvent. |
| source | Alternatives borrowed for this call and copied before deferral. |
| callback | Checked action invoked at most once per matching event. |
| origin | Registration call site preserved through setup and input diagnostics. |
|
inline |
| Callback | Owning zero-argument callable returning void or exactly expected<void, ManagedError>. |
| callback | Replacement 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. |
| origin | Registration site retained in shutdown diagnostics. |
do not start it from shutdown. Captures retire before this owner's Application is released.
|
inline |
| Callback | Shutdown callable accepted by the lvalue overload. |
| callback | Owning shutdown action. |
| origin | Registration site. |
| Scene & portals::ui::Scene::prepare | ( | std::source_location | origin = std::source_location::current() | ) | & |
| origin | Preparation call site retained if this boundary fails. |
|
inline |
| origin | Preparation call site. |
| std::expected< void, ManagedError > portals::ui::Scene::prepareChecked | ( | std::source_location | origin = std::source_location::current() | ) |
| origin | Preparation call site retained in the collector. |
| 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.
| origin | Exit request call site. |
| SceneRef portals::ui::Scene::ref | ( | ) | const |
| Scene & portals::ui::Scene::reportOnError | ( | SceneReportHandler | sink = {}, |
| std::source_location | origin = std::source_location::current() ) & |
| sink | Owning copyable callable accepting const SceneReport&; empty restores the default stderr sink. |
| origin | Registration call site retained on failure. |
|
inline |
| sink | Owning copyable reporting sink, or empty for the default. |
| origin | Registration call site. |
| std::expected< ApplicationStats, ManagedError > portals::ui::Scene::run | ( | ApplicationTerminal & | terminal, |
| std::stop_token | stop = {}, | ||
| std::source_location | origin = std::source_location::current() ) |
| terminal | Borrowed existing headless/custom transport; must outlive this call. |
| stop | Optional cancellation. |
| origin | Runner call site. |
| std::expected< ApplicationStats, ManagedError > portals::ui::Scene::run | ( | std::stop_token | stop = {}, |
| std::source_location | origin = std::source_location::current() ) |
| stop | Optional worker-safe cancellation for the single admitted native run. |
| origin | Runner call site. |
| 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.
| terminal | Borrowed transport, untouched for help/version or preflight failure. |
| argc | Nonnegative count, including the program name when present. |
| argv | Borrowed array copied before invoking parser. |
| parser | Owning parser, invoked synchronously on the scene's UI thread. |
| stop | Optional runner cancellation. |
| origin | Final call site. |
| int portals::ui::Scene::runApp | ( | ApplicationTerminal & | terminal, |
| std::stop_token | stop = {}, | ||
| std::source_location | origin = std::source_location::current() ) |
| terminal | Borrowed custom/replay transport, outliving this call. |
| stop | Optional cancellation. |
| origin | Runner call site. |
| 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.
| argc | Argument count including the program name. |
| argv | Arguments borrowed only for the initialization copy. |
| parser | Owning lazy parser; exceptions become typed command-line failures. |
| stop | Optional runner cancellation. |
| origin | Final call site. |
| 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.
| stop | Optional worker-safe cancellation. |
| origin | Runner call site. |
| std::expected< void, ManagedError > portals::ui::Scene::start | ( | ApplicationReadyTerminal & | terminal, |
| std::stop_token | stop = {}, | ||
| std::source_location | origin = std::source_location::current() ) |
| terminal | Ready-only transport borrowed until terminal step or scene destruction. |
| stop | Cooperative cancellation retained by the application. |
| origin | Start call site retained in diagnostics. |
| std::expected< ApplicationStep, ManagedError > portals::ui::Scene::step | ( | std::source_location | origin = std::source_location::current() | ) |
| origin | Step call site retained in diagnostics. |
| Scene & portals::ui::Scene::style | ( | const StyleStage & | stage, |
| std::source_location | origin = std::source_location::current() ) & |
| stage | Immutable owning style payload and stage identity. |
| origin | Registration site retained for deferred parse/read/admission failures. |
|
inline |
| stage | Immutable owning style payload/identity. |
| origin | Registration site. |
| Scene & portals::ui::Scene::style | ( | Source && | source, |
| const StyleOptions & | options, | ||
| std::source_location | origin = std::source_location::current() ) & |
| Source | Input accepted by an owning StyleStage constructor, available in ui_style.hpp. |
| source | Runtime bytes, checked descriptor, document or explicit file source. |
| options | Existing style admission/source policy. |
| origin | Registration site. |
| Scene && portals::ui::Scene::style | ( | Source && | source, |
| const StyleOptions & | options, | ||
| std::source_location | origin = std::source_location::current() ) && |
| Source | Input accepted by an owning StyleStage constructor. |
| source | Bytes/descriptor/document/file source. |
| options | Existing style policy. |
| origin | Registration site. |
| 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.
| tier | APPLICATION or USER cascade tier; base slots use their explicit managed operations. |
| name | Owning tier-unique layer name, retained until explicit removal or scene cleanup. |
| sheet | Owning rules, independent of the theme slot and retained by the existing style engine. |
| origin | Configuration call site retained on typed failure. |
|
inline |
| tier | APPLICATION or USER cascade tier. |
| name | Owning layer name. |
| sheet | Owning override rules. |
| origin | Configuration call site. |
| 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.
| options | Aggregate logical layer budgets, including the two permanent base slots. |
| origin | Configuration call site retained in the collector on failure. |
|
inline |
| options | Aggregate logical layer budgets. |
| origin | Configuration call site. |
| Scene & portals::ui::Scene::theme | ( | StyleSheet | sheet, |
| std::source_location | origin = std::source_location::current() ) & |
| sheet | Owning replacement theme; stored before prepare, delegated afterwards. |
| origin | Mutation call site retained on failure. |
|
inline |
| sheet | Owning replacement theme. |
| origin | Mutation call site. |