[clutter/wip/apocalypses/apocalypse-1: 55/92] actor: Add replace_child() method
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-1: 55/92] actor: Add replace_child() method
- Date: Tue, 3 Jan 2012 22:24:48 +0000 (UTC)
commit 43722ae457be59fbf79888d90b1e16931b2e7124
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Dec 18 22:14:36 2011 +0000
actor: Add replace_child() method
A simple method that atomically replaces a child actor with another one.
clutter/clutter-actor.c | 30 ++++++++++++++++++++++++++++++
clutter/clutter-actor.h | 3 +++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 7b5c819..dd36d6e 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -10023,6 +10023,36 @@ clutter_actor_remove_child (ClutterActor *self,
}
/**
+ * clutter_actor_replace_child:
+ * @self: a #ClutterActor
+ * @old_child: the child of @self to replace
+ * @new_child: the #ClutterActor to replace @old_child
+ *
+ * Replaces @old_child with @new_child in the list of children of @self.
+ *
+ * Since: 1.10
+ */
+void
+clutter_actor_replace_child (ClutterActor *self,
+ ClutterActor *old_child,
+ ClutterActor *new_child)
+{
+ g_return_if_fail (CLUTTER_IS_ACTOR (self));
+ g_return_if_fail (CLUTTER_IS_ACTOR (old_child));
+ g_return_if_fail (old_child->priv->parent == self);
+ g_return_if_fail (CLUTTER_IS_ACTOR (new_child));
+ g_return_if_fail (old_child != new_child);
+ g_return_if_fail (new_child != self);
+ g_return_if_fail (new_child->priv->parent == NULL);
+
+ clutter_actor_add_child_internal (self, new_child,
+ insert_child_above,
+ old_child,
+ TRUE, TRUE);
+ clutter_actor_remove_child_internal (self, old_child, TRUE, TRUE);
+}
+
+/**
* clutter_actor_unparent:
* @self: a #ClutterActor
*
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 54aadaa..feb1f64 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -461,6 +461,9 @@ void clutter_actor_insert_child_above (ClutterActor
void clutter_actor_insert_child_below (ClutterActor *self,
ClutterActor *child,
ClutterActor *sibling);
+void clutter_actor_replace_child (ClutterActor *self,
+ ClutterActor *old_child,
+ ClutterActor *new_child);
void clutter_actor_remove_child (ClutterActor *self,
ClutterActor *child);
GList * clutter_actor_get_children (ClutterActor *self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]