actor: Provide Container::raise/lower implementations

This commit is contained in:
Emmanuele Bassi 2011-11-21 14:53:14 +00:00 committed by Emmanuele Bassi
parent 752151bc97
commit 4453ee7266

View File

@ -9239,7 +9239,7 @@ clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
} }
static void static void
actor_add_actor (ClutterContainer *container, container_add_actor (ClutterContainer *container,
ClutterActor *actor) ClutterActor *actor)
{ {
clutter_actor_add_child (CLUTTER_ACTOR (container), actor); clutter_actor_add_child (CLUTTER_ACTOR (container), actor);
@ -9249,7 +9249,7 @@ actor_add_actor (ClutterContainer *container,
} }
static void static void
actor_remove_actor (ClutterContainer *container, container_remove_actor (ClutterContainer *container,
ClutterActor *actor) ClutterActor *actor)
{ {
g_object_ref (actor); g_object_ref (actor);
@ -9279,7 +9279,7 @@ foreach_cb (ClutterActor *actor,
} }
static void static void
actor_foreach (ClutterContainer *container, container_foreach (ClutterContainer *container,
ClutterCallback callback, ClutterCallback callback,
gpointer user_data) gpointer user_data)
{ {
@ -9293,12 +9293,59 @@ actor_foreach (ClutterContainer *container,
&clos); &clos);
} }
static void
container_raise (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
ClutterActorPrivate *priv = self->priv;
priv->children = g_list_remove (priv->children, child);
if (sibling == NULL)
priv->children = g_list_append (priv->children, child);
else
{
gint index_ = g_list_index (priv->children, sibling) + 1;
priv->children = g_list_insert (priv->children, child, index_);
}
clutter_actor_queue_relayout (self);
}
static void
container_lower (ClutterContainer *container,
ClutterActor *child,
ClutterActor *sibling)
{
ClutterActor *self = CLUTTER_ACTOR (container);
ClutterActorPrivate *priv = self->priv;
priv->children = g_list_remove (priv->children, child);
if (sibling == NULL)
priv->children = g_list_prepend (priv->children, child);
else
{
gint index_ = g_list_index (priv->children, sibling);
priv->children = g_list_insert (priv->children, child, index_);
}
clutter_actor_queue_relayout (self);
}
static void static void
clutter_container_iface_init (ClutterContainerIface *iface) clutter_container_iface_init (ClutterContainerIface *iface)
{ {
iface->add = actor_add_actor; iface->add = container_add_actor;
iface->remove = actor_remove_actor; iface->remove = container_remove_actor;
iface->foreach = actor_foreach; iface->foreach = container_foreach;
iface->raise = container_raise;
iface->lower = container_lower;
} }
typedef enum typedef enum