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.
This commit is contained in:
parent
82fffaedb6
commit
391f1d8dd4
@ -30,6 +30,13 @@ gboolean clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
|||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
ClutterActorBox *allocation);
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
#endif /* __CLUTTER_CONSTRAINT_PRIVATE_H__ */
|
||||||
|
@ -151,6 +151,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
|
static void
|
||||||
clutter_constraint_notify (GObject *gobject,
|
clutter_constraint_notify (GObject *gobject,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
@ -176,6 +186,7 @@ clutter_constraint_class_init (ClutterConstraintClass *klass)
|
|||||||
gobject_class->notify = clutter_constraint_notify;
|
gobject_class->notify = clutter_constraint_notify;
|
||||||
|
|
||||||
klass->update_allocation = constraint_update_allocation;
|
klass->update_allocation = constraint_update_allocation;
|
||||||
|
klass->update_preferred_size = constraint_update_preferred_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -212,3 +223,21 @@ clutter_constraint_update_allocation (ClutterConstraint *constraint,
|
|||||||
|
|
||||||
return clutter_actor_box_equal (allocation, &old_alloc);
|
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);
|
||||||
|
}
|
||||||
|
@ -76,6 +76,13 @@ struct _ClutterConstraintClass
|
|||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
ClutterActorBox *allocation);
|
ClutterActorBox *allocation);
|
||||||
|
|
||||||
|
void (* update_preferred_size) (ClutterConstraint *constraint,
|
||||||
|
ClutterActor *actor,
|
||||||
|
ClutterOrientation direction,
|
||||||
|
float for_size,
|
||||||
|
float *minimum_size,
|
||||||
|
float *natural_size);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
void (* _clutter_constraint1) (void);
|
void (* _clutter_constraint1) (void);
|
||||||
void (* _clutter_constraint2) (void);
|
void (* _clutter_constraint2) (void);
|
||||||
@ -84,7 +91,6 @@ struct _ClutterConstraintClass
|
|||||||
void (* _clutter_constraint5) (void);
|
void (* _clutter_constraint5) (void);
|
||||||
void (* _clutter_constraint6) (void);
|
void (* _clutter_constraint6) (void);
|
||||||
void (* _clutter_constraint7) (void);
|
void (* _clutter_constraint7) (void);
|
||||||
void (* _clutter_constraint8) (void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_1_4
|
CLUTTER_AVAILABLE_IN_1_4
|
||||||
|
Loading…
Reference in New Issue
Block a user