diff options
author | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-09-17 12:09:56 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2010-09-17 12:17:50 +0100 |
commit | 5da0064de7b77cdb7147371631cf1b9c31f60509 (patch) | |
tree | 86c4982313e1a2cbf5ebccd6a703ed29da43395b /clutter/clutter-constraint.c | |
parent | bdcac5617be1c6a774259379a668619ba387c2bc (diff) | |
download | clutter-5da0064de7b77cdb7147371631cf1b9c31f60509.tar.gz |
constraint: Add ::update_allocation()
The Constraint should plug directly into the allocation mechanism, and
modify the allocation of the actor to which they are applied to. This is
similar to the mechanism used by the Effect class to modify the paint
sequence of an actor.
Diffstat (limited to 'clutter/clutter-constraint.c')
-rw-r--r-- | clutter/clutter-constraint.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/clutter/clutter-constraint.c b/clutter/clutter-constraint.c index 46f86f7b0..6e0bf2865 100644 --- a/clutter/clutter-constraint.c +++ b/clutter/clutter-constraint.c @@ -8,8 +8,10 @@ * position or size. * * A #ClutterConstraint sub-class should contain the logic for modifying - * the position or size of the #ClutterActor to which it is applied, using - * the various signals and properties of #ClutterActor itself. + * the position or size of the #ClutterActor to which it is applied, by + * updating the actor's allocation. Each #ClutterConstraint can change the + * allocation of the actor to which they are applied by overriding the + * <function>update_allocation()</function> virtual function. * * #ClutterConstraint is available since Clutter 1.4 */ @@ -20,6 +22,7 @@ #include "clutter-constraint.h" +#include "clutter-actor.h" #include "clutter-actor-meta-private.h" G_DEFINE_ABSTRACT_TYPE (ClutterConstraint, @@ -27,11 +30,33 @@ G_DEFINE_ABSTRACT_TYPE (ClutterConstraint, CLUTTER_TYPE_ACTOR_META); static void +constraint_update_allocation (ClutterConstraint *constraint, + ClutterActor *actor, + ClutterActorBox *allocation) +{ +} + +static void clutter_constraint_class_init (ClutterConstraintClass *klass) { + klass->update_allocation = constraint_update_allocation; } static void clutter_constraint_init (ClutterConstraint *self) { } + +void +_clutter_constraint_update_allocation (ClutterConstraint *constraint, + ClutterActor *actor, + ClutterActorBox *allocation) +{ + g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint)); + g_return_if_fail (CLUTTER_IS_ACTOR (actor)); + g_return_if_fail (allocation != NULL); + + CLUTTER_CONSTRAINT_GET_CLASS (constraint)->update_allocation (constraint, + actor, + allocation); +} |