MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
TextRow.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace MayaFlux::Buffers {
7class FormaBuffer;
8}
9
11
12class Surface;
13
14}
15
17
18[[nodiscard]] glm::vec4 row_idle_color();
19
20[[nodiscard]] glm::vec4 row_hover_color();
21
22/**
23 * @brief Caption drawn for a row labelled @p label.
24 */
25[[nodiscard]] std::string row_caption(std::string_view label);
26
27/**
28 * @brief White text over @p background, laid out at @p dims pixels.
29 */
30[[nodiscard]] Text::PressParams row_press_params(glm::uvec2 dims, glm::vec4 background);
31
32/**
33 * @brief Register a clickable text row on @p surface.
34 *
35 * Draws @p label over the idle background and adds the element to the
36 * surface's layer. The row is a slice of @p batch when one is given, so rows
37 * that share a buffer draw together; otherwise it gets a buffer of its own.
38 *
39 * @param surface Surface to register on.
40 * @param label Row text.
41 * @param bounds NDC region of the row.
42 * @param dims Pixel size to lay the text out at.
43 * @param batch Text-capable buffer to draw into as a slice, or empty.
44 * @return Element id on the layer, and the row element for later set_text().
45 */
46[[nodiscard]] std::pair<uint32_t, std::shared_ptr<Element>> add_text_row(
47 Surface& surface,
48 std::string_view label,
49 Kinesis::AABB2D bounds,
50 glm::uvec2 dims,
51 const std::shared_ptr<Buffers::FormaBuffer>& batch = {});
52
53/**
54 * @brief Highlight a row's background while the cursor is over it.
55 *
56 * @param dims Pixel size read on every enter and leave, so a resize that
57 * updates it is picked up.
58 */
60 Surface& surface,
61 uint32_t id,
62 const std::shared_ptr<Element>& row,
63 std::string_view label,
64 const std::shared_ptr<glm::uvec2>& dims);
65
66} // namespace MayaFlux::Portal::Forma::internal
uint32_t label
Definition Contours.cpp:16
Text::PressParams row_press_params(glm::uvec2 dims, glm::vec4 background)
White text over background, laid out at dims pixels.
Definition TextRow.cpp:18
std::pair< uint32_t, std::shared_ptr< Element > > add_text_row(Surface &surface, std::string_view label, Kinesis::AABB2D bounds, glm::uvec2 dims, const std::shared_ptr< Buffers::FormaBuffer > &batch)
Register a clickable text row on surface.
Definition TextRow.cpp:28
void hover_text_row(Surface &surface, uint32_t id, const std::shared_ptr< Element > &row, std::string_view label, const std::shared_ptr< glm::uvec2 > &dims)
Highlight a row's background while the cursor is over it.
Definition TextRow.cpp:49
std::string row_caption(std::string_view label)
Caption drawn for a row labelled label.
Definition TextRow.cpp:13