4 * An OpenGL based 'interactive canvas' library.
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>
12 * Copyright (C) 2008 OpenedHand
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.
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.
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/>.
29 * SECTION:clutter-child-meta
30 * @short_description: Wrapper for actors inside a container
32 * #ClutterChildMeta is a wrapper object created by #ClutterContainer
33 * implementations in order to store child-specific data and properties.
35 * A #ClutterChildMeta wraps a #ClutterActor inside a #ClutterContainer.
37 * #ClutterChildMeta is available since Clutter 0.8
43 #include "clutter-child-meta.h"
44 #include "clutter-container.h"
45 #include "clutter-debug.h"
46 #include "clutter-private.h"
48 G_DEFINE_ABSTRACT_TYPE (ClutterChildMeta, clutter_child_meta, G_TYPE_OBJECT);
60 static GParamSpec *obj_props[PROP_LAST];
63 clutter_child_meta_set_property (GObject *object,
68 ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
73 child_meta->container = g_value_get_object (value);
77 child_meta->actor = g_value_get_object (value);
81 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
87 clutter_child_meta_get_property (GObject *object,
92 ClutterChildMeta *child_meta = CLUTTER_CHILD_META (object);
97 g_value_set_object (value, child_meta->container);
101 g_value_set_object (value, child_meta->actor);
105 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
111 clutter_child_meta_class_init (ClutterChildMetaClass *klass)
113 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
115 gobject_class->set_property = clutter_child_meta_set_property;
116 gobject_class->get_property = clutter_child_meta_get_property;
119 * ClutterChildMeta:container:
121 * The #ClutterContainer that created this #ClutterChildMeta.
125 obj_props[PROP_CONTAINER] =
126 g_param_spec_object ("container",
128 P_("The container that created this data"),
129 CLUTTER_TYPE_CONTAINER,
130 G_PARAM_CONSTRUCT_ONLY |
131 CLUTTER_PARAM_READWRITE);
134 * ClutterChildMeta:actor:
136 * The #ClutterActor being wrapped by this #ClutterChildMeta
140 obj_props[PROP_ACTOR] =
141 g_param_spec_object ("actor",
143 P_("The actor wrapped by this data"),
145 G_PARAM_CONSTRUCT_ONLY |
146 CLUTTER_PARAM_READWRITE);
148 g_object_class_install_properties (gobject_class,
154 clutter_child_meta_init (ClutterChildMeta *self)
159 * clutter_child_meta_get_container:
160 * @data: a #ClutterChildMeta
162 * Retrieves the container using @data
164 * Return value: (transfer none): a #ClutterContainer
169 clutter_child_meta_get_container (ClutterChildMeta *data)
171 g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);
173 return data->container;
177 * clutter_child_meta_get_actor:
178 * @data: a #ClutterChildMeta
180 * Retrieves the actor wrapped by @data
182 * Return value: (transfer none): a #ClutterActor
187 clutter_child_meta_get_actor (ClutterChildMeta *data)
189 g_return_val_if_fail (CLUTTER_IS_CHILD_META (data), NULL);