Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
widget_types.hpp
1// Copyright (c) 2026 ttldtor.
2// SPDX-License-Identifier: BSL-1.0
3#pragma once
4
5#include <portals/geometry.hpp>
6#include <portals/render.hpp>
7
8#include <cstddef>
9#include <cstdint>
10#include <expected>
11#include <span>
12
13namespace portals {
15struct NodeId {
16 std::uint64_t session{};
17 std::size_t slot{};
18 std::uint64_t generation{};
23 bool operator==(const NodeId &other) const noexcept = default;
24};
25
40
46
54
57 std::size_t max_nodes{4096};
58 std::size_t max_depth{128};
59};
60
67public:
69 virtual ~PaintContext() = default;
74 virtual std::expected<void, TreeError> submit(std::span<const RenderCommand> commands) = 0;
75};
76} // namespace portals
An owning, invariant-preserving half-open cell rectangle.
Definition geometry.hpp:81
Borrowed synchronous command sink supplied by the frame owner. submit must consume commands immediate...
Definition widget_types.hpp:66
virtual ~PaintContext()=default
Destroy the caller-owned sink.
virtual std::expected< void, TreeError > submit(std::span< const RenderCommand > commands)=0
Borrow commands.
Public Portals API.
Definition action.hpp:8
@ CALLBACK_FAILED
A non-allocation exception escaped into a runner callback boundary.
Definition application.hpp:34
@ NO_MEMORY
Allocation failed at a runner exception boundary.
Definition application.hpp:33
@ CLOSED
Owner, node scope, scheduler or completion endpoint is closed.
Definition async.hpp:28
@ WRONG_THREAD
The operation or coroutine frame belongs to another thread.
Definition async.hpp:27
@ WOULD_BLOCK
Active resume, invocation, registration or queue capacity rejects the operation.
Definition async.hpp:30
@ IDENTITY_EXHAUSTED
Invocation identity cannot advance without reuse.
Definition async.hpp:33
@ INVALID_ARGUMENT
Empty task, callback or immutable data owner, or invalid policy.
Definition async.hpp:26
@ LAYOUT
Read final arranged geometry or deliver a deferred owning layout observation.
Definition managed_diagnostics.hpp:58
@ NONE
Caption only, including a single-glyph action button.
Definition controls.hpp:157
Invalidation
Accumulated work; layout always includes painting.
Definition widget_types.hpp:41
@ PAINT
Painting is required; arranged geometry remains usable.
Definition widget_types.hpp:43
@ NODE_LIMIT
Node count exceeds the configured cap.
Definition scene_resource_error.hpp:17
@ DEPTH_LIMIT
Nesting exceeds the configured cap.
Definition scene_resource_error.hpp:18
TreeError
Checked tree failures; rejected operations never start the requested callback.
Definition widget_types.hpp:26
@ INVALID_GEOMETRY
Required arranged geometry is absent or translation overflowed.
Definition widget_types.hpp:38
@ WRONG_SESSION
An identity or scope belongs to another tree/scheduler.
Definition widget_types.hpp:29
@ STALE_NODE
The observed node or model consumer is absent or retired.
Definition widget_types.hpp:30
Owning arranged geometry; invalid geometry must never be used for hit-testing.
Definition widget_types.hpp:48
CellRect clip
Surface intersection with every ancestor and viewport.
Definition widget_types.hpp:51
bool valid
False before arrangement or after layout invalidation/failure.
Definition widget_types.hpp:52
CellRect surface
Explicitly translated surface rectangle.
Definition widget_types.hpp:50
CellRect local
Parent-relative rectangle.
Definition widget_types.hpp:49
Owning identity, independent of addresses; zero is never a live identity.
Definition widget_types.hpp:15
std::uint64_t generation
Reuse generation; exhausted slots retire.
Definition widget_types.hpp:18
std::uint64_t session
Process-unique tree session.
Definition widget_types.hpp:16
std::size_t slot
Registry position, not sibling order.
Definition widget_types.hpp:17
bool operator==(const NodeId &other) const noexcept=default
Compare identity.
Finite storage and recursive traversal limits, including the root node.
Definition widget_types.hpp:56
std::size_t max_depth
Root depth is one; values above 256 are rejected.
Definition widget_types.hpp:58
std::size_t max_nodes
Live and not-yet-reclaimed nodes share this budget.
Definition widget_types.hpp:57