Release Clutter 1.11.4 (snapshot)
[profile/ivi/clutter.git] / clutter / clutter-scriptable.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *             Emmanuele Bassi  <ebassi@openedhand.com>
8  *
9  * Copyright (C) 2006 OpenedHand
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23  */
24
25 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
26 #error "Only <clutter/clutter.h> can be included directly."
27 #endif
28
29 #ifndef __CLUTTER_SCRIPTABLE_H__
30 #define __CLUTTER_SCRIPTABLE_H__
31
32 #include <glib-object.h>
33 #include <json-glib/json-glib.h>
34 #include <clutter/clutter-script.h>
35
36 G_BEGIN_DECLS
37
38 #define CLUTTER_TYPE_SCRIPTABLE                 (clutter_scriptable_get_type ())
39 #define CLUTTER_SCRIPTABLE(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_SCRIPTABLE, ClutterScriptable))
40 #define CLUTTER_IS_SCRIPTABLE(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_SCRIPTABLE))
41 #define CLUTTER_SCRIPTABLE_GET_IFACE(obj)       (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_SCRIPTABLE, ClutterScriptableIface))
42
43 typedef struct _ClutterScriptable               ClutterScriptable;
44 typedef struct _ClutterScriptableIface          ClutterScriptableIface;
45
46 /**
47  * ClutterScriptable:
48  *
49  * #ClutterScriptable is an opaque structure whose members cannot be directly
50  * accessed
51  *
52  * Since: 0.6
53  */
54
55 /**
56  * ClutterScriptableIface:
57  * @set_id: virtual function for setting the id of a scriptable object
58  * @get_id: virtual function for getting the id of a scriptable object
59  * @parse_custom_node: virtual function for parsing complex data containers
60  *   into GObject properties
61  * @set_custom_property: virtual function for setting a custom property
62  *
63  * Interface for implementing "scriptable" objects. An object implementing
64  * this interface can override the parsing and properties setting sequence
65  * when loading a UI definition data with #ClutterScript
66  *
67  * Since: 0.6
68  */
69 struct _ClutterScriptableIface
70 {
71   /*< private >*/
72   GTypeInterface g_iface;
73
74   /*< public >*/
75   void         (* set_id)              (ClutterScriptable *scriptable,
76                                         const gchar       *id_);
77   const gchar *(* get_id)              (ClutterScriptable *scriptable);
78
79   gboolean     (* parse_custom_node)   (ClutterScriptable *scriptable,
80                                         ClutterScript     *script,
81                                         GValue            *value,
82                                         const gchar       *name,
83                                         JsonNode          *node);
84   void         (* set_custom_property) (ClutterScriptable *scriptable,
85                                         ClutterScript     *script,
86                                         const gchar       *name,
87                                         const GValue      *value);
88 };
89
90 GType                 clutter_scriptable_get_type            (void) G_GNUC_CONST;
91
92 void                  clutter_scriptable_set_id              (ClutterScriptable *scriptable,
93                                                               const gchar       *id_);
94 const gchar *         clutter_scriptable_get_id              (ClutterScriptable *scriptable);
95 gboolean              clutter_scriptable_parse_custom_node   (ClutterScriptable *scriptable,
96                                                               ClutterScript     *script,
97                                                               GValue            *value,
98                                                               const gchar       *name,
99                                                               JsonNode          *node);
100 void                  clutter_scriptable_set_custom_property (ClutterScriptable *scriptable,
101                                                               ClutterScript     *script,
102                                                               const gchar       *name,
103                                                               const GValue      *value);
104
105 G_END_DECLS
106
107 #endif /* __CLUTTER_SCRIPTABLE_H__ */