13 const std::shared_ptr<Core::Window>&
window,
14 float x_min,
float x_max,
float row_h)
16 const auto& ws =
window->get_state();
17 const auto w =
static_cast<uint32_t
>(
18 (x_max - x_min) * 0.5F *
static_cast<float>(ws.current_width));
19 const auto h =
static_cast<uint32_t
>(
20 row_h * 0.5F *
static_cast<float>(ws.current_height));
24 std::source_location::current(),
25 "Failed to get default glyph atlas for row pixel dimension calculation");
27 const uint32_t min_h = atlas->pixel_size();
29 return { std::max(w, 1U), std::max(
h, min_h) };
37 float x_min,
float x_max,
float row_h,
46 .
color = { 1.F, 1.F, 1.F, 1.F },
47 .background = { bg, 1.F },
48 .render_bounds = dims,
53 el.bounds_hint = row_rect;
54 el.interactive =
false;
56 el.with_text(spec.
label, *params, row_rect);
57 const uint32_t
id = surface.
layer().
add(el);
59 auto compose = [reader = spec.
reader,
63 last = std::optional<std::string> {}]()
mutable {
67 std::string text =
label +
": " + reader();
68 if (last && *last == text)
72 el.set_text(text, *params);
77 x_min, x_max, row_h](uint32_t, uint32_t)
mutable {
78 params->render_bounds = row_pixel_dims(surface.window(), x_min, x_max, row_h);
79 el.set_text(reader ? (label +
": " + reader()) : label, *params);
82 Link link(compose, compose);
86 .buf = std::move(row_buf.
buf),
87 .link = std::move(link),
88 .row_bounds = row_rect,
100 return make_entry(spec, std::move(row_buf), surface, cursor,
105 std::span<const EntrySpec> entrys,
106 std::string_view header_label,
108 std::span<const EntryBuffer> row_bufs,
111 float x_min,
float x_max,
float row_h,
118 .
label(std::string(header_label))
119 .
place(std::move(header_buf), surface, cursor, x_min, x_max, row_h);
121 std::vector<Entry>
rows;
122 rows.reserve(entrys.size());
123 for (
size_t i = 0; i < entrys.size(); ++i) {
124 auto row =
make_entry(entrys[i], row_bufs[i], surface, cursor, x_min, x_max, row_h);
125 header.attach(surface.
layer(), row.element_id);
126 rows.push_back(std::move(row));
129 header.cursor_out = cursor;
132 .
header = std::move(header),
133 .rows = std::move(
rows),
138 std::span<const EntrySpec> entrys,
139 std::string_view header_label,
141 std::span<const EntryBuffer> row_bufs,
147 return make_entry_group(entrys, header_label, std::move(header_buf), row_bufs,
148 surface, cursor, cursor.
x_min(), cursor.
x_max(), row_h, initially_open);
std::weak_ptr< Core::Window > window
void on_resize(uint32_t id, ResizeFn fn)
Called on every window resize.
GlyphAtlas * get_default_glyph_atlas() const
Return the default GlyphAtlas, or nullptr if set_default_font() has not been called successfully.
static TypeFaceFoundry & instance()
@ Runtime
General runtime operations (default fallback)
@ Portal
High-level user-facing API layer.
Axis-aligned bounding rectangle in a 2D coordinate space.
A pre-created text-capable buffer, passed to make_entry.
Header collapsible with N entry rows related to it.
std::function< std::string()> reader
A single entry to display in a EntryGroup body row.
One entry row in a EntryGroup body.
glm::vec4 color
RGBA color applied to all glyphs not covered by a span in spans.
Construction parameters for press().