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
#ifndef __CLUTTER_CONTAINER_H__
28
#define __CLUTTER_CONTAINER_H__
30
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
31
#error "Only <clutter/clutter.h> can be included directly."
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
CLUTTER_AVAILABLE_IN_ALL
145
GType clutter_container_get_type (void) G_GNUC_CONST;
147
CLUTTER_AVAILABLE_IN_ALL
148
ClutterActor * clutter_container_find_child_by_name (ClutterContainer *container,
149
const gchar *child_name);
151
CLUTTER_AVAILABLE_IN_ALL
152
GParamSpec * clutter_container_class_find_child_property (GObjectClass *klass,
153
const gchar *property_name);
154
CLUTTER_AVAILABLE_IN_ALL
155
GParamSpec ** clutter_container_class_list_child_properties (GObjectClass *klass,
156
guint *n_properties);
158
CLUTTER_AVAILABLE_IN_ALL
159
void clutter_container_create_child_meta (ClutterContainer *container,
160
ClutterActor *actor);
161
CLUTTER_AVAILABLE_IN_ALL
162
void clutter_container_destroy_child_meta (ClutterContainer *container,
163
ClutterActor *actor);
164
CLUTTER_AVAILABLE_IN_ALL
165
ClutterChildMeta * clutter_container_get_child_meta (ClutterContainer *container,
166
ClutterActor *actor);
168
CLUTTER_AVAILABLE_IN_ALL
169
void clutter_container_child_set_property (ClutterContainer *container,
171
const gchar * property,
172
const GValue *value);
173
CLUTTER_AVAILABLE_IN_ALL
174
void clutter_container_child_get_property (ClutterContainer *container,
176
const gchar *property,
178
CLUTTER_AVAILABLE_IN_ALL
179
void clutter_container_child_set (ClutterContainer *container,
181
const gchar *first_prop,
182
...) G_GNUC_NULL_TERMINATED;
183
CLUTTER_AVAILABLE_IN_ALL
184
void clutter_container_child_get (ClutterContainer *container,
186
const gchar *first_prop,
187
...) G_GNUC_NULL_TERMINATED;
189
CLUTTER_AVAILABLE_IN_ALL
190
void clutter_container_child_notify (ClutterContainer *container,
196
#endif /* __CLUTTER_CONTAINER_H__ */