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

◆ read_action()

template<typename Source, typename Access>
bool MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::read_action ( const Source & on,
InstanceInfo & info )
inlineprivate

Definition at line 460 of file Instantiate.hpp.

461 {
463
464 if (!m_actions)
465 return fail(on, "<on> needs an action table, and none was given");
466
468 if (!event_text)
469 return fail(on, "<on> needs an event attribute");
471 Type event {};
474 return fail(on, "<on> has an unsupported event " + std::string(*event_text));
475 filter.event_type = event;
476
480 return fail(on, "<on> takes a button only for MOUSE_BUTTON_PRESSED, MOUSE_BUTTON_RELEASED and MOUSE_MOTION");
481 }
485 return fail(on, "<on> has an unsupported button " + std::string(*button_text));
486 }
487 filter.button = button;
488 }
489
492 return fail(on, "<on> takes a key only for KEY_PRESSED, KEY_RELEASED and KEY_REPEAT");
493 const auto key = IO::from_string(*key_text);
494 if (!key)
495 return fail(on, "<on> has an unsupported key " + std::string(*key_text));
496 filter.key_code = *key;
497 }
498
500 return fail(on, "<on> event " + std::string(*event_text)
501 + " is not delivered to an element, or needs a key attribute");
502 }
503
505 if (!name)
506 return fail(on, "<on> needs an action attribute");
507 if (!m_actions->contains(*name))
508 return fail(on, "no registered action " + std::string(*name));
509
510 info.actions.push_back(ActionSpec {
511 .element = on, .filter = filter, .action = std::string(*name) });
512 return true;
513 }
bool fail(const Source &at, std::string message)
std::optional< Keys > from_string(std::string_view str) noexcept
Converts a string to the corresponding Keys enum value.
Definition Keys.cpp:42

References MayaFlux::Portal::Forma::action_button_attribute, MayaFlux::Portal::Forma::action_event_attribute, MayaFlux::Portal::Forma::action_key_attribute, MayaFlux::Portal::Forma::action_name_attribute, MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::InstanceInfo::actions, MayaFlux::Vruta::WindowEventFilter::button, MayaFlux::Vruta::WindowEventFilter::event_type, fail(), MayaFlux::IO::from_string(), MayaFlux::Reflect::Invalid, MayaFlux::Vruta::WindowEventFilter::key_code, m_actions, MayaFlux::Portal::Forma::Context::receives(), and MayaFlux::IO::Unknown.

Referenced by read_actions(), and read_element().

Here is the call graph for this function:
Here is the caller graph for this function: