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

Weak UI-affine observation of one scene-owned selector view. Commands are checked only: they never report, remember or stop the application. Built-in controls use report-only diagnostics separately. Copy/destruction never restores a theme. An active model may outlive a retired view. More...

#include <theme_selector.hpp>

Inheritance diagram for portals::ui::ThemeSelectorRef:
portals::ui::ThemeSelectorRefportals::ui::ThemeSelectorRef portals::ui::Ref< ThemeSelectorRef >

Public Member Functions

 ThemeSelectorRef ()
 Create a cold identity; allocation may throw before a scene owner exists.
std::expected< void, ManagedError > open (std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > preview (std::string_view id, std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > commit (std::source_location origin=std::source_location::current()) const
std::expected< std::shared_ptr< const ThemeSelectionSnapshot >, ManagedError > snapshot () const
std::expected< void, ManagedError > apply (std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > cancel (std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > closeKeepingPreview (std::source_location origin=std::source_location::current()) const
std::expected< std::shared_ptr< const ThemeApplyOutcome >, ManagedError > lastApply () const

Friends

struct detail::ThemeSelectorAccess

Detailed Description

Weak UI-affine observation of one scene-owned selector view. Commands are checked only: they never report, remember or stop the application. Built-in controls use report-only diagnostics separately. Copy/destruction never restores a theme. An active model may outlive a retired view.

Member Function Documentation

◆ apply()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::apply ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal checked command site.
Returns
Guarded commit, once-only callback and close; callback error takes precedence over close error. Precommit rejection preserves lastApply. Reentry during transition is WOULD_BLOCK.

◆ cancel()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::cancel ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal checked command site.
Returns
Checked restoration before close; failure leaves view usable.

◆ closeKeepingPreview()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::closeKeepingPreview ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal checked command site.
Returns
Hide only, retaining the model preview/session.

◆ commit()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::commit ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal checked command site.
Returns
Existing model commit result; does not close the view, call onCommitted or replace lastApply. Use apply() for the selected UI choice and its once-only callback/close outcome.

◆ lastApply()

std::expected< std::shared_ptr< const ThemeApplyOutcome >, ManagedError > portals::ui::ThemeSelectorRef::lastApply ( ) const
Returns
Allocation-free owning completed result; null success before any committed Apply. UI-affine metadata remains readable after view/scene retirement. During transition the previous result survives. This query owns no scene, widget or callback.

◆ open()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::open ( std::source_location origin = std::source_location::current()) const
Parameters
originOriginal checked command site.
Returns
Open/refocus without invoking a factory, or full failure.

◆ preview()

std::expected< void, ManagedError > portals::ui::ThemeSelectorRef::preview ( std::string_view id,
std::source_location origin = std::source_location::current() ) const
Parameters
idExact catalog ID, borrowed only for the existing synchronous model preview.
originOriginal checked command site.
Returns
Existing model preview result without opening the view or selecting a different UI row. An independently selected UI row remains protected by Apply's expected-ID guard.

◆ snapshot()

std::expected< std::shared_ptr< const ThemeSelectionSnapshot >, ManagedError > portals::ui::ThemeSelectorRef::snapshot ( ) const
Returns
Owning current model metadata, or full checked affinity/lifetime/transition failure. Requires this live attached view; retained immutable snapshots remain usable after scene retirement.

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