add blend mode tests
[swfdec.git] / swfdec / swfdec_as_object.h
blob6df1cb66599c1abbb6b45f1c1c58f64da3cdd065
1 /* Swfdec
2 * Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA
20 #ifndef _SWFDEC_AS_OBJECT_H_
21 #define _SWFDEC_AS_OBJECT_H_
23 #include <glib-object.h>
24 #include <swfdec/swfdec_as_types.h>
26 G_BEGIN_DECLS
28 /* NB: matches ASSetPropFlags */
29 typedef enum {
30 SWFDEC_AS_VARIABLE_HIDDEN = (1 << 0),
31 SWFDEC_AS_VARIABLE_PERMANENT = (1 << 1),
32 SWFDEC_AS_VARIABLE_CONSTANT = (1 << 2),
34 SWFDEC_AS_VARIABLE_VERSION_6_UP = (1 << 7),
35 SWFDEC_AS_VARIABLE_VERSION_NOT_6 = (1 << 8),
36 SWFDEC_AS_VARIABLE_VERSION_7_UP = (1 << 10),
37 SWFDEC_AS_VARIABLE_VERSION_8_UP = (1 << 12),
38 SWFDEC_AS_VARIABLE_VERSION_9_UP = (1 << 13),
39 } SwfdecAsVariableFlag;
41 typedef enum {
42 SWFDEC_AS_DELETE_NOT_FOUND = 0,
43 SWFDEC_AS_DELETE_DELETED,
44 SWFDEC_AS_DELETE_NOT_DELETED
45 } SwfdecAsDeleteReturn;
47 typedef gboolean (* SwfdecAsVariableForeach) (SwfdecAsObject *object,
48 const char *variable, SwfdecAsValue *value, guint flags, gpointer data);
50 struct _SwfdecAsObject {
51 /*< private >*/
52 SwfdecAsObject * next; /* GC management */
53 SwfdecAsContext * context; /* the context that manages the object */
54 gboolean array:1; /* TRUE if object is an array */
55 gboolean super:1; /* TRUE if object is a super object */
56 gboolean movie:1; /* TRUE if object is really a MovieClip */
57 SwfdecAsObject * prototype; /* prototype object (referred to as __proto__) */
58 guint prototype_flags; /* propflags for the prototype object */
59 GHashTable * properties; /* string->SwfdecAsVariable mapping or NULL when not in GC */
60 GHashTable * watches; /* string->WatchData mapping or NULL when not watching anything */
61 GSList * interfaces; /* list of interfaces this object implements */
62 SwfdecAsRelay * relay; /* object we relay data to */
66 SwfdecAsObject *swfdec_as_object_new (SwfdecAsContext * context,
67 ...) G_GNUC_NULL_TERMINATED;
68 SwfdecAsObject *swfdec_as_object_new_empty (SwfdecAsContext * context);
69 SwfdecAsObject * swfdec_as_object_set_constructor_by_name
70 (SwfdecAsObject * object,
71 const char * name,
72 ...) G_GNUC_NULL_TERMINATED;
73 SwfdecAsObject * swfdec_as_object_set_constructor_by_namev
74 (SwfdecAsObject * object,
75 const char * name,
76 va_list args);
77 void swfdec_as_object_create (SwfdecAsFunction * fun,
78 guint n_args,
79 const SwfdecAsValue * args,
80 SwfdecAsValue * return_value);
81 void swfdec_as_object_set_constructor(SwfdecAsObject * object,
82 SwfdecAsObject * construct);
83 SwfdecAsObject *swfdec_as_object_resolve (SwfdecAsObject * object);
84 void swfdec_as_object_mark (SwfdecAsObject * object);
86 void swfdec_as_object_set_relay (SwfdecAsObject * object,
87 SwfdecAsRelay * relay);
89 /* I'd like to name these [gs]et_property, but binding authors will complain
90 * about overlap with g_object_[gs]et_property then */
91 #define swfdec_as_object_set_variable(object, variable, value) \
92 swfdec_as_object_set_variable_and_flags (object, variable, value, 0)
93 void swfdec_as_object_set_variable_and_flags
94 (SwfdecAsObject * object,
95 const char * variable,
96 const SwfdecAsValue * value,
97 guint default_flags);
98 void swfdec_as_object_add_variable (SwfdecAsObject * object,
99 const char * variable,
100 SwfdecAsFunction * get,
101 SwfdecAsFunction * set,
102 guint default_flags);
103 #define swfdec_as_object_get_variable(object, variable, value) \
104 swfdec_as_object_get_variable_and_flags (object, variable, value, NULL, NULL)
105 gboolean swfdec_as_object_get_variable_and_flags
106 (SwfdecAsObject * object,
107 const char * variable,
108 SwfdecAsValue * value,
109 guint * flags,
110 SwfdecAsObject ** pobject);
111 SwfdecAsObject *swfdec_as_object_has_variable (SwfdecAsObject * object,
112 const char * variable);
113 SwfdecAsDeleteReturn
114 swfdec_as_object_delete_variable(SwfdecAsObject * object,
115 const char * variable);
116 void swfdec_as_object_delete_all_variables
117 (SwfdecAsObject * object);
118 void swfdec_as_object_set_variable_flags
119 (SwfdecAsObject * object,
120 const char * variable,
121 SwfdecAsVariableFlag flags);
122 void swfdec_as_object_unset_variable_flags
123 (SwfdecAsObject * object,
124 const char * variable,
125 SwfdecAsVariableFlag flags);
126 gboolean swfdec_as_object_foreach (SwfdecAsObject * object,
127 SwfdecAsVariableForeach func,
128 gpointer data);
129 GSList * swfdec_as_object_enumerate (SwfdecAsObject * object);
131 SwfdecAsFunction *swfdec_as_object_add_function (SwfdecAsObject * object,
132 const char * name,
133 SwfdecAsNative native);
135 gboolean swfdec_as_object_call (SwfdecAsObject * object,
136 const char * name,
137 guint argc,
138 SwfdecAsValue * argv,
139 SwfdecAsValue * return_value);
140 void swfdec_as_object_run (SwfdecAsObject * object,
141 SwfdecScript * script);
144 G_END_DECLS
145 #endif