Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
ui_scene_resource.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <portals/ui_controls.hpp>
6#include <portals/ui_dialogs.hpp>
7#include <portals/ui_find_bar.hpp>
8#include <portals/ui_form_field.hpp>
9#include <portals/ui_layout.hpp>
10#include <portals/ui_menu.hpp>
11#include <portals/ui_modifiers.hpp>
12#include <portals/ui_password_controls.hpp>
13#include <portals/ui_primitives.hpp>
14#include <portals/ui_scene_pipeline.hpp>
15#include <portals/ui_slider.hpp>
16#include <portals/ui_spin_box.hpp>
17#include <portals/ui_virtual.hpp>
18
19#include <filesystem>
20
21namespace portals::ui {
23
25enum class SceneResourceFormat {
26 LEGACY,
27 CONFIGURATION
28};
29
32 std::size_t maxSourceBytes{1024 * 1024};
33 std::size_t maxNodes{4096};
34 std::size_t maxDepth{64};
35 std::size_t maxStringBytes{64 * 1024};
36 std::size_t maxProperties{16};
37};
38
43
44 std::string text = std::string(0, '\0');
45 std::string id = std::string(0, '\0');
46 std::optional<std::int32_t> width;
47 std::optional<std::int32_t> height;
48 std::optional<std::uint32_t> flex;
49 std::int32_t gap{};
50 bool checked{};
52 std::optional<bool> visible;
53 std::optional<bool> enabled;
54 std::optional<std::string> classes;
55 std::optional<std::int32_t> weight;
56 std::optional<std::int32_t> cells;
57};
58
59namespace detail {
60struct ResourceAccess;
61
65 friend struct ResourceAccess;
66
67 std::optional<std::pair<SceneResourceErrorCode, TreeError>> failure_;
68};
69
74template <class T, class Factory>
76 std::derived_from<T, Widget> && std::copy_constructible<Factory> &&
77 requires(Factory &factory, SceneResourceArguments arguments) {
78 requires std::same_as<std::invoke_result_t<Factory &, SceneResourceArguments>, Description<T>> ||
79 std::same_as<std::invoke_result_t<Factory &, SceneResourceArguments>,
80 std::expected<Description<T>, ManagedError>>;
81 std::invoke(factory, std::move(arguments));
82 };
83} // namespace detail
84
91public:
98 std::expected<void, SceneResourceErrorCode> popupMenu(std::string_view name, Ref<PopupMenu> reference,
99 std::initializer_list<PopupEntry> entries,
100 PopupMenuOptions options = {}) {
101 std::vector<PopupEntry> owning(entries);
102 auto declarations =
103 std::make_shared<Description<PopupMenu>>(detail::popupMenuRecipe(owning, options, {}, DEFAULT_MENU_POLICY));
104
105 return add<PopupMenu>(
106 name,
107 [reference, owning = std::move(owning), options,
108 declarations](SceneResourceArguments arguments) -> std::expected<Description<PopupMenu>, ManagedError> {
109 // Keep cold action stores alive even when the binding factory's local ActionSet has returned.
110 (void)declarations;
111 auto effective = options;
112 auto frame = detail::controlFrameOptions(arguments.settings, effective.frame, {});
113
114 if (!frame) {
115 return std::unexpected(frame.error());
116 }
117
118 if (*frame) {
119 effective.frame = **frame;
120 }
121
122 return detail::popupMenuRecipe(owning, effective, {}, DEFAULT_MENU_POLICY).reference(reference);
123 });
124 }
125
128
131
145 template <class T, class Factory>
147 std::expected<void, SceneResourceErrorCode> add(std::string_view name, Factory factory, bool children = false) {
148 return insert(makeEntry<T>(name, std::move(factory), children));
149 }
150
162 template <class T, class Factory, class Schema>
164 std::same_as<std::remove_cvref_t<Schema>, std::span<const ControlPropertyDescriptor>>
165 std::expected<void, SceneResourceErrorCode> add(std::string_view name, Factory factory, Schema &&schema) {
166 const auto semantic = semanticSchema(schema);
167
168 if (!semantic) {
169 return std::unexpected(SceneResourceErrorCode::INVALID_VALUE);
170 }
171
172 auto entry = makeEntry<T>(name, std::move(factory), false, *semantic);
173
174 entry.text = false;
175 entry.sized = *semantic == detail::ControlFactoryKind::NOTIFICATION_BINDING;
176 entry.factoryKind = *semantic;
177 entry.semanticPropertyCount = schema.size();
178
179 if (*semantic == detail::ControlFactoryKind::MESSAGE_BINDING) {
180 const auto choice = std::ranges::find(schema, "message.defaultChoice.value", &ControlPropertyDescriptor::path);
181
182 entry.messageChoiceCount = choice->enumNames.size();
183 }
184
185 return insert(std::move(entry));
186 }
187
188private:
189 friend struct detail::ResourceAccess;
190
191 static std::optional<detail::ControlFactoryKind>
192 semanticSchema(std::span<const ControlPropertyDescriptor> schema) noexcept;
193
194 struct Entry {
195 ~Entry() = default;
196
197 std::string name = std::string(0, '\0');
198 bool children{};
199 bool sized{};
200 bool text{true};
201 bool gap{};
202 bool checked{};
203 bool protectedEditor{};
204 bool declaredHelp{};
205 bool unknownHelp{};
206 bool declaredDialog{};
207 bool declaredHost{};
208 bool declaredChoice{};
209 bool declaredSwitch{};
210 bool declaredRadio{};
211 bool unknownDialog{};
212 std::string_view virtualView{};
213 std::optional<std::size_t> semanticPropertyCount{};
214 std::size_t messageChoiceCount{};
215 detail::ControlFactoryKind factoryKind{detail::ControlFactoryKind::USER};
216 std::function<std::expected<Description<Widget>, ManagedError>(SceneResourceArguments)> create;
217 };
218
219 // Shared cold adapter construction; public add<T> retains its exact factory and common-property semantics.
220 template <class T, class Factory>
221 requires detail::ResourceFactory<T, std::remove_cvref_t<Factory>>
222 static Entry makeEntry(std::string_view name, Factory &&factory, bool children = false,
223 detail::ControlFactoryKind semantic = detail::ControlFactoryKind::USER) {
224 Entry entry;
225
226 entry.name = name;
227 entry.children = children;
228 entry.sized = std::derived_from<T, SizedWidget>;
229 entry.protectedEditor = std::same_as<T, Password>;
230 entry.declaredSwitch = std::same_as<T, Switch>;
231 if constexpr (std::same_as<T, Switch>) {
232 entry.checked = true;
233 }
234 entry.declaredHelp = std::derived_from<T, HelpView>;
235 entry.unknownHelp = std::same_as<T, Widget>;
236 entry.declaredDialog = std::derived_from<T, Dialog>;
237 entry.declaredHost = std::derived_from<T, OverlayHost>;
238 entry.declaredChoice = std::derived_from<T, ComboBox>;
239 entry.declaredRadio = std::same_as<T, RadioGroup>;
240 if constexpr (std::same_as<T, RadioGroup>) {
241 entry.text = false;
242 }
243 entry.unknownDialog = std::same_as<T, Widget>;
244
245 if constexpr (std::derived_from<T, Slider>) {
246 entry.text = false;
247 entry.virtualView = "Slider"; // Reuse the cold native-schema identity slot, without new registry payload.
248 } else if constexpr (std::same_as<T, SpinBox>) {
249 entry.virtualView = "SpinBox";
250 }
251
252 if constexpr (detail::IsVirtualList<T>::value || detail::IsVirtualTable<T>::value || detail::IsChart<T>::value) {
253 entry.virtualView = detail::Access::controlType<T>();
254 }
255
256 entry.create = [factory = std::forward<Factory>(factory), semantic](
257 SceneResourceArguments arguments) mutable -> std::expected<Description<Widget>, ManagedError> {
258 // Common properties remain existing typed recipe operations before erasure.
259 const auto sizing = detail::controlSizing(arguments.settings);
260
261 if constexpr (!std::derived_from<T, SizedWidget>) {
262 if (semantic != detail::ControlFactoryKind::NOTIFICATION_BINDING && (sizing.width || sizing.height)) {
263 return std::unexpected(detail::frameContextError(ControlContextErrorCode::UNSUPPORTED_PROPERTY, "sizing"));
264 }
265 }
266 const auto switchState = arguments.settings.state;
267 const auto switchCycle = arguments.settings.cycle;
268 const auto switchReadOnly = arguments.settings.readOnly;
269 const auto switchOrigin = arguments.settings.origin;
270 std::vector<ControlPropertyOrigin> switchOrigins(0);
271
272 if constexpr (std::same_as<T, Switch>) {
273 for (const auto path : {"state", "cycle", "readOnly"}) {
274 const bool present = path == std::string_view("state") ? switchState.has_value()
275 : path == std::string_view("cycle") ? switchCycle.has_value()
276 : switchReadOnly.has_value();
277
278 if (!present) {
279 continue;
280 }
281
282 const auto found = std::ranges::find(arguments.settings.origins, path, &ControlPropertyOrigin::path);
283 switchOrigins.push_back(
284 {std::string(path), found == arguments.settings.origins.end() ? switchOrigin : found->source});
285 }
286 }
287 const auto visible = arguments.visible;
288 const auto enabled = arguments.enabled;
289 const auto classes = arguments.classes;
290 const auto materialized = detail::controlSettingsPresenceSet(arguments.settings);
291 std::optional<ControlSettings> numericSettings;
292
293 if constexpr (std::derived_from<T, Slider> || std::same_as<T, SpinBox>) {
294 numericSettings.emplace();
295 auto &patch = *numericSettings;
296 const auto &source = arguments.settings;
297
298 patch.value = source.value;
299 patch.minimum = source.minimum;
300 patch.maximum = source.maximum;
301 patch.step = source.step;
302 patch.pageSteps = source.pageSteps;
303 patch.readOnly = source.readOnly;
304 patch.preferredWidth = source.preferredWidth;
305 patch.maxPaintCells = source.maxPaintCells;
306 patch.sliderSkin = source.sliderSkin;
307 if constexpr (std::derived_from<T, Slider>) {
308 patch.sliderTrack = source.sliderTrack;
309 patch.sliderFill = source.sliderFill;
310 patch.sliderThumb = source.sliderThumb;
311 }
312 if constexpr (std::same_as<T, SpinBox>) {
313 patch.text = source.text;
314 patch.editMode = source.editMode;
315 patch.programmaticChange = source.programmaticChange;
316 patch.displayMode = source.displayMode;
317 patch.placeholder = source.placeholder;
318 patch.history = source.history;
319 patch.limits = source.limits;
320 patch.origins = source.origins;
321 }
322 patch.origin = source.origin;
323 const std::pair<std::string_view, bool> fields[]{{"value", patch.value.has_value()},
324 {"minimum", patch.minimum.has_value()},
325 {"maximum", patch.maximum.has_value()},
326 {"step", patch.step.has_value()},
327 {"pageSteps", patch.pageSteps.has_value()},
328 {"readOnly", patch.readOnly.has_value()},
329 {"preferredWidth", patch.preferredWidth.has_value()},
330 {"maxPaintCells", patch.maxPaintCells.has_value()},
331 {"skin", patch.sliderSkin.has_value()},
332 {"glyphs.track", patch.sliderTrack.has_value()},
333 {"glyphs.fill", patch.sliderFill.has_value()},
334 {"glyphs.thumb", patch.sliderThumb.has_value()}};
335
336 for (const auto &[path, present] : fields) {
337 if (present) {
338 ControlPropertyOrigin origin;
339 const auto found = std::ranges::find(source.origins, path, &ControlPropertyOrigin::path);
340
341 origin.path = path;
342 origin.source = found == source.origins.end() ? source.origin : found->source;
343 auto existing = std::ranges::find(patch.origins, path, &ControlPropertyOrigin::path);
344 if (existing == patch.origins.end()) {
345 patch.origins.push_back(std::move(origin));
346 } else {
347 existing->source = origin.source;
348 }
349 }
350 }
351 }
352 std::optional<ControlSettings> frameSettings;
353
354 if (detail::hasFrameSettings(arguments.settings.frame) && !std::same_as<T, PopupMenu>) {
355 if constexpr (!std::derived_from<T, SizedWidget>) {
356 return std::unexpected(detail::frameContextError(ControlContextErrorCode::UNSUPPORTED_PROPERTY, "frame"));
357 } else {
358 frameSettings.emplace();
359 frameSettings->frame = arguments.settings.frame;
360 frameSettings->origin = arguments.settings.origin;
361 frameSettings->origins = arguments.settings.origins;
362 }
363 }
364 [[maybe_unused]] const auto rowHeight = arguments.settings.rowHeight;
365 [[maybe_unused]] const auto overscanRows = arguments.settings.overscanRows;
366 [[maybe_unused]] const auto maxColumns = arguments.settings.maxColumns;
367 [[maybe_unused]] const auto maxPreparedCells = arguments.settings.maxPreparedCells;
368 [[maybe_unused]] const auto maxPreparedTextBytes = arguments.settings.maxPreparedTextBytes;
369 [[maybe_unused]] const auto mode = arguments.settings.mode;
370 [[maybe_unused]] const auto chartGlyphSet = arguments.settings.chartGlyphSet;
371 [[maybe_unused]] const auto candleGap = arguments.settings.candleGap;
372 [[maybe_unused]] const auto yRange = arguments.settings.yRange;
373 std::optional<ControlSettings> semanticSettings;
374
375 if (semantic != detail::ControlFactoryKind::USER) {
376 semanticSettings.emplace(arguments.settings);
377 }
378
379 const auto radioReadOnly = arguments.settings.readOnly;
380 const auto radioInitial = arguments.settings.radioInitial;
381 const auto radioSelectionMode = arguments.settings.radioSelectionMode;
382 auto id = arguments.id;
383 auto recipe = std::expected<Description<T>, ManagedError>(std::invoke(factory, std::move(arguments)));
384
385 if (!recipe) {
386 return std::unexpected(recipe.error());
387 }
388
389 if constexpr (std::derived_from<T, Slider> || std::same_as<T, SpinBox>) {
390 detail::Access::numericSettings(*recipe, std::move(*numericSettings));
391 }
392
393 if constexpr (std::same_as<T, Switch>) {
394 detail::Access::switchSettings(*recipe, ControlSettings{.state = switchState,
395 .cycle = switchCycle,
396 .readOnly = switchReadOnly,
397 .origin = switchOrigin,
398 .origins = std::move(switchOrigins)});
399 }
400
401 if constexpr (std::same_as<T, RadioGroup>) {
402 (void)std::move(*recipe).settings(ControlSettings{
403 .readOnly = radioReadOnly, .radioInitial = radioInitial, .radioSelectionMode = radioSelectionMode});
404 }
405 if (semanticSettings) {
406 auto staged = detail::Access::messageSource(*recipe, *semanticSettings, materialized, semantic);
407
408 if (!staged) {
409 return std::unexpected(staged.error());
410 }
411 }
412
413 if (frameSettings) {
414 detail::Access::frameSettings(*recipe, *frameSettings);
415 }
416
417 detail::Access::preparedControlPresence(*recipe, materialized);
418
419 // Only exact data families consume these literals; old text metadata remains factory-owned.
420 if constexpr (detail::IsVirtualList<T>::value || detail::IsVirtualTable<T>::value) {
421 if (rowHeight) {
422 (void)std::move(*recipe).rowHeight(*rowHeight);
423 }
424
425 if (overscanRows) {
426 (void)std::move(*recipe).overscanRows(*overscanRows);
427 }
428 }
429
430 if constexpr (detail::IsVirtualTable<T>::value) {
431 if (maxColumns) {
432 (void)std::move(*recipe).maxColumns(*maxColumns);
433 }
434
435 if (maxPreparedCells) {
436 (void)std::move(*recipe).maxPreparedCells(*maxPreparedCells);
437 }
438
439 if (maxPreparedTextBytes) {
440 (void)std::move(*recipe).maxPreparedTextBytes(*maxPreparedTextBytes);
441 }
442 }
443
444 if constexpr (detail::IsChart<T>::value) {
446 *recipe, {.mode = mode, .chartGlyphSet = chartGlyphSet, .candleGap = candleGap, .yRange = yRange});
447 }
448
449 if (visible) {
450 (void)std::move(*recipe).visible(*visible);
451 }
452
453 if (enabled) {
454 (void)std::move(*recipe).enabled(*enabled);
455 }
456
457 if (classes) {
458 (void)std::move(*recipe).classes(*classes);
459 }
460
461 if (!id.empty()) {
462 (void)std::move(*recipe).id(id);
463 }
464
465 if constexpr (std::derived_from<T, SizedWidget>) {
466 // Native semantic Notifications applies these precharged leaves through its actual resolved Overlay once.
467 if (semantic != detail::ControlFactoryKind::NOTIFICATION_BINDING) {
468 detail::Access::sizingSettings(*recipe, sizing);
469 }
470 }
471
472 return detail::Access::erase(std::move(*recipe));
473 };
474
475 return entry;
476 }
477
478 std::expected<void, SceneResourceErrorCode> insert(Entry entry);
479 std::vector<Entry> entries_ = std::vector<Entry>(0);
480};
481
489 TextResolver resolver{};
492 SceneResourceFormat format{
493 SceneResourceFormat::LEGACY};
494 std::optional<ControlContext> controls{};
495
507 SceneResourceOptions &popupMenu(std::string_view name, Ref<PopupMenu> reference,
508 std::initializer_list<PopupEntry> entries,
509 const PopupMenuOptions &options = {}) & noexcept {
510 if (registration.failure_) {
511 return *this;
512 }
513
514 try {
515 const auto added = registry.popupMenu(name, reference, entries, options);
516
517 if (!added) {
518 registration.failure_ =
519 std::pair{added.error(), added.error() == SceneResourceErrorCode::NO_MEMORY ? TreeError::NO_MEMORY
521 }
522 } catch (const std::bad_alloc &) {
524 } catch (...) {
526 }
527
528 return *this;
529 }
530
537 SceneResourceOptions &&popupMenu(std::string_view name, Ref<PopupMenu> reference,
538 std::initializer_list<PopupEntry> entries,
539 const PopupMenuOptions &options = {}) && noexcept {
540 popupMenu(name, reference, entries, options);
541
542 return std::move(*this);
543 }
544
558 template <class T, class Factory>
559 requires detail::ResourceFactory<T, std::decay_t<Factory>>
560 SceneResourceOptions &control(std::string_view name, Factory &&factory, bool children = false) & noexcept {
561 if (registration.failure_) {
562 return *this;
563 }
564
565 try {
566 const auto added = registry.add<T>(name, std::forward<Factory>(factory), children);
567
568 if (!added) {
569 registration.failure_ = std::pair{added.error(), TreeError::INVALID_ARGUMENT};
570 }
571 } catch (const std::bad_alloc &) {
573 } catch (...) {
575 }
576
577 return *this;
578 }
579
587 template <class T, class Factory, class Schema>
589 std::same_as<std::remove_cvref_t<Schema>, std::span<const ControlPropertyDescriptor>>
590 SceneResourceOptions &control(std::string_view name, Factory &&factory, Schema &&schema) & noexcept {
591 if (registration.failure_) {
592 return *this;
593 }
594
595 try {
596 const auto added = registry.add<T>(name, std::forward<Factory>(factory), std::forward<Schema>(schema));
597
598 if (!added) {
599 registration.failure_ = std::pair{added.error(), TreeError::INVALID_ARGUMENT};
600 }
601 } catch (const std::bad_alloc &) {
603 } catch (...) {
605 }
606
607 return *this;
608 }
609
615 template <class T, class Factory, class Schema>
617 std::same_as<std::remove_cvref_t<Schema>, std::span<const ControlPropertyDescriptor>>
618 SceneResourceOptions &&control(std::string_view name, Factory &&factory, Schema &&schema) && noexcept {
619 control<T>(name, std::forward<Factory>(factory), std::forward<Schema>(schema));
620
621 return std::move(*this);
622 }
623
632 template <class T, class Factory>
634 SceneResourceOptions &&control(std::string_view name, Factory &&factory, bool children = false) && noexcept {
635 control<T>(name, std::forward<Factory>(factory), children);
636
637 return std::move(*this);
638 }
639};
640
643 std::filesystem::path path;
644};
645
653Description<Widget> resource(std::string_view source, SceneResourceOptions options = {});
654
661Description<Widget> resource(SceneResourceFile source, SceneResourceOptions options = {});
662
672Scene scene(std::string_view source, SceneResourceOptions resource = {}, SceneOptions options = {},
673 std::source_location origin = std::source_location::current());
674
683Scene scene(SceneResourceFile source, SceneResourceOptions resource = {}, SceneOptions options = {},
684 std::source_location origin = std::source_location::current());
685} // namespace portals::ui
Single-use owning construction recipe; no mounted widget ownership.
Definition ui_description.hpp:48
Typed Widget observation; explicit composite specializations reuse their existing weak facades.
Definition ui_ref.hpp:761
Explicit owning allowlist; builtins include VBox/HBox/Label/LineEdit/FormField/Password/Button/CheckB...
Definition ui_scene_resource.hpp:90
~SceneResourceRegistry()=default
Release owning adapters; copying remains fallible instead of a noexcept debug-vector move.
std::expected< void, SceneResourceErrorCode > popupMenu(std::string_view name, Ref< PopupMenu > reference, std::initializer_list< PopupEntry > entries, PopupMenuOptions options={})
Bind a named loaded popup to an owning code-defined action tree.
Definition ui_scene_resource.hpp:98
std::expected< void, SceneResourceErrorCode > add(std::string_view name, Factory factory, bool children=false)
Register an explicitly typed custom recipe; existing names cannot be replaced.
Definition ui_scene_resource.hpp:147
SceneResourceRegistry()
Register the safe builtin recipe adapters without mounting anything.
std::expected< void, SceneResourceErrorCode > add(std::string_view name, Factory factory, Schema &&schema)
Explicitly bind the existing native MessageBox/Notifications/ThemeSelector/ThemeSelectorCatalog seman...
Definition ui_scene_resource.hpp:165
Single-use lazy owner of one Application and ManagedScene; no second runtime. Construct and operate o...
Definition ui_scene.hpp:253
Allocation-free sticky fluent-registration outcome; not user-configurable.
Definition ui_scene_resource.hpp:63
Exact typed recipe factory result accepted by a resource registry.
Definition ui_scene_resource.hpp:75
auto reference(ui::Ref< T > value)
Definition ui_static.hpp:572
constexpr SizePolicy DEFAULT_MENU_POLICY
Natural menu extent on both axes; callers may supply an ordinary explicit SizePolicy.
Definition menu.hpp:9
@ FACTORY
An explicit typed recipe factory failed; its original cause is preserved.
Definition scene_resource_error.hpp:31
@ INVALID_VALUE
A property value violates its declared primitive bounds.
Definition scene_resource_error.hpp:26
@ NO_MEMORY
Parser, resolver or recipe storage allocation failed.
Definition scene_resource_error.hpp:29
@ CALLBACK_FAILED
A user extension or callback threw.
Definition widget_types.hpp:37
@ INVALID_ARGUMENT
An option, enum value or operation argument is invalid.
Definition widget_types.hpp:27
@ NO_MEMORY
Allocation failed inside the operation boundary.
Definition widget_types.hpp:33
Original error plus independent runner/restoration and cleanup failures.
Definition managed_diagnostics.hpp:62
Immutable finite popup construction options; cell extents include panel borders.
Definition popup_menu.hpp:38
std::string_view path
Canonical scalar path, including nested history members.
Definition ui_control_context.hpp:598
std::string path
Canonical relative path, e.g. history.maxBytes.
Definition ui_control_context.hpp:70
Owning sparse literals only; never contains IDs, models, handlers or live history.
Definition ui_control_context.hpp:391
Policies for one lazy facade over the existing managed runtime.
Definition ui_scene.hpp:17
Owning primitive inputs to a registered typed recipe factory; no evaluated expressions.
Definition ui_scene_resource.hpp:40
std::optional< std::int32_t > weight
Node-local positive Spacer weight; absent means one.
Definition ui_scene_resource.hpp:55
std::int32_t gap
Nonnegative layout gap; resource syntax admits this only on VBox/HBox.
Definition ui_scene_resource.hpp:49
std::optional< bool > visible
Local visibility applied after the factory's recipe modifiers.
Definition ui_scene_resource.hpp:52
std::optional< std::uint32_t > flex
Positive common flex weight; excludes other per-axis mode requests.
Definition ui_scene_resource.hpp:48
~SceneResourceArguments()=default
Keep transfers fallible: checked MSVC string moves may allocate a debug proxy.
std::optional< std::int32_t > width
Nonnegative fixed cell width, applied after the factory recipe.
Definition ui_scene_resource.hpp:46
std::optional< std::string > classes
Owning literal class list; absent preserves factory classes, empty clears.
Definition ui_scene_resource.hpp:54
std::optional< std::int32_t > height
Nonnegative fixed cell height, applied after the factory recipe.
Definition ui_scene_resource.hpp:47
bool checked
Initial checkbox state; resource syntax admits this on CheckBox and Switch.
Definition ui_scene_resource.hpp:50
std::optional< std::int32_t > cells
Node-local nonnegative Spacing cells; absent means zero.
Definition ui_scene_resource.hpp:56
std::optional< bool > enabled
Local enabled state applied after the factory's recipe modifiers.
Definition ui_scene_resource.hpp:53
std::string text
Resolved owning UTF-8 text; empty when omitted.
Definition ui_scene_resource.hpp:44
ControlSettings settings
Validated effective sparse settings; no IDs, models or handlers.
Definition ui_scene_resource.hpp:51
Explicit owning file source; ordinary strings always denote source text.
Definition ui_scene_resource.hpp:642
std::filesystem::path path
File read once at prepare; relative paths use the then-current working directory.
Definition ui_scene_resource.hpp:643
Finite parser budgets, checked before calling any registered factory.
Definition ui_scene_resource.hpp:31
std::size_t maxStringBytes
Positive maximum decoded bytes in one string or resource key.
Definition ui_scene_resource.hpp:35
std::size_t maxNodes
Positive maximum node declarations.
Definition ui_scene_resource.hpp:33
std::size_t maxProperties
Positive maximum named/positional properties per node.
Definition ui_scene_resource.hpp:36
std::size_t maxDepth
Positive maximum node depth, at most 64; root depth is one.
Definition ui_scene_resource.hpp:34
std::size_t maxSourceBytes
Positive maximum UTF-8 source bytes.
Definition ui_scene_resource.hpp:32
Explicit resource-loader configuration; no process-global registry or locale. Configure without concu...
Definition ui_scene_resource.hpp:487
std::optional< ControlContext > controls
Local immutable snapshot; absent inherits the containing scene context.
Definition ui_scene_resource.hpp:494
SceneResourceFormat format
Explicit grammar; ordinary resources retain their syntax.
Definition ui_scene_resource.hpp:492
TextResolver resolver
Existing owning synchronous i18n adapter, used only at prepare.
Definition ui_scene_resource.hpp:489
SceneResourceOptions && control(std::string_view name, Factory &&factory, bool children=false) &&noexcept
Register on a temporary without copying its existing adapters.
Definition ui_scene_resource.hpp:634
SceneResourceOptions && control(std::string_view name, Factory &&factory, Schema &&schema) &&noexcept
Select the finite native composite schema on a temporary without adapter copies.
Definition ui_scene_resource.hpp:618
SceneResourceOptions & control(std::string_view name, Factory &&factory, bool children=false) &noexcept
Register a typed resource control and retain the first failure for checked prepare/runApp.
Definition ui_scene_resource.hpp:560
SceneResourceLimits limits
Finite parser bounds, independent of managed/tree limits.
Definition ui_scene_resource.hpp:490
SceneResourceOptions & control(std::string_view name, Factory &&factory, Schema &&schema) &noexcept
Select a finite native composite schema and collect registration failure for prepare/runApp.
Definition ui_scene_resource.hpp:590
SceneResourceOptions && popupMenu(std::string_view name, Ref< PopupMenu > reference, std::initializer_list< PopupEntry > entries, const PopupMenuOptions &options={}) &&noexcept
Bind a loaded popup on a temporary without copying existing adapters.
Definition ui_scene_resource.hpp:537
SceneResourceOptions & popupMenu(std::string_view name, Ref< PopupMenu > reference, std::initializer_list< PopupEntry > entries, const PopupMenuOptions &options={}) &noexcept
Bind a loaded popup and retain the first registration failure for checked prepare/runApp.
Definition ui_scene_resource.hpp:507
detail::ResourceRegistrationState registration
Internal sticky failure; not a configuration/reset API.
Definition ui_scene_resource.hpp:491
SceneResourceRegistry registry
Owning copied/moved typed allowlist and factory captures.
Definition ui_scene_resource.hpp:488
static void chartSettings(Description< T > &description, ControlSettings patch)
Definition ui_recipe_access.hpp:890
static void frameSettings(Description< T > &description, const ControlSettings &settings)
Stage precharged frame settings on the exact typed source recipe.
Definition ui_layout.hpp:997
static void preparedControlPresence(Description< T > &description, ControlPropertyPresence alreadyMaterialized)
Mark all resource-resolved fields without truncating the canonical vocabulary.
Definition ui_description.hpp:3286
static void numericSettings(Description< T > &description, ControlSettings patch)
Definition ui_description.hpp:3506
static Description< Widget > erase(Description< T > description)
Erase only the observer type while preserving one mount transaction.
Definition ui_description.hpp:3534
static constexpr std::string_view controlType()
Identify builtin recipe types without allocating runtime metadata.
Definition ui_recipe_access.hpp:808
static std::expected< void, ManagedError > messageSource(Description< T > &description, const ControlSettings &settings, ControlPropertyPresence materialized, ControlFactoryKind kind=ControlFactoryKind::MESSAGE_BINDING)
Definition ui_description.hpp:3366
static void switchSettings(Description< Switch > &description, ControlSettings patch)
Definition ui_description.hpp:3433
static void sizingSettings(Description< T > &description, const RecipeSizing &sizing)
Stage sizing.
Definition ui_description.hpp:3271