blob: 4d094e9d27d837ac22b050399db1153040c4a675 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
/*
* This file is part of libdom.
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
*/
#ifndef dom_internal_events_event_h_
#define dom_internal_events_event_h_
#include <inttypes.h>
#include <dom/events/event_target.h>
#include <dom/events/event.h>
#include "utils/list.h"
struct lwc_string_s;
struct dom_document;
/* The private virtual table */
struct dom_event_private_vtable {
void (*destroy)(dom_event *evt);
};
/**
* The Event Ojbect
*/
struct dom_event {
struct lwc_string_s *type; /**< The type of the event */
dom_event_target *target; /**< The event target */
dom_event_target *current; /**< The current event target */
dom_event_flow_phase phase; /**< The event phase */
bool bubble; /**< Whether this event is a bubbling event */
bool cancelable; /**< Whether this event is cancelable */
unsigned int timestamp;
/**< The timestamp this event is created */
struct lwc_string_s *namespace;
/**< The namespace of this event */
struct dom_document *doc;
/**< The document which create this event */
bool stop; /**< Whether stopPropagation is called */
bool stop_now; /**< Whether stopImmediatePropagation is called */
bool prevent_default;
/**< Whether the default action is prevented */
bool custom; /**< Whether this is a custom event */
uint32_t refcnt; /**< The reference count of this object */
struct dom_event_private_vtable *vtable;
/**< The private virtual function table of Event */
bool in_dispatch; /**< Whether this event is in dispatch */
};
/* Constructor */
dom_exception _dom_event_create(struct dom_document *doc,
struct dom_event **evt);
/* Destructor */
void _dom_event_destroy(struct dom_document *doc, struct dom_event *evt);
/* Initialise function */
dom_exception _dom_event_initialise(struct dom_document *doc,
struct dom_event *evt);
/* Finalise function */
void _dom_event_finalise(struct dom_document *doc, struct dom_event *evt);
static inline void dom_event_destroy(struct dom_event *evt)
{
evt->vtable->destroy(evt);
}
#define dom_event_destroy(e) dom_event_destroy((struct dom_event *) (e))
#endif
|