From 097bb235db5f8bdce32452dae910c03147069f63 Mon Sep 17 00:00:00 2001 From: Matthew Allum Date: Sun, 7 Jan 2007 00:36:41 +0000 Subject: [PATCH] 2007-01-07 Matthew Allum * clutter/clutter-actor.c: (clutter_actor_allocate_coords): Fix an amazingly not noticed until now typo. Minor doc tweaks. * clutter/clutter-behaviour-opacity.c: (clutter_behaviour_alpha_notify): Take into account initial opacity value when calculating from alpha. * clutter/clutter-group.c: Add new get_nth_child() and get_n_children() api calls. --- ChangeLog | 13 +++++++++ clutter/clutter-actor.c | 10 +++---- clutter/clutter-behaviour-opacity.c | 4 ++- clutter/clutter-group.c | 42 +++++++++++++++++++++++++++-- 4 files changed, 61 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2361b5e6..22cc99c28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2007-01-07 Matthew Allum + + * clutter/clutter-actor.c: (clutter_actor_allocate_coords): + Fix an amazingly not noticed until now typo. + Minor doc tweaks. + + * clutter/clutter-behaviour-opacity.c: + (clutter_behaviour_alpha_notify): + Take into account initial opacity value when calculating from alpha. + + * clutter/clutter-group.c: + Add new get_nth_child() and get_n_children() api calls. + 2007-01-04 Matthew Allum * clutter/clutter-actor.c: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index dd991b961..e34a613b7 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -154,8 +154,8 @@ clutter_actor_show (ClutterActor *self) * clutter_actor_show_all: * @self: a #ClutterActor * - * Recursively show an actor, and any child actor if @self is a - * #ClutterGroup. + * Recursively show an actor, and any child actor if @self has + * child actors. * * Since: 0.2 */ @@ -207,7 +207,7 @@ clutter_actor_hide (ClutterActor *self) * @self: a #ClutterActor * * Recursively hides an actor, and any child actor if @self - * is a #ClutterGroup. + * has child actors. * * Since: 0.2 */ @@ -473,7 +473,7 @@ clutter_actor_allocate_coords (ClutterActor *self, box->x2 = self->priv->coords.x2; box->y2 = self->priv->coords.y2; - if (klass->request_coords) + if (klass->allocate_coords) { /* FIXME: This is kind of a cludge - we pass out *private* * co-ords down to any subclasses so they can modify @@ -1434,7 +1434,7 @@ clutter_actor_get_opacity (ClutterActor *self) /* Factor in the actual actors opacity with parents */ if (parent && clutter_actor_get_opacity (parent) != 0xff) - return (clutter_actor_get_opacity(parent) * self->priv->opacity) / 0xff; + return (clutter_actor_get_opacity(parent) * self->priv->opacity) / 0xff; return self->priv->opacity; } diff --git a/clutter/clutter-behaviour-opacity.c b/clutter/clutter-behaviour-opacity.c index 3a0c5fba9..e01475415 100644 --- a/clutter/clutter-behaviour-opacity.c +++ b/clutter/clutter-behaviour-opacity.c @@ -94,11 +94,13 @@ clutter_behaviour_alpha_notify (ClutterBehaviour *behave, ClutterBehaviourOpacityPrivate *priv; priv = CLUTTER_BEHAVIOUR_OPACITY (behave)->priv; - + opacity = alpha_value * (priv->opacity_end - priv->opacity_start) / CLUTTER_ALPHA_MAX_ALPHA; + opacity += priv->opacity_start; + CLUTTER_NOTE (BEHAVIOUR, "alpha: %i, opacity: %i", alpha_value, opacity); diff --git a/clutter/clutter-group.c b/clutter/clutter-group.c index 36120280e..6a8ce231c 100644 --- a/clutter/clutter-group.c +++ b/clutter/clutter-group.c @@ -28,7 +28,7 @@ * @short_description: Base class for actors which contain multiple child * actors. * - * #ClutterGroup is an Actor which can contain multiple child actors. + * A #ClutterGroup is an Actor which can contain multiple child actors. */ #include "config.h" @@ -247,12 +247,50 @@ clutter_group_new (void) GList* clutter_group_get_children (ClutterGroup *self) { - /* FIXME: remane get_actors() */ g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL); return g_list_copy(self->priv->children); } +/** + * clutter_group_get_nth_child: + * @self: A #ClutterGroup + * + * Gets the number of actors held in the group. + * + * Return value: The number of child actors held in the group. + * + * Since: 0.2 + **/ +gint +clutter_group_get_n_children (ClutterGroup *self) +{ + g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL); + + return g_list_length (self->priv->children); +} + +/** + * clutter_group_get_nth_child: + * @self: A #ClutterGroup + * @index: the position of the requested actor. + * + * Gets a groups child held at position index in stack. + * + * Return value: A Clutter actor or NULL if index is invalid. + * + * Since: 0.2 + **/ +ClutterActor* +clutter_group_get_nth_child (ClutterGroup *self, + gint index) +{ + g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL); + + return g_list_nth_data (self->priv->children, index); +} + + /** * clutter_group_foreach: * @self: A #ClutterGroup