GNOME Bugzilla – Bug 668669
Add iterator API for ClutterActor
Last modified: 2012-01-27 11:56:48 UTC
A proper iterator API saves us a bunch of type checks, and it provides a nice entry point for common operations like iterating over children and ancestors.
Created attachment 206097 [details] [review] actor: Add ClutterActorIter Iterating over children and ancestors of an actor is a relatively common operation. Currently, you only have one option: start a for() loop, get the first child of the actor, and advance to the next sibling for the list of children; or start a for() loop and advance to the parent of the actor. These operations can be easily done through the ClutterActor API, but they all require going through the public API, and performing multiple type checks on the arguments. Along with the DOM API, it would be nice to have an ancillary, utility API that uses an iterator structure to hold the state, and can be advanced in a loop.
Created attachment 206098 [details] [review] stage: Use the iterator API instead of the DOM one Whenever we're iterating over the children of the Stage we can now use the ClutterActorIter API.
Created attachment 206102 [details] [review] actor: Add 'reverse' to the iterator flags Iterating from the last child is another common task, and it should be possible to perform it through the iterator API.
Created attachment 206204 [details] [review] actor: Add ClutterActorIter Iterating over children and ancestors of an actor is a relatively common operation. Currently, you only have one option: start a for() loop, get the first child of the actor, and advance to the next sibling for the list of children; or start a for() loop and advance to the parent of the actor. These operations can be easily done through the ClutterActor API, but they all require going through the public API, and performing multiple type checks on the arguments. Along with the DOM API, it would be nice to have an ancillary, utility API that uses an iterator structure to hold the state, and can be advanced in a loop.
Created attachment 206205 [details] [review] stage: Use the iterator API instead of the DOM one Whenever we're iterating over the children of the Stage we can now use the ClutterActorIter API.
Created attachment 206206 [details] [review] box: Use the ActorIter API And remove a useless override of the pick() virtual function while we're at it.
Attachment 206204 [details] pushed as 58ffcfb - actor: Add ClutterActorIter Attachment 206205 [details] pushed as c6e1491 - stage: Use the iterator API instead of the DOM one Attachment 206206 [details] pushed as 5c9c5d2 - box: Use the ActorIter API