5#include <portals/dialog.hpp>
6#include <portals/theme_selection.hpp>
14namespace portals::ui {
16template <
class T>
class Ref;
19struct ThemeSelectorTarget;
20struct ThemeSelectorAccess;
24enum class ThemeSelectorCloseDisposition {
38 ThemeSelectorCloseDisposition
closeDisposition{ThemeSelectorCloseDisposition::NOT_ATTEMPTED};
56 std::function<std::expected<std::string, TextResourceError>(std::string_view)>
64 std::function<std::expected<void, ManagedError>(std::string_view)>
onCommitted;
87 std::expected<void, ManagedError>
open(std::source_location origin = std::source_location::current())
const;
93 std::expected<void, ManagedError>
preview(std::string_view
id,
94 std::source_location origin = std::source_location::current())
const;
99 std::expected<void, ManagedError>
commit(std::source_location origin = std::source_location::current())
const;
108 std::expected<void, ManagedError>
apply(std::source_location origin = std::source_location::current())
const;
111 std::expected<void, ManagedError>
cancel(std::source_location origin = std::source_location::current())
const;
113 std::expected<void, ManagedError>
122 friend struct detail::ThemeSelectorAccess;
123 std::shared_ptr<detail::ThemeSelectorTarget> target_;
149Description<Dialog> themeSelector(ThemeSelectorRef reference, ThemeSelectionRef model,
150 ThemeSelectorOptions options = {});
161template <std::
size_t N>
163Description<Dialog> themeSelector(ThemeSelectorRef reference,
const ThemeChoice (&choices)[N],
164 ThemeSelectorOptions options = {});
173template <
class Catalog>
Owning literal bytes or a resource key, measured only at resolution.
Definition text_value.hpp:42
Single-use owning construction recipe; no mounted widget ownership.
Definition ui_description.hpp:48
Ref(ThemeSelectorRef reference) noexcept
Definition theme_selector.hpp:139
Ref()=default
Create the existing cold selector identity; construction may throw std::bad_alloc.
Typed Widget observation; explicit composite specializations reuse their existing weak facades.
Definition ui_ref.hpp:761
Weak UI-affine observation of one scene-owned selector view. Commands are checked only: they never re...
Definition theme_selector.hpp:82
ThemeSelectorRef()
Create a cold identity; allocation may throw before a scene owner exists.
std::expected< void, ManagedError > closeKeepingPreview(std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > apply(std::source_location origin=std::source_location::current()) const
std::expected< std::shared_ptr< const ThemeSelectionSnapshot >, ManagedError > snapshot() 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 ThemeApplyOutcome >, ManagedError > lastApply() const
std::expected< void, ManagedError > open(std::source_location origin=std::source_location::current()) const
std::expected< void, ManagedError > cancel(std::source_location origin=std::source_location::current()) const
Public Portals API.
Definition action.hpp:8
ui::ThemeSelectorRef ThemeSelector
Canonical composite facade type for ui::Ref<ThemeSelector>; exactly the legacy ui::ThemeSelectorRef....
Definition theme_selector.hpp:182
Owning panel geometry and managed input settings, in terminal cells.
Definition dialog.hpp:52
Original error plus independent runner/restoration and cleanup failures.
Definition managed_diagnostics.hpp:62
Owning limits checked without silently truncating input or clusters.
Definition text.hpp:57
One immutable owning completed Apply result, independent of the view lifetime. Both error slots prese...
Definition theme_selector.hpp:34
std::optional< ManagedError > callbackError
Original optional persistence callback failure.
Definition theme_selector.hpp:39
ThemeSelectorCloseDisposition closeDisposition
Actual final state.
Definition theme_selector.hpp:38
~ThemeApplyOutcome()=default
Retain fallible owning ID copies with checked standard-library configurations.
std::string committedId
Successfully committed application catalog ID.
Definition theme_selector.hpp:37
std::optional< ManagedError > closeError
Independent full view-close failure; never replaces callback cleanup.
Definition theme_selector.hpp:40
Finite normalization budgets and optional first-preview layer admission.
Definition theme_selection.hpp:77
Advanced owning catalog settings for a selector with its scene-owned default model....
Definition theme_selector.hpp:70
~ThemeSelectorCatalog()=default
Keep owning input transfers fallible with checked standard-library containers.
std::vector< ThemeChoice > choices
Copied synchronous catalog, normalized once before creating the view.
Definition theme_selector.hpp:73
ThemeSelectionOptions selection
Existing normalization budgets, resolver and first-preview layers.
Definition theme_selector.hpp:74
std::optional< std::string > initialId
Optional startup preview+commit after scene configuration; no callback.
Definition theme_selector.hpp:75
Owning selector captions, established dialog settings and optional application delivery.
Definition theme_selector.hpp:44
TextValue title
Owning dialog title, resolved during mounting.
Definition theme_selector.hpp:48
DialogOptions dialog
Existing modal geometry defaults; eager Escape is disabled by this composition.
Definition theme_selector.hpp:47
TextValue conflictStatus
Superseded status.
Definition theme_selector.hpp:54
TextValue cancel
Owning checked-restoration caption.
Definition theme_selector.hpp:50
std::function< std::expected< std::string, TextResourceError >(std::string_view)> textResolver
Local mount resolver.
Definition theme_selector.hpp:57
TextValue emptyStatus
No currently selected active choice.
Definition theme_selector.hpp:52
TextValue apply
Owning Apply caption.
Definition theme_selector.hpp:49
std::function< std::expected< void, ManagedError >(std::string_view)> onCommitted
Optional synchronous UI callback, invoked once after a successful guarded commit. The ID borrow expir...
Definition theme_selector.hpp:64
std::optional< std::string > openingShortcut
Canonical text; absent disables binding.
Definition theme_selector.hpp:58
TextValue errorStatus
Bounded recoverable status.
Definition theme_selector.hpp:53
TextValue closeKeepingPreview
Explicit hide-only recovery action.
Definition theme_selector.hpp:51
TextLimits textLimits
Positive validation limits for each caption/status.
Definition theme_selector.hpp:55
~ThemeSelectorOptions()=default
Keep owning option/callback transfers fallible.