mirror of
https://github.com/brl/mutter.git
synced 2025-03-25 04:33:52 +00:00
Implement ClutterContainer::find_child_by_id() in ClutterBox
Iterate (recursively) on the children of a box to find the one with the given unique id.
This commit is contained in:
parent
d9b421de40
commit
57c0be73cd
@ -126,12 +126,47 @@ clutter_box_foreach (ClutterContainer *container,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterActor *
|
||||||
|
clutter_box_find_child_by_id (ClutterContainer *container,
|
||||||
|
guint child_id)
|
||||||
|
{
|
||||||
|
ClutterBox *self = CLUTTER_BOX (container);
|
||||||
|
ClutterActor *actor = NULL;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
if (clutter_actor_get_id (CLUTTER_ACTOR (self)) == child_id)
|
||||||
|
return CLUTTER_ACTOR (self);
|
||||||
|
|
||||||
|
for (l = self->children; l; l = l->next)
|
||||||
|
{
|
||||||
|
ClutterBoxChild *child = l->data;
|
||||||
|
|
||||||
|
if (clutter_actor_get_id (child->actor) == child_id)
|
||||||
|
{
|
||||||
|
actor = child->actor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CLUTTER_IS_CONTAINER (child->actor))
|
||||||
|
{
|
||||||
|
ClutterContainer *c = CLUTTER_CONTAINER (child->actor);
|
||||||
|
|
||||||
|
actor = clutter_container_find_child_by_id (c, child_id);
|
||||||
|
if (actor)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return actor;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_container_iface_init (ClutterContainerIface *iface)
|
clutter_container_iface_init (ClutterContainerIface *iface)
|
||||||
{
|
{
|
||||||
iface->add = clutter_box_add;
|
iface->add = clutter_box_add;
|
||||||
iface->remove = clutter_box_remove;
|
iface->remove = clutter_box_remove;
|
||||||
iface->foreach = clutter_box_foreach;
|
iface->foreach = clutter_box_foreach;
|
||||||
|
iface->find_child_by_id = clutter_box_find_child_by_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
x
Reference in New Issue
Block a user