docs
Loading...
Searching...
No Matches
InputEvent

#include <Ultralight/dom/Event.h>

Overview

An edit to an editable element (InputEvent).

Get one with Event::AsInput(). It adds the kind of edit and the inserted text. It works for the input events that typing and editing fire.

Note
Changing a checkbox, a radio button, or a <select> fires a plain input event, so both getters return nullopt for it.
Inheritance diagram for InputEvent:
Event

Public Member Functions

 InputEvent (ULDOMEvent borrowed)
 Wrap an event handle from the C API (Event::AsInput() is the usual way to get one).
std::optional< std::string > inputType () const
 Get the kind of edit (inputType).
std::optional< std::string > data () const
 Get the inserted text (data).
Public Member Functions inherited from Event
 Event (ULDOMEvent borrowed)
 Wrap an event handle from the C API.
 Event (const Event &)=delete
Event & operator= (const Event &)=delete
std::string type () const
 Get the event's type (type).
unsigned eventPhase () const
 Get the current dispatch phase (eventPhase).
bool bubbles () const
 Whether or not the event bubbles up the tree (bubbles).
bool cancelable () const
 Whether or not preventDefault() can cancel the event (cancelable).
bool isTrusted () const
 Whether or not the event came from user input or the library (isTrusted).
double timeStamp () const
 Get the time the event was created (timeStamp).
bool defaultPrevented () const
 Whether or not the event was canceled (defaultPrevented).
void preventDefault () const
 Cancel the event's default action (preventDefault).
void stopPropagation () const
 Stop the event from reaching other targets (stopPropagation).
void stopImmediatePropagation () const
 Stop the event from reaching any other listener (stopImmediatePropagation).
Element target () const
 Get the element the event was dispatched to (target).
Node targetNode () const
 Get the node the event was dispatched to (target).
Element currentTarget () const
 Get the element whose listener is running (currentTarget).
MouseEvent AsMouse () const
 View this event as a MouseEvent.
WheelEvent AsWheel () const
 View this event as a WheelEvent.
KeyboardEvent AsKeyboard () const
 View this event as a KeyboardEvent.
FocusEvent AsFocus () const
 View this event as a FocusEvent.
InputEvent AsInput () const
 View this event as an InputEvent.
SubmitEvent AsSubmit () const
 View this event as a SubmitEvent.
CustomEvent AsCustom () const
 View this event as a CustomEvent.
ULDOMEvent raw () const
 Get the C handle, for passing to the <Ultralight/CAPI/CAPI_DOMEvent.h> functions.

Constructor & Destructor Documentation

◆ InputEvent()

InputEvent ( ULDOMEvent borrowed)
inlineexplicit

Wrap an event handle from the C API (Event::AsInput() is the usual way to get one).

Parameters
borrowedThe event handle passed to a C listener callback.

Member Function Documentation

◆ data()

std::optional< std::string > data ( ) const
inline

Get the inserted text (data).

Returns
Returns the text (nullopt if the edit inserted none, eg, a deletion).

◆ inputType()

std::optional< std::string > inputType ( ) const
inline

Get the kind of edit (inputType).

Returns
Returns the kind of edit (eg, insertText or deleteContentBackward). Returns nullopt if the event isn't an InputEvent.

The documentation for this class was generated from the following file: