libdom
Loading...
Searching...
No Matches
Macros | Typedefs | Enumerations | Functions
keyboard_event.h File Reference
#include <stdbool.h>
#include <dom/core/exceptions.h>
#include <dom/core/string.h>

Go to the source code of this file.

Macros

#define dom_keyboard_event_create(n)    _dom_keyboard_event_create((dom_keyboard_event **) (n))
 
#define dom_keyboard_event_get_key(e, i)
 
#define dom_keyboard_event_get_code(e, i)
 
#define dom_keyboard_event_get_location(e, l)
 
#define dom_keyboard_event_get_ctrl_key(e, k)
 
#define dom_keyboard_event_get_shift_key(e, k)
 
#define dom_keyboard_event_get_alt_key(e, k)
 
#define dom_keyboard_event_get_meta_key(e, k)
 
#define dom_keyboard_event_get_modifier_state(e, m, s)
 
#define dom_keyboard_event_init(e, t, b, c, v, kk, kc, kl, ck, sk, ak, mk, r, ic)
 
#define dom_keyboard_event_init_ns(e, n, t, b, c, v, ki, kl, m)
 

Typedefs

typedef struct dom_keyboard_event dom_keyboard_event
 

Enumerations

enum  dom_key_location { DOM_KEY_LOCATION_STANDARD = 0 , DOM_KEY_LOCATION_LEFT = 1 , DOM_KEY_LOCATION_RIGHT = 2 , DOM_KEY_LOCATION_NUMPAD = 3 }
 

Functions

dom_exception _dom_keyboard_event_create (dom_keyboard_event **evt)
 
dom_exception _dom_keyboard_event_get_key (dom_keyboard_event *evt, dom_string **key)
 
dom_exception _dom_keyboard_event_get_code (dom_keyboard_event *evt, dom_string **code)
 
dom_exception _dom_keyboard_event_get_location (dom_keyboard_event *evt, dom_key_location *location)
 
dom_exception _dom_keyboard_event_get_ctrl_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_shift_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_alt_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_meta_key (dom_keyboard_event *evt, bool *key)
 
dom_exception _dom_keyboard_event_get_modifier_state (dom_keyboard_event *evt, dom_string *m, bool *state)
 
dom_exception _dom_keyboard_event_init (dom_keyboard_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
 
dom_exception _dom_keyboard_event_init_ns (dom_keyboard_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
 

Macro Definition Documentation

◆ dom_keyboard_event_create

#define dom_keyboard_event_create ( n)     _dom_keyboard_event_create((dom_keyboard_event **) (n))

◆ dom_keyboard_event_get_alt_key

#define dom_keyboard_event_get_alt_key ( e,
k )
Value:
(dom_keyboard_event *) (e), (bool *) (k))
dom_exception _dom_keyboard_event_get_alt_key(dom_keyboard_event *evt, bool *key)
Definition keyboard_event.c:161
Definition keyboard_event.h:18

◆ dom_keyboard_event_get_code

#define dom_keyboard_event_get_code ( e,
i )
Value:
(dom_keyboard_event *) (e), (dom_string **) (i))
dom_exception _dom_keyboard_event_get_code(dom_keyboard_event *evt, dom_string **code)
Definition keyboard_event.c:101
Definition string.h:19

◆ dom_keyboard_event_get_ctrl_key

#define dom_keyboard_event_get_ctrl_key ( e,
k )
Value:
(dom_keyboard_event *) (e), (bool *) (k))
dom_exception _dom_keyboard_event_get_ctrl_key(dom_keyboard_event *evt, bool *key)
Definition keyboard_event.c:131

◆ dom_keyboard_event_get_key

#define dom_keyboard_event_get_key ( e,
i )
Value:
(dom_keyboard_event *) (e), (dom_string **) (i))
dom_exception _dom_keyboard_event_get_key(dom_keyboard_event *evt, dom_string **key)
Definition keyboard_event.c:86

◆ dom_keyboard_event_get_location

#define dom_keyboard_event_get_location ( e,
l )
Value:
dom_exception _dom_keyboard_event_get_location(dom_keyboard_event *evt, dom_key_location *location)
Definition keyboard_event.c:116
dom_key_location
Definition keyboard_event.h:19

◆ dom_keyboard_event_get_meta_key

#define dom_keyboard_event_get_meta_key ( e,
k )
Value:
(dom_keyboard_event *) (e), (bool *) (k))
dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt, bool *key)
Definition keyboard_event.c:176

◆ dom_keyboard_event_get_modifier_state

#define dom_keyboard_event_get_modifier_state ( e,
m,
s )
Value:
(dom_keyboard_event *) (e), (dom_string *) (m),\
(bool *) (s))
dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt, dom_string *m, bool *state)
Definition keyboard_event.c:197

◆ dom_keyboard_event_get_shift_key

#define dom_keyboard_event_get_shift_key ( e,
k )
Value:
(bool *) (k))
dom_exception _dom_keyboard_event_get_shift_key(dom_keyboard_event *evt, bool *key)
Definition keyboard_event.c:146

◆ dom_keyboard_event_init

#define dom_keyboard_event_init ( e,
t,
b,
c,
v,
kk,
kc,
kl,
ck,
sk,
ak,
mk,
r,
ic )
Value:
(dom_string *) (t), (bool) (b), (bool) (c), \
(struct dom_abstract_view *) (v), (dom_string *) (kk), \
(dom_string *) (kc), (dom_key_location) (kl), \
(bool) (ck), (bool) (sk), (bool) (ak), (bool) (mk), \
(bool) (r), (bool) (ic))
dom_exception _dom_keyboard_event_init(dom_keyboard_event *evt, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
Definition keyboard_event.c:312

◆ dom_keyboard_event_init_ns

#define dom_keyboard_event_init_ns ( e,
n,
t,
b,
c,
v,
ki,
kl,
m )
Value:
(dom_string *) (n), (dom_string *) (t), \
(bool) (b), (bool) (c), \
(struct dom_abstract_view *) (v), (dom_string *) (kk), \
(dom_string *) (kc), (dom_key_location) (kl), \
(bool) (ck), (bool) (sk), (bool) (ak), (bool) (mk), \
(bool) (r), (bool) (ic))
dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt, dom_string *namespace, dom_string *type, bool bubble, bool cancelable, struct dom_abstract_view *view, dom_string *key, dom_string *code, dom_key_location location, bool ctrl_key, bool shift_key, bool alt_key, bool meta_key, bool repeat, bool is_composing)
Definition keyboard_event.c:356

Typedef Documentation

◆ dom_keyboard_event

typedef struct dom_keyboard_event dom_keyboard_event

Enumeration Type Documentation

◆ dom_key_location

Enumerator
DOM_KEY_LOCATION_STANDARD 
DOM_KEY_LOCATION_LEFT 
DOM_KEY_LOCATION_RIGHT 
DOM_KEY_LOCATION_NUMPAD 

Function Documentation

◆ _dom_keyboard_event_create()

dom_exception _dom_keyboard_event_create ( dom_keyboard_event ** evt)

◆ _dom_keyboard_event_get_alt_key()

dom_exception _dom_keyboard_event_get_alt_key ( dom_keyboard_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_keyboard_event_get_code()

dom_exception _dom_keyboard_event_get_code ( dom_keyboard_event * evt,
dom_string ** code )

Get the code

Parameters
evtThe Event object
codeThe returned code
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_ctrl_key()

dom_exception _dom_keyboard_event_get_ctrl_key ( dom_keyboard_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_keyboard_event_get_key()

dom_exception _dom_keyboard_event_get_key ( dom_keyboard_event * evt,
dom_string ** key )

Get the key

Parameters
evtThe Event object
keyThe returned key
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_location()

dom_exception _dom_keyboard_event_get_location ( dom_keyboard_event * evt,
dom_key_location * location )

Get the key location

Parameters
evtThe Event object
locationThe returned key location
Returns
DOM_NO_ERR.

◆ _dom_keyboard_event_get_meta_key()

dom_exception _dom_keyboard_event_get_meta_key ( dom_keyboard_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_keyboard_event_get_modifier_state()

dom_exception _dom_keyboard_event_get_modifier_state ( dom_keyboard_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_keyboard_event_get_shift_key()

dom_exception _dom_keyboard_event_get_shift_key ( dom_keyboard_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_keyboard_event_init()

dom_exception _dom_keyboard_event_init ( dom_keyboard_event * evt,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
dom_string * key,
dom_string * code,
dom_key_location location,
bool ctrl_key,
bool shift_key,
bool alt_key,
bool meta_key,
bool repeat,
bool is_composing )

Initialise the keyboard event with namespace

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
keyThe key identifier of pressed key
codeThe code identifier of pressed key
locationThe key location of the preesed key
ctrl_keyWhether the ctrl_key is pressed
shift_keyWhether the shift_key is pressed
alt_keyWhether the alt_key is pressed
meta_keyWhether the ctrl_key is pressed
repeatWhether this is a repeat press from a held key
is_composingWhether the input is being composed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.

◆ _dom_keyboard_event_init_ns()

dom_exception _dom_keyboard_event_init_ns ( dom_keyboard_event * evt,
dom_string * namespace,
dom_string * type,
bool bubble,
bool cancelable,
struct dom_abstract_view * view,
dom_string * key,
dom_string * code,
dom_key_location location,
bool ctrl_key,
bool shift_key,
bool alt_key,
bool meta_key,
bool repeat,
bool is_composing )

Initialise the keyboard 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
keyThe key identifier of pressed key
codeThe code identifier of pressed key
locationThe key location of the preesed key
ctrl_keyWhether the ctrl_key is pressed
shift_keyWhether the shift_key is pressed
alt_keyWhether the alt_key is pressed
meta_keyWhether the ctrl_key is pressed
repeatWhether this is a repeat press from a held key
is_composingWhether the input is being composed
Returns
DOM_NO_ERR on success, appropriate dom_exception on failure.