AeonGUI
A portable video game graphic user interface library.
Loading...
Searching...
No Matches
AeonGUI::DOM::Event Class Reference

Represents a DOM event. More...

#include <aeongui/dom/Event.hpp>

Public Member Functions

 Event (const DOMString &type, const std::optional< EventInit > &eventInitDict={})
 Construct an event of the given type.
std::vector< EventTargetcomposedPath () const
 Build the composed path for this event.
void stopPropagation ()
 Stop the event from propagating further.
void stopImmediatePropagation ()
 Stop the event from propagating and prevent other listeners on the same target.
void preventDefault ()
 Cancel the event's default action, if cancelable.
constexpr const DOMString & type () const
 Get the event type.
constexpr const EventTarget *const target () const
 Get the target of the event.
constexpr const EventTarget *const currentTarget () const
 Get the current target during dispatch.
constexpr uint16_t eventPhase () const
 Get the current event phase.
constexpr bool bubbles () const
 Check whether the event bubbles.
constexpr bool cancelable () const
 Check whether the event is cancelable.
constexpr bool defaultPrevented () const
 Check whether the default action was prevented.
constexpr bool composed () const
 Check whether the event is composed.
constexpr bool isTrusted () const
 Check whether the event was generated by the user agent.
constexpr const DOMHighResTimeStamp & timeStamp () const
 Get the event's creation timestamp.

Public Attributes

const uint16_t NONE {0}
 No phase.
const uint16_t CAPTURING_PHASE {1}
 Capture phase.
const uint16_t AT_TARGET {2}
 At-target phase.
const uint16_t BUBBLING_PHASE {3}
 Bubble phase.

Detailed Description

Represents a DOM event.

Events are dispatched to EventTarget objects and carry information about the occurrence (type, target, phase, etc.).

See also
https://dom.spec.whatwg.org/#interface-event

Constructor & Destructor Documentation

◆ Event()

AeonGUI::DOM::Event::Event ( const DOMString & type,
const std::optional< EventInit > & eventInitDict = {} )

Construct an event of the given type.

Parameters
typeThe event type name.
eventInitDictOptional initialization dictionary.

Member Function Documentation

◆ bubbles()

bool AeonGUI::DOM::Event::bubbles ( ) const
inlineconstexpr

Check whether the event bubbles.

Returns
true if bubbles.

◆ cancelable()

bool AeonGUI::DOM::Event::cancelable ( ) const
inlineconstexpr

Check whether the event is cancelable.

Returns
true if cancelable.

◆ composed()

bool AeonGUI::DOM::Event::composed ( ) const
inlineconstexpr

Check whether the event is composed.

Returns
true if composed.

◆ composedPath()

std::vector< EventTarget > AeonGUI::DOM::Event::composedPath ( ) const

Build the composed path for this event.

Returns
Vector of EventTargets in the event's propagation path.

◆ currentTarget()

const EventTarget *const AeonGUI::DOM::Event::currentTarget ( ) const
inlineconstexpr

Get the current target during dispatch.

Returns
Pointer to the current target.

◆ defaultPrevented()

bool AeonGUI::DOM::Event::defaultPrevented ( ) const
inlineconstexpr

Check whether the default action was prevented.

Returns
true if default was prevented.

◆ eventPhase()

uint16_t AeonGUI::DOM::Event::eventPhase ( ) const
inlineconstexpr

Get the current event phase.

Returns
The phase constant (NONE, CAPTURING_PHASE, AT_TARGET, or BUBBLING_PHASE).

◆ isTrusted()

bool AeonGUI::DOM::Event::isTrusted ( ) const
inlineconstexpr

Check whether the event was generated by the user agent.

Returns
true if trusted.

◆ target()

const EventTarget *const AeonGUI::DOM::Event::target ( ) const
inlineconstexpr

Get the target of the event.

Returns
Pointer to the original target.

◆ timeStamp()

const DOMHighResTimeStamp & AeonGUI::DOM::Event::timeStamp ( ) const
inlineconstexpr

Get the event's creation timestamp.

Returns
The high-resolution timestamp.

◆ type()

const DOMString & AeonGUI::DOM::Event::type ( ) const
inlineconstexpr

Get the event type.

Returns
The event type string.

The documentation for this class was generated from the following files:
  • include/aeongui/dom/Event.hpp
  • core/dom/Event.cpp