libdom
Loading...
Searching...
No Matches
Functions
mouse_event.c File Reference
#include <stdlib.h>
#include <string.h>
#include "events/mouse_event.h"
#include "core/document.h"
#include "utils/utils.h"

Functions

dom_exception _dom_mouse_event_create (struct dom_mouse_event **evt)
 
void _dom_mouse_event_destroy (struct dom_mouse_event *evt)
 
dom_exception _dom_mouse_event_initialise (struct dom_mouse_event *evt)
 
dom_exception _dom_mouse_event_get_screen_x (dom_mouse_event *evt, int32_t *x)
 
dom_exception _dom_mouse_event_get_screen_y (dom_mouse_event *evt, int32_t *y)
 
dom_exception _dom_mouse_event_get_client_x (dom_mouse_event *evt, int32_t *x)
 
dom_exception _dom_mouse_event_get_client_y (dom_mouse_event *evt, int32_t *y)
 
dom_exception _dom_mouse_event_get_ctrl_key (dom_mouse_event *evt, bool *key)
 
dom_exception _dom_mouse_event_get_shift_key (dom_mouse_event *evt, bool *key)
 
dom_exception _dom_mouse_event_get_alt_key (dom_mouse_event *evt, bool *key)
 
dom_exception _dom_mouse_event_get_meta_key (dom_mouse_event *evt, bool *key)
 
dom_exception _dom_mouse_event_get_button (dom_mouse_event *evt, unsigned short *button)
 
dom_exception _dom_mouse_event_get_related_target (dom_mouse_event *evt, dom_event_target **et)
 
dom_exception _dom_mouse_event_get_modifier_state (dom_mouse_event *evt, dom_string *m, bool *state)
 
dom_exception _dom_mouse_event_init (dom_mouse_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et)
 
dom_exception _dom_mouse_event_init_ns (dom_mouse_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, int32_t detail, int32_t screen_x, int32_t screen_y, int32_t client_x, int32_t client_y, bool ctrl, bool alt, bool shift, bool meta, unsigned short button, dom_event_target *et)
 

Function Documentation

◆ _dom_mouse_event_create()

dom_exception _dom_mouse_event_create ( struct dom_mouse_event ** evt)

◆ _dom_mouse_event_destroy()

void _dom_mouse_event_destroy ( struct dom_mouse_event * evt)

◆ _dom_mouse_event_get_alt_key()

dom_exception _dom_mouse_event_get_alt_key ( dom_mouse_event * evt,
bool * key )

Get the alt key state

Parameters
evtThe Event object
keyWhether the Alt key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_button()

dom_exception _dom_mouse_event_get_button ( dom_mouse_event * evt,
unsigned short * button )

Get the button which get pressed

Parameters
evtThe Event object
buttonThe pressed mouse button
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_client_x()

dom_exception _dom_mouse_event_get_client_x ( dom_mouse_event * evt,
int32_t * x )

Get clientX

Parameters
evtThe Event object
xThe returned clientX
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_client_y()

dom_exception _dom_mouse_event_get_client_y ( dom_mouse_event * evt,
int32_t * y )

Get clientY

Parameters
evtThe Event object
yThe returned clientY
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_ctrl_key()

dom_exception _dom_mouse_event_get_ctrl_key ( dom_mouse_event * evt,
bool * key )

Get the ctrl key state

Parameters
evtThe Event object
keyWhether the Control key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_meta_key()

dom_exception _dom_mouse_event_get_meta_key ( dom_mouse_event * evt,
bool * key )

Get the meta key state

Parameters
evtThe Event object
keyWhether the Meta key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_modifier_state()

dom_exception _dom_mouse_event_get_modifier_state ( dom_mouse_event * evt,
dom_string * m,
bool * state )

Query the state of a modifier using a key identifier

Parameters
evtThe event object
mlThe modifier identifier, such as "Alt", "Control", "Meta", "AltGraph", "CapsLock", "NumLock", "Scroll", "Shift".
stateWhether the modifier key is pressed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.
Note
: If an application wishes to distinguish between right and left modifiers, this information could be deduced using keyboard events and KeyboardEvent.keyLocation.

◆ _dom_mouse_event_get_related_target()

dom_exception _dom_mouse_event_get_related_target ( dom_mouse_event * evt,
dom_event_target ** et )

Get the related target

Parameters
evtThe Event object
etThe related EventTarget
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_screen_x()

dom_exception _dom_mouse_event_get_screen_x ( dom_mouse_event * evt,
int32_t * x )

Get screenX

Parameters
evtThe Event object
xThe returned screenX
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_screen_y()

dom_exception _dom_mouse_event_get_screen_y ( dom_mouse_event * evt,
int32_t * y )

Get screenY

Parameters
evtThe Event object
yThe returned screenY
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_get_shift_key()

dom_exception _dom_mouse_event_get_shift_key ( dom_mouse_event * evt,
bool * key )

Get the shift key state

Parameters
evtThe Event object
keyWhether the Shift key is pressed down
Returns
DOM_NO_ERR.

◆ _dom_mouse_event_init()

dom_exception _dom_mouse_event_init ( dom_mouse_event * evt,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
int32_t detail,
int32_t screen_x,
int32_t screen_y,
int32_t client_x,
int32_t client_y,
bool ctrl,
bool alt,
bool shift,
bool meta,
unsigned short button,
dom_event_target * et )

Initialise this mouse event

Parameters
evtThe Event object
typeThe event's type
bubbleWhether this is a bubbling event
cancelableWhether this is a cancelable event
viewThe AbstractView associated with this event
detailThe detail information of this mouse event
screen_xThe x position of the mouse pointer in screen
screen_yThe y position of the mouse pointer in screen
client_xThe x position of the mouse pointer in client window
client_yThe y position of the mouse pointer in client window
altThe state of Alt key, true for pressed, false otherwise
shiftThe state of Shift key, true for pressed, false otherwise
mataThe state of Meta key, true for pressed, false otherwise
buttonThe mouse button pressed
etThe related target of this event, may be NULL
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.

◆ _dom_mouse_event_init_ns()

dom_exception _dom_mouse_event_init_ns ( dom_mouse_event * evt,
dom_string * namespace,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
int32_t detail,
int32_t screen_x,
int32_t screen_y,
int32_t client_x,
int32_t client_y,
bool ctrl,
bool alt,
bool shift,
bool meta,
unsigned short button,
dom_event_target * et )

Initialise the event with namespace

Parameters
evtThe Event object
namespaceThe namespace of this event
typeThe event's type
bubbleWhether this is a bubbling event
cancelableWhether this is a cancelable event
viewThe AbstractView associated with this event
detailThe detail information of this mouse event
screen_xThe x position of the mouse pointer in screen
screen_yThe y position of the mouse pointer in screen
client_xThe x position of the mouse pointer in client window
client_yThe y position of the mouse pointer in client window
altThe state of Alt key, true for pressed, false otherwise
shiftThe state of Shift key, true for pressed, false otherwise
mataThe state of Meta key, true for pressed, false otherwise
buttonThe mouse button pressed
etThe related target of this event, may be NULL
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.

◆ _dom_mouse_event_initialise()

dom_exception _dom_mouse_event_initialise ( struct dom_mouse_event * evt)