summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dom/bootstrap/implpriv.h3
-rw-r--r--include/dom/core/exceptions.h18
-rw-r--r--include/dom/core/implementation.h2
-rw-r--r--include/dom/events/custom_event.h32
-rw-r--r--include/dom/events/document_event.h47
-rw-r--r--include/dom/events/event.h93
-rw-r--r--include/dom/events/event_listener.h27
-rw-r--r--include/dom/events/event_target.h62
-rw-r--r--include/dom/events/events.h25
-rw-r--r--include/dom/events/keyboard_event.h89
-rw-r--r--include/dom/events/mouse_event.h108
-rw-r--r--include/dom/events/mouse_multi_wheel_event.h56
-rw-r--r--include/dom/events/mouse_wheel_event.h42
-rw-r--r--include/dom/events/mutation_event.h80
-rw-r--r--include/dom/events/mutation_name_event.h54
-rw-r--r--include/dom/events/text_event.h41
-rw-r--r--include/dom/events/ui_event.h45
17 files changed, 823 insertions, 1 deletions
diff --git a/include/dom/bootstrap/implpriv.h b/include/dom/bootstrap/implpriv.h
index f6a7eb2..17ffcde 100644
--- a/include/dom/bootstrap/implpriv.h
+++ b/include/dom/bootstrap/implpriv.h
@@ -28,6 +28,7 @@
#include <stdbool.h>
#include <dom/core/exceptions.h>
+#include <dom/events/document_event.h>
#include <dom/functypes.h>
#include <dom/core/string.h>
@@ -126,6 +127,7 @@ struct dom_implementation {
struct dom_string *qname,
struct dom_document_type *doctype,
dom_alloc alloc, void *pw, struct lwc_context_s *ctx,
+ dom_events_default_action_fetcher daf,
struct dom_document **doc);
/**
@@ -245,6 +247,7 @@ dom_exception dom_register_source(struct dom_implementation_source *source);
/* Create a DOM document */
dom_exception dom_document_create(struct dom_implementation *impl,
dom_alloc alloc, void *pw, struct lwc_context_s *ctx,
+ dom_events_default_action_fetcher daf,
struct dom_document **doc);
/* Set a document's buffer */
diff --git a/include/dom/core/exceptions.h b/include/dom/core/exceptions.h
index fc5e247..e128016 100644
--- a/include/dom/core/exceptions.h
+++ b/include/dom/core/exceptions.h
@@ -8,6 +8,18 @@
#ifndef dom_core_exceptions_h_
#define dom_core_exceptions_h_
+/**
+ * Class of a DOM exception.
+ *
+ * The top 16 bits of a dom_exception are a bitfield
+ * indicating which class the exception belongs to.
+ */
+typedef enum {
+ DOM_EXCEPTION_CLASS_NORMAL = 0,
+ DOM_EXCEPTION_CLASS_EVENT = (1<<30),
+ DOM_EXCEPTION_CLASS_INTERNAL = (1<<31)
+} dom_exception_class;
+
/* The DOM spec says that this is actually an unsigned short */
typedef enum {
DOM_NO_ERR = 0,
@@ -28,7 +40,11 @@ typedef enum {
DOM_INVALID_ACCESS_ERR = 15,
DOM_VALIDATION_ERR = 16,
DOM_TYPE_MISMATCH_ERR = 17,
- DOM_NO_MEM_ERR = (1<<16)
+
+ DOM_UNSPECIFIED_EVENT_TYPE_ERR = DOM_EXCEPTION_CLASS_EVENT + 0,
+ DOM_DISPATCH_REQUEST_ERR = DOM_EXCEPTION_CLASS_EVENT + 1,
+
+ DOM_NO_MEM_ERR = DOM_EXCEPTION_CLASS_INTERNAL + 0
/* our own internal error */
} dom_exception;
diff --git a/include/dom/core/implementation.h b/include/dom/core/implementation.h
index cb95f84..92cce99 100644
--- a/include/dom/core/implementation.h
+++ b/include/dom/core/implementation.h
@@ -11,6 +11,7 @@
#include <stdbool.h>
#include <dom/core/exceptions.h>
+#include <dom/events/document_event.h>
#include <dom/functypes.h>
#include <dom/core/string.h>
@@ -38,6 +39,7 @@ dom_exception dom_implementation_create_document(
struct dom_string *namespace, struct dom_string *qname,
struct dom_document_type *doctype,
dom_alloc alloc, void *pw, struct lwc_context_s *ctx,
+ dom_events_default_action_fetcher daf,
struct dom_document **doc);
dom_exception dom_implementation_get_feature(
diff --git a/include/dom/events/custom_event.h b/include/dom/events/custom_event.h
new file mode 100644
index 0000000..cb97732
--- /dev/null
+++ b/include/dom/events/custom_event.h
@@ -0,0 +1,32 @@
+/*
+ * 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_events_custom_event_h_
+#define dom_events_custom_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+
+typedef struct dom_custom_event dom_custom_event;
+
+dom_exception _dom_custom_event_get_detail(dom_custom_event *evt,
+ void **detail);
+#define dom_custom_event_get_detail(e, d) \
+ _dom_custom_event_get_detail((dom_custom_event *) (e),\
+ (void **) (d))
+
+dom_exception _dom_custom_event_init_ns(dom_custom_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, void *detail);
+#define dom_custom_event_init_ns(e, n, t, b, c, d) \
+ _dom_custom_event_init_ns((dom_custom_event *) (e), \
+ (struct dom_string *) (n), (struct dom_string *) (t), \
+ (bool) (b), (bool) (c), (void *) (d))
+
+#endif
diff --git a/include/dom/events/document_event.h b/include/dom/events/document_event.h
new file mode 100644
index 0000000..e349bc2
--- /dev/null
+++ b/include/dom/events/document_event.h
@@ -0,0 +1,47 @@
+/*
+ * 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_events_document_event_h_
+#define dom_events_document_event_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_event;
+struct dom_document;
+struct lwc_context_s;
+struct lwc_string_s;
+
+typedef struct dom_document dom_document_event;
+
+/**
+ * The default action fetcher
+ *
+ * @note: When the implementation reach the end of the event flow, it will call
+ * this function to get the default action handler. If it does not return a
+ * NULL, the returned dom_event_listener will be invoked as the event is not
+ * canceled.
+ */
+typedef struct dom_event_listener *(*dom_events_default_action_fetcher)
+ (struct lwc_string_s *name, struct lwc_string_s *type);
+
+dom_exception _dom_document_event_create_event(dom_document_event *de,
+ struct dom_string *type, struct dom_event **evt);
+#define dom_document_event_create_event(d, t, e) \
+ _dom_document_event_create_event((dom_document_event *) (d), \
+ (struct dom_string *) (t), (struct dom_event **) (e))
+
+dom_exception _dom_document_event_can_dispatch(dom_document_event *de,
+ struct dom_string *namespace, struct dom_string *type,
+ bool* can);
+#define dom_document_event_can_dispatch(d, n, t, c) \
+ _dom_document_event_can_dispatch((dom_document_event *) (d), \
+ (struct dom_string *) (n), (struct dom_string *) (t),\
+ (bool *) (c))
+
+#endif
+
diff --git a/include/dom/events/event.h b/include/dom/events/event.h
new file mode 100644
index 0000000..df50f2e
--- /dev/null
+++ b/include/dom/events/event.h
@@ -0,0 +1,93 @@
+/*
+ * 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_events_event_h_
+#define dom_events_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/events/event_target.h>
+
+struct dom_string;
+
+typedef enum {
+ DOM_CAPTURING_PHASE = 1,
+ DOM_AT_TARGET = 2,
+ DOM_BUBBLING_PHASE = 3
+} dom_event_flow_phase;
+
+typedef struct dom_event dom_event;
+
+/* The ref/unref methods define */
+void _dom_event_ref(dom_event *evt);
+#define dom_event_ref(n) _dom_event_ref((dom_event *) (n))
+void _dom_event_unref(dom_event *evt);
+#define dom_event_unref(n) _dom_event_unref((dom_event *) (n))
+
+dom_exception _dom_event_get_type(dom_event *evt, struct dom_string **type);
+#define dom_event_get_type(e, t) _dom_event_get_type((dom_event *) (e), \
+ (struct dom_string **) (t))
+
+dom_exception _dom_event_get_target(dom_event *evt, dom_event_target **target);
+#define dom_event_get_target(e, t) _dom_event_get_target((dom_event *) (e), \
+ (dom_event_target **) (t))
+
+dom_exception _dom_event_get_current_target(dom_event *evt,
+ dom_event_target **current);
+#define dom_event_get_current_target(e, c) _dom_event_get_current_target(\
+ (dom_event *) (e), (dom_event_target **) (c))
+
+dom_exception _dom_event_get_bubbles(dom_event *evt, bool *bubbles);
+#define dom_event_get_bubbles(e, b) _dom_event_get_bubbles((dom_event *) (e), \
+ (bool *) (b))
+
+dom_exception _dom_event_get_cancelable(dom_event *evt, bool *cancelable);
+#define dom_event_get_cancelable(e, c) _dom_event_get_cancelable(\
+ (dom_event *) (e), (bool *) (c))
+
+dom_exception _dom_event_get_timestamp(dom_event *evt,
+ unsigned int *timestamp);
+#define dom_event_get_timestamp(e, t) _dom_event_get_timestamp(\
+ (dom_event *) (e), (unsigned int *) (t))
+
+dom_exception _dom_event_stop_propagation(dom_event *evt);
+#define dom_event_stop_propagation(e) _dom_event_stop_propagation(\
+ (dom_event *) (e))
+
+dom_exception _dom_event_prevent_default(dom_event *evt);
+#define dom_event_prevent_default(e) _dom_event_prevent_default(\
+ (dom_event *) (e))
+
+dom_exception _dom_event_init(dom_event *evt, struct dom_string *type,
+ bool bubble, bool cancelable);
+#define dom_event_init(e, t, b, c) _dom_event_init((dom_event *) (e), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c))
+
+dom_exception _dom_event_get_namespace(dom_event *evt,
+ struct dom_string **namespace);
+#define dom_event_get_namespace(e, n) _dom_event_get_namespace(\
+ (dom_event *) (e), (struct dom_string **) (n))
+
+dom_exception _dom_event_is_custom(dom_event *evt, bool *custom);
+#define dom_event_is_custom(e, c) _dom_event_is_custom((dom_event *) (e), \
+ (bool *) (c))
+
+dom_exception _dom_event_stop_immediate_propagation(dom_event *evt);
+#define dom_event_stop_immediate_propagation(e) \
+ _dom_event_stop_immediate_propagation((dom_event *) (e))
+
+dom_exception _dom_event_is_default_prevented(dom_event *evt, bool *prevented);
+#define dom_event_is_default_prevented(e, p) \
+ _dom_event_is_default_prevented((dom_event *) (e), (bool *) (p))
+
+dom_exception _dom_event_init_ns(dom_event *evt, struct dom_string *namespace,
+ struct dom_string *type, bool bubble, bool cancelable);
+#define dom_event_init_ns(e, n, t, b, c) _dom_event_init_ns( \
+ (dom_event *) (e), (struct dom_string *) (n), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c))
+
+#endif
diff --git a/include/dom/events/event_listener.h b/include/dom/events/event_listener.h
new file mode 100644
index 0000000..cb7ff15
--- /dev/null
+++ b/include/dom/events/event_listener.h
@@ -0,0 +1,27 @@
+/*
+ * 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_events_event_listener_h_
+#define dom_events_event_listener_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_document;
+struct dom_event;
+
+typedef void (*handle_event)(struct dom_event *evt, void *pw);
+
+typedef struct dom_event_listener dom_event_listener;
+
+dom_exception dom_event_listener_create(struct dom_document *doc,
+ handle_event handler, void *pw, dom_event_listener **listener);
+
+void dom_event_listener_ref(dom_event_listener *listener);
+void dom_event_listener_unref(dom_event_listener *listener);
+
+#endif
+
diff --git a/include/dom/events/event_target.h b/include/dom/events/event_target.h
new file mode 100644
index 0000000..bf3233e
--- /dev/null
+++ b/include/dom/events/event_target.h
@@ -0,0 +1,62 @@
+/*
+ * 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_events_event_target_h_
+#define dom_events_event_target_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_event_listener;
+struct dom_event;
+struct dom_node_internal;
+
+typedef struct dom_node_internal dom_event_target;
+
+dom_exception _dom_event_target_add_event_listener(dom_event_target *et,
+ struct dom_string *type, struct dom_event_listener *listener,
+ bool capture);
+#define dom_event_target_add_event_listener(et, t, l, c) \
+ _dom_event_target_add_event_listener((dom_event_target *) (et),\
+ (struct dom_string *) (t), (struct dom_event_listener *) (l), \
+ (bool) (c))
+
+dom_exception _dom_event_target_remove_event_listener(dom_event_target *et,
+ struct dom_string *type, struct dom_event_listener *listener,
+ bool capture);
+#define dom_event_target_remove_event_listener(et, t, l, c) \
+ _dom_event_target_remove_event_listener(\
+ (dom_event_target *) (et), (struct dom_string *) (t),\
+ (struct dom_event_listener *) (l), (bool) (c))
+
+dom_exception _dom_event_target_dispatch_event(dom_event_target *et,
+ struct dom_event *evt, bool *success);
+#define dom_event_target_dispatch_event(et, e, s) \
+ _dom_event_target_dispatch_event((dom_event_target *) (et),\
+ (struct dom_event *) (e), (bool *) (s))
+
+dom_exception _dom_event_target_add_event_listener_ns(dom_event_target *et,
+ struct dom_string *namespace, struct dom_string *type,
+ struct dom_event_listener *listener, bool capture);
+#define dom_event_target_add_event_listener_ns(et, n, t, l, c) \
+ _dom_event_target_add_event_listener_ns(\
+ (dom_event_target *) (et), (struct dom_string *) (n),\
+ (struct dom_string *) (t), (struct dom_event_listener *) (l),\
+ (bool) (c))
+
+dom_exception _dom_event_target_remove_event_listener_ns(dom_event_target *et,
+ struct dom_string *namespace, struct dom_string *type,
+ struct dom_event_listener *listener, bool capture);
+#define dom_event_target_remove_event_listener_ns(et, n, t, l, c) \
+ _dom_event_target_remove_event_listener_ns(\
+ (dom_event_target *) (et), (struct dom_string *) (n),\
+ (struct dom_string *) (t), (struct dom_event_listener *) (l),\
+ (bool) (c))
+
+#endif
+
diff --git a/include/dom/events/events.h b/include/dom/events/events.h
new file mode 100644
index 0000000..39a8fe7
--- /dev/null
+++ b/include/dom/events/events.h
@@ -0,0 +1,25 @@
+/*
+ * 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_events_h_
+#define dom_events_h_
+
+#include <dom/events/event.h>
+#include <dom/events/ui_event.h>
+#include <dom/events/custom_event.h>
+#include <dom/events/mouse_event.h>
+#include <dom/events/keyboard_event.h>
+#include <dom/events/mouse_wheel_event.h>
+#include <dom/events/mouse_multi_wheel_event.h>
+#include <dom/events/mutation_event.h>
+#include <dom/events/mutation_name_event.h>
+#include <dom/events/text_event.h>
+#include <dom/events/event_listener.h>
+#include <dom/events/document_event.h>
+#include <dom/events/event_target.h>
+
+#endif
diff --git a/include/dom/events/keyboard_event.h b/include/dom/events/keyboard_event.h
new file mode 100644
index 0000000..bbac4a1
--- /dev/null
+++ b/include/dom/events/keyboard_event.h
@@ -0,0 +1,89 @@
+/*
+ * 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_events_keyboard_event_h_
+#define dom_events_keyboard_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_abstract_view;
+
+typedef struct dom_keyboard_event dom_keyboard_event;
+
+typedef enum {
+ DOM_KEY_LOCATION_STANDARD = 0,
+ DOM_KEY_LOCATION_LEFT = 1,
+ DOM_KEY_LOCATION_RIGHT = 2,
+ DOM_KEY_LOCATION_NUMPAD = 3
+} dom_key_location;
+
+dom_exception _dom_keyboard_event_get_key_identifier(dom_keyboard_event *evt,
+ struct dom_string **ident);
+#define dom_keyboard_event_get_key_identifier(e, i) \
+ _dom_keyboard_event_get_key_identifier( \
+ (dom_keyboard_event *) (e), (struct dom_string **) (i))
+
+dom_exception _dom_keyboard_event_get_key_location(dom_keyboard_event *evt,
+ dom_key_location *loc);
+#define dom_keyboard_event_get_key_location(e, l) \
+ _dom_keyboard_event_get_key_location( \
+ (dom_keyboard_event *) (e), (dom_key_location *) (l))
+
+dom_exception _dom_keyboard_event_get_ctrl_key(dom_keyboard_event *evt,
+ bool *key);
+#define dom_keyboard_event_get_ctrl_key(e, k) _dom_keyboard_event_get_ctrl_key(\
+ (dom_keyboard_event *) (e), (bool *) (k))
+
+dom_exception _dom_keyboard_event_get_shift_key(dom_keyboard_event *evt,
+ bool *key);
+#define dom_keyboard_event_get_shift_key(e, k) \
+ _dom_keyboard_event_get_shift_key((dom_keyboard_event *) (e), \
+ (bool *) (k))
+
+dom_exception _dom_keyboard_event_get_alt_key(dom_keyboard_event *evt,
+ bool *key);
+#define dom_keyboard_event_get_alt_key(e, k) _dom_keyboard_event_get_alt_key(\
+ (dom_keyboard_event *) (e), (bool *) (k))
+
+dom_exception _dom_keyboard_event_get_meta_key(dom_keyboard_event *evt,
+ bool *key);
+#define dom_keyboard_event_get_meta_key(e, k) _dom_keyboard_event_get_meta_key(\
+ (dom_keyboard_event *) (e), (bool *) (k))
+
+dom_exception _dom_keyboard_event_get_modifier_state(dom_keyboard_event *evt,
+ struct dom_string *m, bool *state);
+#define dom_keyboard_event_get_modifier_state(e, m, s) \
+ _dom_keyboard_event_get_modifier_state( \
+ (dom_keyboard_event *) (e), (struct dom_string *) (m),\
+ (bool *) (s))
+
+dom_exception _dom_keyboard_event_init(dom_keyboard_event *evt,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_abstract_view *view, struct dom_string *key_ident,
+ dom_key_location key_loc, struct dom_string *modifier_list);
+#define dom_keyboard_event_init(e, t, b, c, v, ki, kl, m) \
+ _dom_keyboard_event_init((dom_keyboard_event *) (e), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_abstract_view *) (v), (struct dom_string *) (ki), \
+ (dom_key_location) (kl), (struct dom_string *) (m))
+
+dom_exception _dom_keyboard_event_init_ns(dom_keyboard_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_abstract_view *view,
+ struct dom_string *key_ident, dom_key_location key_loc,
+ struct dom_string *modifier_list);
+#define dom_keyboard_event_init_ns(e, n, t, b, c, v, ki, kl, m) \
+ _dom_keyboard_event_init_ns((dom_keyboard_event *) (e), \
+ (struct dom_string *) (n), (struct dom_string *) (t), \
+ (bool) (b), (bool) (c), (struct dom_abstract_view *) (v), \
+ (struct dom_string *) (ki), (dom_key_location) (kl), \
+ (struct dom_string *) (m))
+
+#endif
+
diff --git a/include/dom/events/mouse_event.h b/include/dom/events/mouse_event.h
new file mode 100644
index 0000000..c153dd8
--- /dev/null
+++ b/include/dom/events/mouse_event.h
@@ -0,0 +1,108 @@
+/*
+ * 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_events_mouse_event_h_
+#define dom_events_mouse_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/events/event_target.h>
+
+struct dom_string;
+struct dom_abstract_view;
+
+typedef struct dom_mouse_event dom_mouse_event;
+
+dom_exception _dom_mouse_event_get_screen_x(dom_mouse_event *evt,
+ long *x);
+#define dom_mouse_event_get_screen_x(e, x) _dom_mouse_event_get_screen_x(\
+ (dom_mouse_event *) (e), (long *) (x))
+
+dom_exception _dom_mouse_event_get_screen_y(dom_mouse_event *evt,
+ long *y);
+#define dom_mouse_event_get_screen_y(e, y) _dom_mouse_event_get_screen_y(\
+ (dom_mouse_event *) (e), (long *) (y))
+
+dom_exception _dom_mouse_event_get_client_x(dom_mouse_event *evt,
+ long *x);
+#define dom_mouse_event_get_client_x(e, x) _dom_mouse_event_get_client_x(\
+ (dom_mouse_event *) (e), (long *) (x))
+
+dom_exception _dom_mouse_event_get_client_y(dom_mouse_event *evt,
+ long *y);
+#define dom_mouse_event_get_client_y(e, y) _dom_mouse_event_get_client_y(\
+ (dom_mouse_event *) (e), (long *) (y))
+
+dom_exception _dom_mouse_event_get_ctrl_key(dom_mouse_event *evt,
+ bool *key);
+#define dom_mouse_event_get_ctrl_key(e, k) _dom_mouse_event_get_ctrl_key( \
+ (dom_mouse_event *) (e), (bool *) (k))
+
+dom_exception _dom_mouse_event_get_shift_key(dom_mouse_event *evt,
+ bool *key);
+#define dom_mouse_event_get_shift_key(e, k) _dom_mouse_event_get_shift_key( \
+ (dom_mouse_event *) (e), (bool *) (k))
+
+dom_exception _dom_mouse_event_get_alt_key(dom_mouse_event *evt,
+ bool *key);
+#define dom_mouse_event_get_alt_key(e, k) _dom_mouse_event_get_alt_key( \
+ (dom_mouse_event *) (e), (bool *) (k))
+
+dom_exception _dom_mouse_event_get_meta_key(dom_mouse_event *evt,
+ bool *key);
+#define dom_mouse_event_get_meta_key(e, k) _dom_mouse_event_get_meta_key( \
+ (dom_mouse_event *) (e), (bool *) (k))
+
+dom_exception _dom_mouse_event_get_button(dom_mouse_event *evt,
+ unsigned short *button);
+#define dom_mouse_event_get_button(e, b) _dom_mouse_event_get_button(\
+ (dom_mouse_event *) (e), (unsigned short *) (b))
+
+dom_exception _dom_mouse_event_get_related_target(dom_mouse_event *evt,
+ dom_event_target **et);
+#define dom_mouse_event_get_related_target(e, t) \
+ _dom_mouse_event_get_related_target((dom_mouse_event *) (e),\
+ (dom_event_target **) (t))
+
+dom_exception _dom_mouse_event_get_modifier_state(dom_mouse_event *evt,
+ struct dom_string *m, bool *state);
+#define dom_mouse_event_get_modifier_state(e, m, s) \
+ _dom_mouse_event_get_modifier_state((dom_mouse_event *) (e), \
+ (struct dom_string *) (m), (bool *) (s))
+
+dom_exception _dom_mouse_event_init(dom_mouse_event *evt,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_abstract_view *view, long detail, long screen_x,
+ long screen_y, long client_x, long client_y, bool ctrl,
+ bool alt, bool shift, bool meta, unsigned short button,
+ dom_event_target *et);
+#define dom_mouse_event_init(e, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt, \
+ shift, meta, button, et) \
+ _dom_mouse_event_init((dom_mouse_event *) (e), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c),\
+ (struct dom_abstract_view *) (v), (long) (d), (long) (sx), \
+ (long) (sy), (long) (cx), (long) (cy), (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,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_abstract_view *view,
+ long detail, long screen_x, long screen_y, long client_x,
+ long client_y, bool ctrl, bool alt, bool shift, bool meta,
+ unsigned short button, dom_event_target *et);
+#define dom_mouse_event_init_ns(e, n, t, b, c, v, d, sx, sy, cx, cy, ctrl, alt,\
+ shift, meta, button, et) \
+ _dom_mouse_event_init_ns((dom_mouse_event *) (e), \
+ (struct dom_string *) (n), (struct dom_string *) (t),\
+ (bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\
+ (long) (d), (long) (sx), (long) (sy), (long) (cx),\
+ (long) (cy), (bool) (ctrl), (bool) (alt), (bool) (shift),\
+ (bool) (meta), (unsigned short) (button),\
+ (dom_event_target *) (et))
+
+#endif
diff --git a/include/dom/events/mouse_multi_wheel_event.h b/include/dom/events/mouse_multi_wheel_event.h
new file mode 100644
index 0000000..7bb85ff
--- /dev/null
+++ b/include/dom/events/mouse_multi_wheel_event.h
@@ -0,0 +1,56 @@
+/*
+ * 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_events_mouse_multi_wheel_event_h_
+#define dom_events_mouse_multi_wheel_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/events/event_target.h>
+
+struct dom_string;
+struct dom_abstract_view;
+
+typedef struct dom_mouse_multi_wheel_event dom_mouse_multi_wheel_event;
+
+dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_x(
+ dom_mouse_multi_wheel_event *evt, long *x);
+#define dom_mouse_multi_wheel_event_get_wheel_delta_x(e, x) \
+ _dom_mouse_multi_wheel_event_get_wheel_delta_x( \
+ (dom_mouse_multi_wheel_event *) (e), (long *) (x))
+
+dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_y(
+ dom_mouse_multi_wheel_event *evt, long *y);
+#define dom_mouse_multi_wheel_event_get_wheel_delta_y(e, y) \
+ _dom_mouse_multi_wheel_event_get_wheel_delta_y( \
+ (dom_mouse_multi_wheel_event *) (e), (long *) (y))
+
+dom_exception _dom_mouse_multi_wheel_event_get_wheel_delta_z(
+ dom_mouse_multi_wheel_event *evt, long *z);
+#define dom_mouse_multi_wheel_event_get_wheel_delta_z(e, z) \
+ _dom_mouse_multi_wheel_event_get_wheel_delta_z( \
+ (dom_mouse_multi_wheel_event *) (e), (long *) (z))
+
+dom_exception _dom_mouse_multi_wheel_event_init_ns(
+ dom_mouse_multi_wheel_event *evt, struct dom_string *namespace,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_abstract_view *view, long detail, long screen_x,
+ long screen_y, long client_x, long client_y,
+ unsigned short button, dom_event_target *et,
+ struct dom_string *modifier_list, long wheel_delta_x,
+ long wheel_delta_y, long wheel_delta_z);
+#define dom_mouse_multi_wheel_event_init_ns(e, n, t, b, c, v, \
+ d, sx, sy, cx, cy, button, et, ml, x, y, z) \
+ _dom_mouse_multi_wheel_event_init_ns( \
+ (dom_mouse_multi_wheel_event *) (e), (struct dom_string *) (n),\
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_abstract_view *) (v), (long) (d), (long) (sx), \
+ (long) (sy), (long) (cx), (long) (cy),\
+ (unsigned short) (button), (dom_event_target *) (et),\
+ (struct dom_string *) (ml), (long) (x), (long) (y), (long) (z))
+
+#endif
diff --git a/include/dom/events/mouse_wheel_event.h b/include/dom/events/mouse_wheel_event.h
new file mode 100644
index 0000000..5f1e83c
--- /dev/null
+++ b/include/dom/events/mouse_wheel_event.h
@@ -0,0 +1,42 @@
+/* * 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_events_mouse_wheel_event_h_
+#define dom_events_mouse_wheel_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+#include <dom/events/event_target.h>
+
+struct dom_string;
+struct dom_abstract_view;
+
+typedef struct dom_mouse_wheel_event dom_mouse_wheel_event;
+
+dom_exception _dom_mouse_wheel_event_get_wheel_delta(
+ dom_mouse_wheel_event *evt, long *d);
+#define dom_mouse_wheel_event_get_wheel_delta(e, d) \
+ _dom_mouse_wheel_event_get_wheel_delta( \
+ (dom_mouse_wheel_event *) (e), (long *) (d))
+
+dom_exception _dom_mouse_wheel_event_init_ns(
+ dom_mouse_wheel_event *evt, struct dom_string *namespace,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_abstract_view *view, long detail, long screen_x,
+ long screen_y, long client_x, long client_y,
+ unsigned short button, dom_event_target *et,
+ struct dom_string *modifier_list, long wheel_delta);
+#define dom_mouse_wheel_event_init_ns(e, n, t, b, c, v, \
+ d, sx, sy, cx, cy, button, et, ml, dt) \
+ _dom_mouse_wheel_event_init_ns((dom_mouse_wheel_event *) (e), \
+ (struct dom_string *) (n), (struct dom_string *) (t), \
+ (bool) (b), (bool) (c), (struct dom_abstract_view *) (v),\
+ (long) (d), (long) (sx), (long) (sy), (long) (cx), (long) (cy),\
+ (unsigned short) (button), (dom_event_target *) (et),\
+ (struct dom_string *) (ml), (long) (dt))
+
+#endif
+
diff --git a/include/dom/events/mutation_event.h b/include/dom/events/mutation_event.h
new file mode 100644
index 0000000..9dc3fdd
--- /dev/null
+++ b/include/dom/events/mutation_event.h
@@ -0,0 +1,80 @@
+/*
+ * 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_events_mutation_event_h_
+#define dom_events_mutation_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_node;
+
+typedef enum {
+ DOM_MUTATION_MODIFICATION = 1,
+ DOM_MUTATION_ADDITION = 2,
+ DOM_MUTATION_REMOVAL = 3
+} dom_mutation_type;
+
+typedef struct dom_mutation_event dom_mutation_event;
+
+dom_exception _dom_mutation_event_get_related_node(dom_mutation_event *evt,
+ struct dom_node **node);
+#define dom_mutation_event_get_related_node(e, n) \
+ _dom_mutation_event_get_related_node(\
+ (dom_mutation_event *) (e), (struct dom_node **) (n))
+
+dom_exception _dom_mutation_event_get_prev_value(dom_mutation_event *evt,
+ struct dom_string **ret);
+#define dom_mutation_event_get_prev_value(e, r) \
+ _dom_mutation_event_get_prev_value((dom_mutation_event *) (e), \
+ (struct dom_string **) (r))
+
+dom_exception _dom_mutation_event_get_new_value(dom_mutation_event *evt,
+ struct dom_string **ret);
+#define dom_mutation_event_get_new_value(e, r) \
+ _dom_mutation_event_get_new_value((dom_mutation_event *) (e), \
+ (struct dom_string **) (r))
+
+dom_exception _dom_mutation_event_get_attr_name(dom_mutation_event *evt,
+ struct dom_string **ret);
+#define dom_mutation_event_get_attr_name(e, r) \
+ _dom_mutation_event_get_attr_name((dom_mutation_event *) (e), \
+ (struct dom_string **) (r))
+
+dom_exception _dom_mutation_event_get_attr_change(dom_mutation_event *evt,
+ dom_mutation_type *type);
+#define dom_mutation_event_get_attr_change(e, t) \
+ _dom_mutation_event_get_attr_change((dom_mutation_event *) (e),\
+ (dom_mutation_type *) (t))
+
+dom_exception _dom_mutation_event_init(dom_mutation_event *evt,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_node *node, struct dom_string *prev_value,
+ struct dom_string *new_value, struct dom_string *attr_name,
+ dom_mutation_type change);
+#define dom_mutation_event_init(e, t, b, c, n, p, nv, a, ch) \
+ _dom_mutation_event_init((dom_mutation_event *) (e), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_node *) (n), (struct dom_string *) (p), \
+ (struct dom_string *) (nv), (struct dom_string *) (a), \
+ (dom_mutation_type) (ch))
+
+dom_exception _dom_mutation_event_init_ns(dom_mutation_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_node *node,
+ struct dom_string *prev_value, struct dom_string *new_value,
+ struct dom_string *attr_name, dom_mutation_type change);
+#define dom_mutation_event_init_ns(e, n, t, b, c, nd, p, nv, a, ch) \
+ _dom_mutation_event_init_ns((dom_mutation_event *) (e), \
+ (struct dom_string *) (n), (struct dom_string *) (t),\
+ (bool) (b), (bool) (c), (struct dom_node *) (nd), \
+ (struct dom_string *) (p), (struct dom_string *) (nv),\
+ (struct dom_string *) (a), (dom_mutation_type) (ch))
+
+#endif
+
diff --git a/include/dom/events/mutation_name_event.h b/include/dom/events/mutation_name_event.h
new file mode 100644
index 0000000..13d27a4
--- /dev/null
+++ b/include/dom/events/mutation_name_event.h
@@ -0,0 +1,54 @@
+/*
+ * 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_events_mutation_name_event_h_
+#define dom_events_mutation_name_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_node;
+
+typedef struct dom_mutation_name_event dom_mutation_name_event;
+
+dom_exception _dom_mutation_name_event_get_prev_namespace(
+ dom_mutation_name_event *evt, struct dom_string **namespace);
+#define dom_mutation_name_event_get_prev_namespace(e, n) \
+ _dom_mutation_name_event_get_prev_namespace(\
+ (dom_mutation_name_event *) (e), (struct dom_string **) (n))
+
+dom_exception _dom_mutation_name_event_get_prev_node_name(
+ dom_mutation_name_event *evt, struct dom_string **name);
+#define dom_mutation_name_event_get_prev_node_name(e, n) \
+ _dom_mutation_name_event_get_prev_node_name(\
+ (dom_mutation_name_event *) (e), (struct dom_string **) (n))
+
+dom_exception _dom_mutation_name_event_init(dom_mutation_name_event *evt,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_node *node, struct dom_string *prev_ns,
+ struct dom_string *prev_name);
+#define dom_mutation_name_event_init(e, t, b, c, n, p, pn) \
+ _dom_mutation_name_event_init((dom_mutation_name_event *) (e), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_node *) (n), (struct dom_string *) (p), \
+ (struct dom_string *) (pn))
+
+dom_exception _dom_mutation_name_event_init_ns(dom_mutation_name_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_node *node,
+ struct dom_string *prev_ns, struct dom_string *prev_name);
+#define dom_mutation_name_event_init_ns(e, n, t, b, c, nv, p, pn) \
+ _dom_mutation_name_event_init_ns(\
+ (dom_mutation_name_event *) (e), (struct dom_string *) (n),\
+ (struct dom_string *) (t), (bool) (b), (bool) (c),\
+ (struct dom_node *) (nv), (struct dom_string *) (p), \
+ (struct dom_string *) (pn))
+
+#endif
+
+
diff --git a/include/dom/events/text_event.h b/include/dom/events/text_event.h
new file mode 100644
index 0000000..cf040ce
--- /dev/null
+++ b/include/dom/events/text_event.h
@@ -0,0 +1,41 @@
+/*
+ * 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_events_text_event_h_
+#define dom_events_text_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_abstract_view;
+struct dom_string;
+
+typedef struct dom_text_event dom_text_event;
+
+dom_exception _dom_text_event_get_data(dom_text_event *evt,
+ struct dom_string **data);
+#define dom_text_event_get_data(e, d) _dom_text_event_get_data(\
+ (dom_text_event *) (e), (struct dom_string **) (d))
+
+dom_exception _dom_text_event_init(dom_text_event *evt,
+ struct dom_string *type, bool bubble, bool cancelable,
+ struct dom_abstract_view *view, struct dom_string *data);
+#define dom_text_event_init(e, t, b, c, v, d) _dom_text_event_init( \
+ (dom_text_event *) (e), (struct dom_string *) (t), (bool) (b), \
+ (bool) (c), (struct dom_abstract_view *) (v),\
+ (struct dom_string *) (d))
+
+dom_exception _dom_text_event_init_ns(dom_text_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_abstract_view *view,
+ struct dom_string *data);
+#define dom_text_event_init_ns(e, n, t, b, c, v, d) _dom_text_event_init_ns( \
+ (dom_text_event *) (e), (struct dom_string *) (n), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_abstract_view *) (v), (struct dom_string *) (d))
+
+#endif
diff --git a/include/dom/events/ui_event.h b/include/dom/events/ui_event.h
new file mode 100644
index 0000000..eaded99
--- /dev/null
+++ b/include/dom/events/ui_event.h
@@ -0,0 +1,45 @@
+/*
+ * 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_events_ui_event_h_
+#define dom_events_ui_event_h_
+
+#include <stdbool.h>
+#include <dom/core/exceptions.h>
+
+struct dom_string;
+struct dom_abstract_view;
+
+typedef struct dom_ui_event dom_ui_event;
+
+dom_exception _dom_ui_event_get_view(dom_ui_event *evt,
+ struct dom_abstract_view **view);
+#define dom_ui_event_get_view(e, v) _dom_ui_event_get_view( \
+ (dom_ui_event *) (e), (struct dom_abstract_view **) (v))
+
+dom_exception _dom_ui_event_get_detail(dom_ui_event *evt,
+ long *detail);
+#define dom_ui_event_get_detail(e, d) _dom_ui_event_get_detail(\
+ (dom_ui_event *) (e), (long *) (d))
+
+dom_exception _dom_ui_event_init(dom_ui_event *evt, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_abstract_view *view,
+ long detail);
+#define dom_ui_event_init(e, t, b, c, v, d) _dom_ui_event_init( \
+ (dom_ui_event *) (e), (struct dom_string *) (t), (bool) (b), \
+ (bool) (c), (struct dom_abstract_view *) (v), (long) (d))
+
+dom_exception _dom_ui_event_init_ns(dom_ui_event *evt,
+ struct dom_string *namespace, struct dom_string *type,
+ bool bubble, bool cancelable, struct dom_abstract_view *view,
+ long detail);
+#define dom_ui_event_init_ns(e, n, t, b, c, v, d) _dom_ui_event_init_ns( \
+ (dom_ui_event *) (e), (struct dom_string *) (n), \
+ (struct dom_string *) (t), (bool) (b), (bool) (c), \
+ (struct dom_abstract_view *) (v), (long) (d))
+
+#endif