16#ifndef AEONGUI_DOM_EVENT_H
17#define AEONGUI_DOM_EVENT_H
23#include "DOMString.hpp"
24#include "EventTarget.hpp"
31 using DOMHighResTimeStamp = std::chrono::time_point<std::chrono::high_resolution_clock>;
53 DLL
Event (
const DOMString&
type,
const std::optional<EventInit>& eventInitDict = {} );
58 DLL
const std::vector<EventTarget*>&
composedPath()
const;
73 constexpr const DOMString&
type()
const
79 constexpr const EventTarget*
const target()
const
87 return m_currentTarget;
111 return m_defaultPrevented;
141 EventTarget* m_currentTarget{};
142 std::vector<EventTarget*> m_composedPath{};
143 uint16_t m_eventPhase{
NONE};
146 bool m_defaultPrevented{};
149 bool m_stopPropagation{
false};
150 bool m_stopImmediatePropagation{
false};
151 DOMHighResTimeStamp m_timeStamp{};
constexpr bool composed() const
Check whether the event is composed.
Definition Event.hpp:115
const uint16_t AT_TARGET
At-target phase.
Definition Event.hpp:68
const uint16_t CAPTURING_PHASE
Capture phase.
Definition Event.hpp:67
constexpr uint16_t eventPhase() const
Get the current event phase.
Definition Event.hpp:91
constexpr bool bubbles() const
Check whether the event bubbles.
Definition Event.hpp:97
virtual ~Event()=default
Virtual destructor for proper polymorphic cleanup.
const std::vector< EventTarget * > & composedPath() const
Build the composed path for this event.
Definition Event.cpp:29
constexpr const EventTarget *const currentTarget() const
Get the current target during dispatch.
Definition Event.hpp:85
void stopPropagation()
Stop the event from propagating further.
Definition Event.cpp:33
constexpr bool isTrusted() const
Check whether the event was generated by the user agent.
Definition Event.hpp:121
constexpr const DOMString & type() const
Get the event type.
Definition Event.hpp:73
const uint16_t NONE
No phase.
Definition Event.hpp:66
const uint16_t BUBBLING_PHASE
Bubble phase.
Definition Event.hpp:69
constexpr const EventTarget *const target() const
Get the target of the event.
Definition Event.hpp:79
void stopImmediatePropagation()
Stop the event from propagating and prevent other listeners on the same target.
Definition Event.cpp:37
constexpr const DOMHighResTimeStamp & timeStamp() const
Get the event's creation timestamp.
Definition Event.hpp:127
constexpr bool defaultPrevented() const
Check whether the default action was prevented.
Definition Event.hpp:109
void preventDefault()
Cancel the event's default action, if cancelable.
Definition Event.cpp:42
void setTrusted(bool trusted)
Set the trusted flag (for user-agent generated events).
Definition Event.cpp:49
constexpr bool cancelable() const
Check whether the event is cancelable.
Definition Event.hpp:103
Event(const DOMString &type, const std::optional< EventInit > &eventInitDict={})
Construct an event of the given type.
Definition Event.cpp:21
Base class for objects that can receive DOM events.
Definition EventTarget.hpp:58
Initialization dictionary for Event construction.
Definition Event.hpp:34
bool cancelable
Whether the event can be cancelled.
Definition Event.hpp:36
bool bubbles
Whether the event bubbles up the DOM tree.
Definition Event.hpp:35
bool composed
Whether the event crosses shadow DOM boundaries.
Definition Event.hpp:37