The base type describing a named Element Event.
More...
#include <Events.h>
|
| EventArgs (const std::string &type, Element *source, Element *target, bool bubbles, bool cancelable, uint64_t timestamp) |
| Create EventArgs with a type. More...
|
|
| EventArgs (const std::string &type, Element *source, Element *target, Element *relatedTarget, bool bubbles, bool cancelable, uint64_t timestamp) |
| Create EventArgs with a type. More...
|
|
virtual | ~EventArgs () |
| Destroy the EventArgs.
|
|
const std::string & | type () const |
| Get the event type. More...
|
|
void | stopPropagation () |
| Stop the propagation of the event. More...
|
|
void | stopImmediatePropagation () |
|
void | preventDefault () |
| Prevent any default actions associated with the event. More...
|
|
bool | isCancelled () const |
|
bool | isDefaultPrevented () const |
|
void | setPhase (Phase phase) |
| Set the Phase of the event. More...
|
|
Phase | getPhase () const |
|
bool | bubbles () const |
| Determine if the event has a bubbling phase. More...
|
|
bool | isCancelable () const |
|
Element * | source () |
|
Element * | target () |
|
Element * | relatedTarget () |
|
Element * | getCurrentTarget () |
|
const Element * | getCurrentTarget () const |
|
void | setCurrentTarget (Element *target) |
| Set the current target Element. More...
|
|
uint64_t | timestamp () const |
|
std::string | toString () const |
| A utility method to print get the Event as a std::string. More...
|
|
|
std::string | _type |
| The name of the event (case-insensitive).
|
|
Element * | _source = nullptr |
| The source of the event.
|
|
Element * | _target = nullptr |
| The event's target.
|
|
Element * | _relatedTarget = nullptr |
| The event's related target.
|
|
bool | _bubbles = true |
| Used to indicate whether or not an event is a bubbling event. If the event can bubble the value is true, else the value is false.
|
|
bool | _cancelable = true |
| Used to indicate whether propgation was stopped. The currentTarget will indicate which target stopped propagation.
|
|
bool | _defaultPrevented = false |
| Used to indicated.
|
|
Element * | _currentTaget = nullptr |
| Used to indicate the EventTarget whose EventListeners are currently being processed. This is particularly useful during capturing and bubbling.
|
|
Phase | _phase = Phase::NONE |
| Used to indicate which phase of event flow is currently being evaluated.
|
|
bool | _canceled = false |
| Used to indicate if an event is canceled.
|
|
uint64_t | _timestamp = 0 |
| Used to specify the time (in milliseconds relative to the epoch) at which the event was created. More...
|
|
The base type describing a named Element Event.
- See also
- http://www.w3.org/TR/DOM-Level-3-Events/
Enumerator |
---|
NONE |
Events not currently dispatched are in this phase.
|
CAPTURING_PHASE |
When an event is dispatched to an object that participates in a tree it will be in this phase before it reaches its target attribute value.
|
AT_TARGET |
When an event is dispatched it will be in this phase on its target attribute value.
|
BUBBLING_PHASE |
When an event is dispatched to an object that participates in a tree it will be in this phase after it reaches its target attribute value.
|
ofx::DOM::EventArgs::EventArgs |
( |
const std::string & |
type, |
|
|
Element * |
source, |
|
|
Element * |
target, |
|
|
bool |
bubbles, |
|
|
bool |
cancelable, |
|
|
uint64_t |
timestamp |
|
) |
| |
Create EventArgs with a type.
- Parameters
-
type | The event type string (case-insensitive). |
source | The source of the event. |
target | The target element. |
bubbles | True iff the argument bubbles after AT_TARGET phase. |
cancelable | True iff the event can be cancelled by a listener. |
timestamp | The timestamp of the event. |
ofx::DOM::EventArgs::EventArgs |
( |
const std::string & |
type, |
|
|
Element * |
source, |
|
|
Element * |
target, |
|
|
Element * |
relatedTarget, |
|
|
bool |
bubbles, |
|
|
bool |
cancelable, |
|
|
uint64_t |
timestamp |
|
) |
| |
Create EventArgs with a type.
- Parameters
-
type | The event type string (case-insensitive). |
source | The source of the event. |
target | The target element. |
bubbles | True iff the argument bubbles after AT_TARGET phase. |
cancelable | True iff the event can be cancelled by a listener. |
timestamp | The timestamp of the event. |
bool ofx::DOM::EventArgs::bubbles |
( |
| ) |
const |
Determine if the event has a bubbling phase.
- Returns
- true iff the event should bubble.
Element * ofx::DOM::EventArgs::getCurrentTarget |
( |
| ) |
|
- Returns
- a pointer to the current target Element.
const Element * ofx::DOM::EventArgs::getCurrentTarget |
( |
| ) |
const |
- Returns
- a pointer to the current target Element.
- Returns
- the Phase of the event.
bool ofx::DOM::EventArgs::isCancelable |
( |
| ) |
const |
- Returns
- true iff the Event can be cancelled.
bool ofx::DOM::EventArgs::isCancelled |
( |
| ) |
const |
- Returns
- true iff the event was cancelled.
bool ofx::DOM::EventArgs::isDefaultPrevented |
( |
| ) |
const |
- Returns
- true iff the default activity was prevented.
void ofx::DOM::EventArgs::preventDefault |
( |
| ) |
|
Prevent any default actions associated with the event.
For some events, there are default actions. Calling preventDefault will tell the event dispatcher that it should not call the default action after the event has been dispatched. This is different from stopPropagation. Calling stopPropagation does not prevent the default action from taking place. To stop propagation and prevent the default, both methods must be called.
Element * ofx::DOM::EventArgs::relatedTarget |
( |
| ) |
|
void ofx::DOM::EventArgs::setCurrentTarget |
( |
Element * |
target | ) |
|
Set the current target Element.
- Parameters
-
void ofx::DOM::EventArgs::setPhase |
( |
Phase |
phase | ) |
|
Set the Phase of the event.
- Parameters
-
Element * ofx::DOM::EventArgs::source |
( |
| ) |
|
void ofx::DOM::EventArgs::stopPropagation |
( |
| ) |
|
Stop the propagation of the event.
The stopPropagation method is used prevent further propagation of an event during event flow. If this method is called by any EventListener the event will cease propagating through the tree. The event will complete dispatch to all listeners on the current EventTarget before event flow stops. This method may be used during any stage of event flow.
Element * ofx::DOM::EventArgs::target |
( |
| ) |
|
uint64_t ofx::DOM::EventArgs::timestamp |
( |
| ) |
const |
- Returns
- the timestamp (in milliseconds relative to the epoch).
std::string ofx::DOM::EventArgs::toString |
( |
| ) |
const |
A utility method to print get the Event as a std::string.
- Returns
- The Event as a std::string.
- Note
- Not for serialization.
const std::string & ofx::DOM::EventArgs::type |
( |
| ) |
const |
Get the event type.
- Returns
- the event type string.
uint64_t ofx::DOM::EventArgs::_timestamp = 0 |
|
protected |
Used to specify the time (in milliseconds relative to the epoch) at which the event was created.
Due to the fact that some systems may not provide this information the value of timeStamp may be not available for all events. When not available, a value of 0 will be returned. Examples of epoch time are the time of the system start or 0:0:0 UTC 1st January 1970.
The documentation for this class was generated from the following files: