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
20 #ifndef _SWFDEC_INTERVAL_H_
21 #define _SWFDEC_INTERVAL_H_
23 #include <swfdec/swfdec_as_types.h>
24 #include <swfdec/swfdec_gc_object.h>
25 #include <swfdec/swfdec_player_internal.h>
26 #include <swfdec/swfdec_sandbox.h>
30 typedef struct _SwfdecInterval SwfdecInterval
;
31 typedef struct _SwfdecIntervalClass SwfdecIntervalClass
;
33 #define SWFDEC_TYPE_INTERVAL (swfdec_interval_get_type())
34 #define SWFDEC_IS_INTERVAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_INTERVAL))
35 #define SWFDEC_IS_INTERVAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_INTERVAL))
36 #define SWFDEC_INTERVAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_INTERVAL, SwfdecInterval))
37 #define SWFDEC_INTERVAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_INTERVAL, SwfdecIntervalClass))
38 #define SWFDEC_INTERVAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_INTERVAL, SwfdecIntervalClass))
40 struct _SwfdecInterval
{
41 SwfdecGcObject gc_object
;
43 SwfdecTimeout timeout
;
44 SwfdecSandbox
* sandbox
; /* sandbox we run the script in */
45 guint id
; /* id this interval is identified with */
46 guint msecs
; /* interval in milliseconds */
47 gboolean repeat
; /* TRUE for calling in intervals, FALSE for single-shot */
48 /* if calling named function */
49 const char * fun_name
; /* name of function or NULL if object is function */
51 guint n_args
; /* number of arguments to call function with */
52 SwfdecAsValue
* args
; /* arguments for function */
55 struct _SwfdecIntervalClass
{
56 SwfdecGcObjectClass gc_object_class
;
59 GType
swfdec_interval_get_type (void);
61 guint
swfdec_interval_new_function (SwfdecPlayer
* player
,
64 SwfdecAsFunction
* fun
,
66 const SwfdecAsValue
* args
);
67 guint
swfdec_interval_new_object (SwfdecPlayer
* player
,
70 const SwfdecAsValue
* thisp
,
71 const char * fun_name
,
73 const SwfdecAsValue
* args
);
74 void swfdec_interval_remove (SwfdecPlayer
* player
,