4 * An OpenGL based 'interactive canvas' library.
6 * Authored By Matthew Allum <mallum@openedhand.com>
8 * Copyright (C) 2006 OpenedHand
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
23 * ClutterContainer: Generic actor container interface.
24 * Author: Emmanuele Bassi <ebassi@openedhand.com>
27 #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
28 #error "Only <clutter/clutter.h> can be included directly."
31 #ifndef __CLUTTER_CONTAINER_H__
32 #define __CLUTTER_CONTAINER_H__
34 #include <clutter/clutter-actor.h>
35 #include <clutter/clutter-child-meta.h>
36 #include <clutter/clutter-types.h>
40 #define CLUTTER_TYPE_CONTAINER (clutter_container_get_type ())
41 #define CLUTTER_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainer))
42 #define CLUTTER_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CONTAINER))
43 #define CLUTTER_CONTAINER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CLUTTER_TYPE_CONTAINER, ClutterContainerIface))
45 typedef struct _ClutterContainerIface ClutterContainerIface;
50 * #ClutterContainer is an opaque structure whose members cannot be directly
57 * ClutterContainerIface:
58 * @add: virtual function for adding an actor to the container. This virtual
59 * function is deprecated, and it should not be overridden.
60 * @remove: virtual function for removing an actor from the container. This
61 * virtual function is deprecated, and it should not be overridden.
62 * @foreach: virtual function for iterating over the container's children.
63 * This virtual function is deprecated, and it should not be overridden.
64 * @foreach_with_internals: virtual functions for iterating over the
65 * container's children, both added using the #ClutterContainer API
66 * and internal children. The implementation of this virtual function
67 * is required only if the #ClutterContainer implementation has
68 * internal children. This virtual function is deprecated, and it should
70 * @raise: virtual function for raising a child. This virtual function is
71 * deprecated and it should not be overridden.
72 * @lower: virtual function for lowering a child. This virtual function is
73 * deprecated and it should not be overridden.
74 * @sort_depth_order: virtual function for sorting the children of a
75 * container depending on their depth. This virtual function is deprecated
76 * and it should not be overridden.
77 * @child_meta_type: The GType used for storing auxiliary information about
78 * each of the containers children.
79 * @create_child_meta: virtual function that gets called for each added
80 * child, the function should instantiate an object of type
81 * #ClutterContainerIface::child_meta_type, set the container and actor
82 * fields in the instance and add the record to a data structure for
83 * subsequent access for #ClutterContainerIface::get_child_meta
84 * @destroy_child_meta: virtual function that gets called when a child is
85 * removed; it shuld release all resources held by the record
86 * @get_child_meta: return the record for a container child
87 * @actor_added: class handler for #ClutterContainer::actor-added
88 * @actor_removed: class handler for #ClutterContainer::actor-removed
89 * @child_notify: class handler for #ClutterContainer::child-notify
91 * Base interface for container actors. The @add, @remove and @foreach
92 * virtual functions must be provided by any implementation; the other
93 * virtual functions are optional.
97 struct _ClutterContainerIface
100 GTypeInterface g_iface;
103 void (* add) (ClutterContainer *container,
104 ClutterActor *actor);
105 void (* remove) (ClutterContainer *container,
106 ClutterActor *actor);
107 void (* foreach) (ClutterContainer *container,
108 ClutterCallback callback,
111 void (* foreach_with_internals) (ClutterContainer *container,
112 ClutterCallback callback,
116 void (* raise) (ClutterContainer *container,
118 ClutterActor *sibling);
119 void (* lower) (ClutterContainer *container,
121 ClutterActor *sibling);
122 void (* sort_depth_order) (ClutterContainer *container);
124 /* ClutterChildMeta management */
125 GType child_meta_type;
126 void (* create_child_meta) (ClutterContainer *container,
127 ClutterActor *actor);
128 void (* destroy_child_meta) (ClutterContainer *container,
129 ClutterActor *actor);
130 ClutterChildMeta *(* get_child_meta) (ClutterContainer *container,
131 ClutterActor *actor);
134 void (* actor_added) (ClutterContainer *container,
135 ClutterActor *actor);
136 void (* actor_removed) (ClutterContainer *container,
137 ClutterActor *actor);
139 void (* child_notify) (ClutterContainer *container,
144 GType clutter_container_get_type (void) G_GNUC_CONST;
146 ClutterActor *clutter_container_find_child_by_name (ClutterContainer *container,
147 const gchar *child_name);
149 GParamSpec * clutter_container_class_find_child_property (GObjectClass *klass,
150 const gchar *property_name);
151 GParamSpec ** clutter_container_class_list_child_properties (GObjectClass *klass,
152 guint *n_properties);
154 void clutter_container_create_child_meta (ClutterContainer *container,
155 ClutterActor *actor);
156 void clutter_container_destroy_child_meta (ClutterContainer *container,
157 ClutterActor *actor);
158 ClutterChildMeta *clutter_container_get_child_meta (ClutterContainer *container,
159 ClutterActor *actor);
161 void clutter_container_child_set_property (ClutterContainer *container,
163 const gchar * property,
164 const GValue *value);
165 void clutter_container_child_get_property (ClutterContainer *container,
167 const gchar *property,
169 void clutter_container_child_set (ClutterContainer *container,
171 const gchar *first_prop,
172 ...) G_GNUC_NULL_TERMINATED;
173 void clutter_container_child_get (ClutterContainer *container,
175 const gchar *first_prop,
176 ...) G_GNUC_NULL_TERMINATED;
178 void clutter_container_child_notify (ClutterContainer *container,
184 #endif /* __CLUTTER_CONTAINER_H__ */