2007-09-28 Øyvind Kolås <pippin@openedhand.com>

* clutter/clutter-container.[ch]: added
	clutter_container_find_child_by_name.
This commit is contained in:
Øyvind Kolås 2007-09-28 14:52:54 +00:00
parent 99c97b3337
commit d93230d1bf
3 changed files with 59 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2007-09-28 Øyvind Kolås <pippin@openedhand.com>
* clutter/clutter-container.[ch]: added
clutter_container_find_child_by_name.
2007-09-28 Øyvind Kolås <pippin@openedhand.com> 2007-09-28 Øyvind Kolås <pippin@openedhand.com>
* clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize): * clutter/glx/clutter-stage-glx.c: (clutter_stage_glx_realize):

View File

@ -504,3 +504,55 @@ clutter_container_sort_depth_order (ClutterContainer *container)
CLUTTER_CONTAINER_GET_IFACE (container)->sort_depth_order (container); CLUTTER_CONTAINER_GET_IFACE (container)->sort_depth_order (container);
} }
/**
* clutter_container_find_child_by_name:
* @container: a #ClutterContainer
* @child_name: the name of the requested child.
*
* Finds a child actor of a container by its name. Search recurses
* into any child container.
*
* Return value: The child actor with the requested name, or %NULL if no
* actor with that name was found.
*
* Since: 0.6
*/
ClutterActor *
clutter_container_find_child_by_name (ClutterContainer *container,
const gchar *child_name)
{
GList *children;
GList *iter;
ClutterActor *actor = NULL;
g_return_val_if_fail (CLUTTER_IS_CONTAINER (container), NULL);
children = clutter_container_get_children (container);
for (iter=children; iter; iter = g_list_next (iter))
{
ClutterActor *a;
const gchar *iter_name;
a = CLUTTER_ACTOR (iter->data);
iter_name = clutter_actor_get_name (a);
if (iter_name && !strcmp (iter_name, child_name))
{
actor = a;
break;
}
if (CLUTTER_IS_CONTAINER (a))
{
ClutterContainer *c = CLUTTER_CONTAINER (a);
actor = clutter_container_find_child_by_name (c, child_name);
if (actor)
break;
}
}
g_list_free (children);
return actor;
}

View File

@ -114,6 +114,8 @@ void clutter_container_foreach (ClutterContainer *container,
gpointer user_data); gpointer user_data);
ClutterActor *clutter_container_find_child_by_id (ClutterContainer *container, ClutterActor *clutter_container_find_child_by_id (ClutterContainer *container,
guint child_id); guint child_id);
ClutterActor *clutter_container_find_child_by_name(ClutterContainer *container,
const gchar *child_name);
void clutter_container_raise_child (ClutterContainer *container, void clutter_container_raise_child (ClutterContainer *container,
ClutterActor *actor, ClutterActor *actor,
ClutterActor *sibling); ClutterActor *sibling);