update to 1.10.4
[profile/ivi/clutter.git] / clutter / clutter-child-meta.h
1 /*
2  * Clutter.
3  *
4  * An OpenGL based 'interactive canvas' library.
5  *
6  * Authored By Matthew Allum  <mallum@openedhand.com>
7  *             Jorn Baayen  <jorn@openedhand.com>
8  *             Emmanuele Bassi  <ebassi@openedhand.com>
9  *             Tomas Frydrych <tf@openedhand.com>
10  *             Øyvind Kolås <ok@openedhand.com>
11  *
12  * Copyright (C) 2008 OpenedHand
13  *
14  * This library is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU Lesser General Public
16  * License as published by the Free Software Foundation; either
17  * version 2 of the License, or (at your option) any later version.
18  *
19  * This library is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public
25  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
26  */
27
28 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
29 #error "Only <clutter/clutter.h> can be included directly."
30 #endif
31
32 #ifndef __CLUTTER_CHILD_META_H__
33 #define __CLUTTER_CHILD_META_H__
34
35 #include <glib-object.h>
36 #include <clutter/clutter-types.h>
37
38 G_BEGIN_DECLS
39
40 #define CLUTTER_TYPE_CHILD_META                 (clutter_child_meta_get_type ())
41 #define CLUTTER_CHILD_META(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMeta))
42 #define CLUTTER_CHILD_META_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
43 #define CLUTTER_IS_CHILD_META(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CHILD_META))
44 #define CLUTTER_IS_CHILD_META_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CHILD_META))
45 #define CLUTTER_CHILD_META_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CHILD_META, ClutterChildMetaClass))
46
47 typedef struct _ClutterChildMetaClass           ClutterChildMetaClass;
48
49 /**
50  * ClutterChildMeta:
51  * @container: the container handling this data
52  * @actor: the actor wrapped by this data
53  * 
54  * Base interface for container specific state for child actors. A child
55  * data is meant to be used when you need to keep track of information
56  * about each individual child added to a container.
57  *
58  * In order to use it you should create your own subclass of
59  * #ClutterChildMeta and set the #ClutterContainerIface child_meta_type
60  * interface member to your subclass type, like:
61  *
62  * |[
63  * static void
64  * my_container_iface_init (ClutterContainerIface *iface)
65  * {
66  *   /&ast; set the rest of the #ClutterContainer vtable &ast;/
67  *
68  *   container_iface->child_meta_type  = MY_TYPE_CHILD_META;
69  * }
70  * ]|
71  *
72  * This will automatically create a #ClutterChildMeta of type
73  * MY_TYPE_CHILD_META for every actor that is added to the container.
74  *
75  * The child data for an actor can be retrieved using the
76  * clutter_container_get_child_meta() function.
77  * 
78  * The properties of the data and your subclass can be manipulated with
79  * clutter_container_child_set() and clutter_container_child_get() which
80  * act like g_object_set() and g_object_get().
81  *
82  * You can provide hooks for your own storage as well as control the
83  * instantiation by overriding the #ClutterContainerIface virtual functions
84  * <function>create_child_meta</function>,
85  * <function>destroy_child_meta</function>,
86  * and <function>get_child_meta</function>.
87  *
88  * Since: 0.8
89  */
90 struct _ClutterChildMeta
91 {
92   /*< private >*/
93   GObject parent_instance;
94
95   /*< public >*/
96   ClutterContainer *container;
97   ClutterActor *actor;
98 };
99
100 /**
101  * ClutterChildMetaClass:
102  *
103  * The #ClutterChildMetaClass contains only private data
104  *
105  * Since: 0.8
106  */
107 struct _ClutterChildMetaClass
108 {
109   /*< private >*/
110   GObjectClass parent_class;
111 }; 
112
113 GType             clutter_child_meta_get_type      (void) G_GNUC_CONST;
114
115 ClutterContainer *clutter_child_meta_get_container (ClutterChildMeta *data);
116 ClutterActor     *clutter_child_meta_get_actor     (ClutterChildMeta *data);
117
118 G_END_DECLS
119
120 #endif /* __CLUTTER_CHILD_META_H__ */