Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * This file is part of libdom.
  3.  * Licensed under the MIT License,
  4.  *                http://www.opensource.org/licenses/mit-license.php
  5.  * Copyright 2009 Bo Yang <struggleyb.nku@gmail.com>
  6.  */
  7.  
  8. #ifndef dom_events_mutation_event_h_
  9. #define dom_events_mutation_event_h_
  10.  
  11. #include <stdbool.h>
  12. #include <dom/core/exceptions.h>
  13. #include <dom/core/string.h>
  14.  
  15. struct dom_node;
  16.  
  17. typedef enum {
  18.         DOM_MUTATION_MODIFICATION = 1,
  19.         DOM_MUTATION_ADDITION = 2,
  20.         DOM_MUTATION_REMOVAL = 3
  21. } dom_mutation_type;
  22.  
  23. typedef struct dom_mutation_event dom_mutation_event;
  24.  
  25. dom_exception _dom_mutation_event_get_related_node(dom_mutation_event *evt,
  26.                 struct dom_node **node);
  27. #define dom_mutation_event_get_related_node(e, n) \
  28.                 _dom_mutation_event_get_related_node(\
  29.                 (dom_mutation_event *) (e), (struct dom_node **) (n))
  30.  
  31. dom_exception _dom_mutation_event_get_prev_value(dom_mutation_event *evt,
  32.                 dom_string **ret);
  33. #define dom_mutation_event_get_prev_value(e, r) \
  34.                 _dom_mutation_event_get_prev_value((dom_mutation_event *) (e), \
  35.                 (dom_string **) (r))
  36.  
  37. dom_exception _dom_mutation_event_get_new_value(dom_mutation_event *evt,
  38.                 dom_string **ret);
  39. #define dom_mutation_event_get_new_value(e, r) \
  40.                 _dom_mutation_event_get_new_value((dom_mutation_event *) (e), \
  41.                 (dom_string **) (r))
  42.  
  43. dom_exception _dom_mutation_event_get_attr_name(dom_mutation_event *evt,
  44.                 dom_string **ret);
  45. #define dom_mutation_event_get_attr_name(e, r) \
  46.                 _dom_mutation_event_get_attr_name((dom_mutation_event *) (e), \
  47.                 (dom_string **) (r))
  48.  
  49. dom_exception _dom_mutation_event_get_attr_change(dom_mutation_event *evt,
  50.                 dom_mutation_type *type);
  51. #define dom_mutation_event_get_attr_change(e, t) \
  52.                 _dom_mutation_event_get_attr_change((dom_mutation_event *) (e),\
  53.                 (dom_mutation_type *) (t))
  54.  
  55. dom_exception _dom_mutation_event_init(dom_mutation_event *evt,
  56.                 dom_string *type, bool bubble, bool cancelable,
  57.                 struct dom_node *node, dom_string *prev_value,
  58.                 dom_string *new_value, dom_string *attr_name,
  59.                 dom_mutation_type change);
  60. #define dom_mutation_event_init(e, t, b, c, n, p, nv, a, ch) \
  61.                 _dom_mutation_event_init((dom_mutation_event *) (e), \
  62.                 (dom_string *) (t), (bool) (b), (bool) (c), \
  63.                 (struct dom_node *) (n), (dom_string *) (p), \
  64.                 (dom_string *) (nv), (dom_string *) (a), \
  65.                 (dom_mutation_type) (ch))
  66.  
  67. dom_exception _dom_mutation_event_init_ns(dom_mutation_event *evt,
  68.                 dom_string *namespace, dom_string *type,
  69.                 bool bubble, bool cancelable, struct dom_node *node,
  70.                 dom_string *prev_value, dom_string *new_value,
  71.                 dom_string *attr_name, dom_mutation_type change);
  72. #define dom_mutation_event_init_ns(e, n, t, b, c, nd, p, nv, a, ch) \
  73.                 _dom_mutation_event_init_ns((dom_mutation_event *) (e), \
  74.                 (dom_string *) (n), (dom_string *) (t),\
  75.                 (bool) (b), (bool) (c), (struct dom_node *) (nd), \
  76.                 (dom_string *) (p), (dom_string *) (nv),\
  77.                 (dom_string *) (a), (dom_mutation_type) (ch))
  78.  
  79. #endif
  80.  
  81.