3#include <Covellite/Gui/EventListener.hpp>
4#include <alicorn/std/exception.hpp>
5#include <Covellite/Events/Events.hpp>
6#include <Covellite/Events.hpp>
7#include <Covellite/Gui/Events.hpp>
9using namespace covellite::gui;
11Window::EventListener::EventListener(
const Events_t & _Events) :
16void Window::EventListener::ProcessEvent(Event_t & _Event)
20 auto *
const pTargetElement = _Event.GetTargetElement();
21 if (pTargetElement ==
nullptr)
23 throw STD_EXCEPTION <<
"Target element null pointer.";
26 const auto *
const pDocument = pTargetElement->GetOwnerDocument();
27 if (pDocument ==
nullptr)
29 throw STD_EXCEPTION <<
"Owner document null pointer.";
33 events::Gui{ CovelliteGuiStringToUtf8(_Event.GetType()) }
34 .
DocumentId(CovelliteGuiStringToUtf8(pDocument->GetId()))
35 .ElementId(CovelliteGuiStringToUtf8(pTargetElement->GetId()));
39 catch (const ::std::exception & _Ex)
41 m_Events[events::Error.Exception](_Ex.what());
45 auto Window::EventListener::Make(
const Events_t & _Events) -> EventListenerPtr_t
47 return ::std::make_shared<EventListener>(_Events);
Класс входит в проект Covellite.Gui Базовый класс для событий панели GUI.
Definition Events.hpp:27
Document DocumentId(const TypeId_t &_Id) const
Вспомогательная функция для построения уникального идентификатора элемента.
Definition Events.hpp:72