MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ event()

InspectResult MayaFlux::Portal::Forma::Inspector::event ( const std::shared_ptr< Vruta::Event > &  ev,
std::string_view  name,
Surface surface,
LayoutCursor cursor,
float  x_min = -0.95F,
float  x_max = 0.95F,
float  row_h = 0.05F 
)

Inspect a single Event by name and pointer.

Header is the event's registered name, or "(unnamed)" if empty. Body rows expose token and active state.

Definition at line 10 of file EventQuery.cpp.

16{
17 const std::string header_label = name.empty() ? "(unnamed)" : std::string(name);
18
19 std::vector<ValueSpec> values {
20 ValueSpec {
21 .label = "token",
22 .reader = [ev] {
23 return std::string(Reflect::enum_to_string(ev->get_processing_token()));
24 },
25 },
26 ValueSpec {
27 .label = "active",
28 .reader = [ev] { return ev->is_active() ? "true" : "false"; },
29 },
30 };
31
32 const auto dims = row_pixel_dims(surface.window(), x_min, x_max, row_h);
33 auto hbuf = make_row_buffer(surface.window(), header_label, dims);
34 std::vector<RowBuffer> rbufs;
35 rbufs.reserve(values.size());
36 for (const auto& spec : values)
37 rbufs.push_back(make_row_buffer(surface.window(), spec.label, dims));
38
39 auto group = make_value_group(values, std::move(hbuf), rbufs,
40 surface, cursor, x_min, x_max, row_h, false);
41
42 InspectResult result;
43 result.group = std::move(group);
44 return result;
45}
RowBuffer make_row_buffer(const std::shared_ptr< Core::Window > &window, std::string_view text, glm::uvec2 pixel_dims) const
Definition Inspector.cpp:13
ValueGroup make_value_group(std::span< const ValueSpec > values, RowBuffer header_buf, std::span< const RowBuffer > row_bufs, Surface &surface, LayoutCursor &cursor, float x_min, float x_max, float row_h, bool initially_open)
Construct a collapsible header followed by N value rows under it.
glm::uvec2 row_pixel_dims(const std::shared_ptr< Core::Window > &window, float x_min, float x_max, float row_h)
Convert an NDC row rect into integer pixel dimensions.
constexpr std::string_view enum_to_string(EnumType value) noexcept
Universal enum to string converter using magic_enum (original case)

References MayaFlux::Reflect::enum_to_string(), MayaFlux::Portal::Forma::InspectResult::group, MayaFlux::Portal::Forma::ValueSpec::label, make_row_buffer(), MayaFlux::Portal::Forma::make_value_group(), MayaFlux::Portal::Forma::row_pixel_dims(), and MayaFlux::Portal::Forma::Surface::window().

+ Here is the call graph for this function: