Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
text_accessibility.hpp
Go to the documentation of this file.
1#pragma once
2
3// Cross-platform text accessibility surface.
4//
5// Most of Pulp's painted text bypasses the platform a11y APIs
6// (NSAccessibility on macOS, UIA on Windows, AccessKit on Linux) because
7// glyphs land directly on the GPU canvas without ever entering the
8// platform's accessibility tree. This header defines the cross-platform
9// SURFACE — a value type that captures the minimum a screen reader needs
10// and a registration entry point — plus a no-op default backend that
11// stores nodes in a process-local table.
12//
13// Platform backends overlay the default registry when available
14// (NSAccessibility on macOS, UIA on Windows, AccessKit on Linux). The
15// default backend remains useful for tests and unsupported platforms.
16
17#include <cstddef>
18#include <cstdint>
19#include <string>
20#include <string_view>
21#include <vector>
22
23namespace pulp::view {
24
35
41 std::string id;
42
44 std::string text;
45
48
52 std::vector<std::size_t> cluster_boundaries_utf8;
53
57 std::vector<std::size_t> cluster_boundaries_utf16;
58
61 std::size_t selection_start_utf8 = 0;
62 std::size_t selection_end_utf8 = 0;
63};
64
69std::string_view accessibility_backend_name() noexcept;
70
77
81
86
87} // namespace pulp::view
Definition widgets.hpp:56
Text editing widget with comprehensive keyboard/mouse interaction.
Definition text_editor.hpp:47
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
void register_text_accessibility_node(const TextAccessibilityNode &node)
Register or replace a text node with the active a11y backend.
std::vector< TextAccessibilityNode > snapshot_accessibility_nodes()
Read back the currently-registered nodes.
TextAccessibilityRole
Coarse semantic role for a piece of accessible text.
Definition text_accessibility.hpp:28
@ Heading
Definition text_accessibility.hpp:32
@ Other
Definition text_accessibility.hpp:33
@ Button
Definition text_accessibility.hpp:30
@ Label
Definition text_accessibility.hpp:29
std::string_view accessibility_backend_name() noexcept
Returns the active accessibility backend identifier.
void unregister_text_accessibility_node(std::string_view id)
Drop the node registered under id.
STL namespace.
A single accessible text node — the minimum a screen reader needs to describe a piece of painted text...
Definition text_accessibility.hpp:39
std::size_t selection_end_utf8
Definition text_accessibility.hpp:62
std::string text
UTF-8 content of the node.
Definition text_accessibility.hpp:44
std::vector< std::size_t > cluster_boundaries_utf16
Cluster boundaries in UTF-16 code units.
Definition text_accessibility.hpp:57
std::string id
Caller-stable identifier. Used as the registration key.
Definition text_accessibility.hpp:41
std::vector< std::size_t > cluster_boundaries_utf8
Cluster boundaries in UTF-8 byte offsets.
Definition text_accessibility.hpp:52
TextAccessibilityRole role
Semantic role hint.
Definition text_accessibility.hpp:47
std::size_t selection_start_utf8
Active selection range in UTF-8 byte offsets.
Definition text_accessibility.hpp:61