2 * Copyright (C) 2007 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.
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
24 #include "vivi_wrap.h"
25 #include "vivi_application.h"
26 #include "vivi_function.h"
28 VIVI_FUNCTION ("wrap_toString", vivi_wrap_toString
)
30 vivi_wrap_toString (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
31 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
35 if (!VIVI_IS_WRAP (this))
38 wrap
= VIVI_WRAP (this);
39 if (wrap
->wrap
== NULL
)
42 SWFDEC_AS_VALUE_SET_STRING (retval
, swfdec_as_context_get_string (cx
, "Here be debugging output"));
45 VIVI_FUNCTION ("wrap_get", vivi_wrap_get
)
47 vivi_wrap_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
48 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
50 ViviApplication
*app
= VIVI_APPLICATION (cx
);
55 if (!VIVI_IS_WRAP (this) || argc
== 0)
57 wrap
= VIVI_WRAP (this);
58 if (wrap
->wrap
== NULL
)
61 name
= swfdec_as_value_to_string (cx
, &argv
[0]);
62 swfdec_as_object_get_variable (wrap
->wrap
,
63 swfdec_as_context_get_string (SWFDEC_AS_CONTEXT (app
->player
), name
),
65 vivi_wrap_value (app
, retval
, &val
);
68 /*** FRAME specific code ***/
70 VIVI_FUNCTION ("frame_name_get", vivi_wrap_name_get
)
72 vivi_wrap_name_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
73 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
79 if (!VIVI_IS_WRAP (this))
82 wrap
= VIVI_WRAP (this);
85 s
= swfdec_as_object_get_debug (wrap
->wrap
);
86 SWFDEC_AS_VALUE_SET_STRING (retval
, swfdec_as_context_give_string (cx
, s
));
90 VIVI_FUNCTION ("frame_code_get", vivi_wrap_code_get
)
92 vivi_wrap_code_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
93 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
99 if (!VIVI_IS_WRAP (this))
102 wrap
= VIVI_WRAP (this);
103 if (!SWFDEC_IS_AS_FRAME (wrap
->wrap
))
106 script
= swfdec_as_frame_get_script (SWFDEC_AS_FRAME (wrap
->wrap
));
107 /* FIXME: wrap scripts */
109 SWFDEC_AS_VALUE_SET_BOOLEAN (retval
, TRUE
);
113 VIVI_FUNCTION ("frame_next_get", vivi_wrap_next_get
)
115 vivi_wrap_next_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
116 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
122 if (!VIVI_IS_WRAP (this))
125 wrap
= VIVI_WRAP (this);
126 if (!SWFDEC_IS_AS_FRAME (wrap
->wrap
))
129 obj
= SWFDEC_AS_OBJECT (swfdec_as_frame_get_next (SWFDEC_AS_FRAME (wrap
->wrap
)));
131 SWFDEC_AS_VALUE_SET_OBJECT (retval
, vivi_wrap_object (VIVI_APPLICATION (cx
), obj
));
135 VIVI_FUNCTION ("frame_this_get", vivi_wrap_this_get
)
137 vivi_wrap_this_get (SwfdecAsContext
*cx
, SwfdecAsObject
*this,
138 guint argc
, SwfdecAsValue
*argv
, SwfdecAsValue
*retval
)
144 if (!VIVI_IS_WRAP (this))
147 wrap
= VIVI_WRAP (this);
148 if (!SWFDEC_IS_AS_FRAME (wrap
->wrap
))
151 obj
= SWFDEC_AS_OBJECT (swfdec_as_frame_get_this (SWFDEC_AS_FRAME (wrap
->wrap
)));
153 SWFDEC_AS_VALUE_SET_OBJECT (retval
, vivi_wrap_object (VIVI_APPLICATION (cx
), obj
));