[clutter/clutter-1.22] constraint: Add the ability to update the preferred size
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/clutter-1.22] constraint: Add the ability to update the preferred size
- Date: Tue, 16 Dec 2014 00:47:34 +0000 (UTC)
commit 391f1d8dd4323e825747fdab71a0d32303c7e343
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Dec 14 14:30:50 2014 +0000
constraint: Add the ability to update the preferred size
Constraints can only update an existing allocation, which means they
live only halfway through the layout management system used by Clutter;
this limitation makes it impossible, for instance, to query the
preferred size of an actor, if the actor is only using constraints to
manage its own size.
clutter/clutter-constraint-private.h | 7 +++++++
clutter/clutter-constraint.c | 29 +++++++++++++++++++++++++++++
clutter/clutter-constraint.h | 8 +++++++-
3 files changed, 43 insertions(+), 1 deletions(-)
---
diff --git a/clutter/clutter-constraint-private.h b/clutter/clutter-constraint-private.h
index 5fbddef..2bed47b 100644
--- a/clutter/clutter-constraint-private.h
+++ b/clutter/clutter-constraint-private.h
@@ -30,6 +30,13 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
ClutterActor *actor,
ClutterActorBox *allocation);
+void clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
+ ClutterActor *actor,
+ ClutterOrientation direction,
+ float for_size,
+ float *minimum_size,
+ float *natural_size);
+
G_END_DECLS
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
diff --git a/clutter/clutter-constraint.c b/clutter/clutter-constraint.c
index be6dae8..61ad2ae 100644
--- a/clutter/clutter-constraint.c
+++ b/clutter/clutter-constraint.c
@@ -152,6 +152,16 @@ constraint_update_allocation (ClutterConstraint *constraint,
}
static void
+constraint_update_preferred_size (ClutterConstraint *constraint,
+ ClutterActor *actor,
+ ClutterOrientation direction,
+ float for_size,
+ float *minimum_size,
+ float *natural_size)
+{
+}
+
+static void
clutter_constraint_notify (GObject *gobject,
GParamSpec *pspec)
{
@@ -176,6 +186,7 @@ clutter_constraint_class_init (ClutterConstraintClass *klass)
gobject_class->notify = clutter_constraint_notify;
klass->update_allocation = constraint_update_allocation;
+ klass->update_preferred_size = constraint_update_preferred_size;
}
static void
@@ -212,3 +223,21 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
return clutter_actor_box_equal (allocation, &old_alloc);
}
+
+void
+clutter_constraint_update_preferred_size (ClutterConstraint *constraint,
+ ClutterActor *actor,
+ ClutterOrientation direction,
+ float for_size,
+ float *minimum_size,
+ float *natural_size)
+{
+ g_return_if_fail (CLUTTER_IS_CONSTRAINT (constraint));
+ g_return_if_fail (CLUTTER_IS_ACTOR (actor));
+
+ CLUTTER_CONSTRAINT_GET_CLASS (constraint)->update_preferred_size (constraint, actor,
+ direction,
+ for_size,
+ minimum_size,
+ natural_size);
+}
diff --git a/clutter/clutter-constraint.h b/clutter/clutter-constraint.h
index 956264e..485fe2c 100644
--- a/clutter/clutter-constraint.h
+++ b/clutter/clutter-constraint.h
@@ -76,6 +76,13 @@ struct _ClutterConstraintClass
ClutterActor *actor,
ClutterActorBox *allocation);
+ void (* update_preferred_size) (ClutterConstraint *constraint,
+ ClutterActor *actor,
+ ClutterOrientation direction,
+ float for_size,
+ float *minimum_size,
+ float *natural_size);
+
/*< private >*/
void (* _clutter_constraint1) (void);
void (* _clutter_constraint2) (void);
@@ -84,7 +91,6 @@ struct _ClutterConstraintClass
void (* _clutter_constraint5) (void);
void (* _clutter_constraint6) (void);
void (* _clutter_constraint7) (void);
- void (* _clutter_constraint8) (void);
};
CLUTTER_AVAILABLE_IN_1_4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]