mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
actor: Add accessors pair for :clip-to-allocation
We should have an accessors pair for the :clip-to-allocation property, to avoid going through the generic GObject accessors.
This commit is contained in:
parent
6ea56f1160
commit
346ebce573
@ -2854,11 +2854,7 @@ clutter_actor_set_property (GObject *object,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_CLIP_TO_ALLOCATION:
|
case PROP_CLIP_TO_ALLOCATION:
|
||||||
if (priv->clip_to_allocation != g_value_get_boolean (value))
|
clutter_actor_set_clip_to_allocation (actor, g_value_get_boolean (value));
|
||||||
{
|
|
||||||
priv->clip_to_allocation = g_value_get_boolean (value);
|
|
||||||
clutter_actor_queue_redraw (actor);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_REACTIVE:
|
case PROP_REACTIVE:
|
||||||
@ -10907,3 +10903,53 @@ clutter_actor_clear_constraints (ClutterActor *self)
|
|||||||
|
|
||||||
_clutter_meta_group_clear_metas (self->priv->constraints);
|
_clutter_meta_group_clear_metas (self->priv->constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_set_clip_to_allocation:
|
||||||
|
* @self: a #ClutterActor
|
||||||
|
* @clip_set: %TRUE to apply a clip tracking the allocation
|
||||||
|
*
|
||||||
|
* Sets whether @self should be clipped to the same size as its
|
||||||
|
* allocation
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_actor_set_clip_to_allocation (ClutterActor *self,
|
||||||
|
gboolean clip_set)
|
||||||
|
{
|
||||||
|
ClutterActorPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||||
|
|
||||||
|
clip_set = !!clip_set;
|
||||||
|
|
||||||
|
priv = self->priv;
|
||||||
|
|
||||||
|
if (priv->clip_to_allocation != clip_set)
|
||||||
|
{
|
||||||
|
priv->clip_to_allocation = clip_set;
|
||||||
|
|
||||||
|
clutter_actor_queue_redraw (self);
|
||||||
|
|
||||||
|
g_object_notify (G_OBJECT (self), "clip-to-allocation");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_get_clip_to_allocation:
|
||||||
|
* @self: a #ClutterActor
|
||||||
|
*
|
||||||
|
* Retrieves the value set using clutter_actor_set_clip_to_allocation()
|
||||||
|
*
|
||||||
|
* Return value: %TRUE if the #ClutterActor is clipped to its allocation
|
||||||
|
*
|
||||||
|
* Since: 1.4
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
clutter_actor_get_clip_to_allocation (ClutterActor *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
|
||||||
|
|
||||||
|
return self->priv->clip_to_allocation;
|
||||||
|
}
|
||||||
|
@ -447,6 +447,9 @@ void clutter_actor_get_clip (ClutterActor
|
|||||||
gfloat *yoff,
|
gfloat *yoff,
|
||||||
gfloat *width,
|
gfloat *width,
|
||||||
gfloat *height);
|
gfloat *height);
|
||||||
|
void clutter_actor_set_clip_to_allocation (ClutterActor *self,
|
||||||
|
gboolean clip_set);
|
||||||
|
gboolean clutter_actor_get_clip_to_allocation (ClutterActor *self);
|
||||||
|
|
||||||
void clutter_actor_set_parent (ClutterActor *self,
|
void clutter_actor_set_parent (ClutterActor *self,
|
||||||
ClutterActor *parent);
|
ClutterActor *parent);
|
||||||
|
@ -347,6 +347,8 @@ clutter_actor_set_clip
|
|||||||
clutter_actor_remove_clip
|
clutter_actor_remove_clip
|
||||||
clutter_actor_has_clip
|
clutter_actor_has_clip
|
||||||
clutter_actor_get_clip
|
clutter_actor_get_clip
|
||||||
|
clutter_actor_set_clip_to_allocation
|
||||||
|
clutter_actor_get_clip_to_allocation
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
clutter_actor_set_parent
|
clutter_actor_set_parent
|
||||||
|
@ -63,13 +63,13 @@ test_scrolling_main (int argc, char *argv[])
|
|||||||
|
|
||||||
/* scroll: the group that contains the scrolling viewport; we set its
|
/* scroll: the group that contains the scrolling viewport; we set its
|
||||||
* size to be the same as one rectangle, position it in the middle of
|
* size to be the same as one rectangle, position it in the middle of
|
||||||
* the stage and sets it to clip its contents to the allocated size
|
* the stage and set it to clip its contents to the allocated size
|
||||||
*/
|
*/
|
||||||
scroll = clutter_group_new ();
|
scroll = clutter_group_new ();
|
||||||
clutter_actor_set_size (scroll, RECT_WIDTH, RECT_HEIGHT);
|
clutter_actor_set_size (scroll, RECT_WIDTH, RECT_HEIGHT);
|
||||||
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5));
|
||||||
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
|
clutter_actor_add_constraint (scroll, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5));
|
||||||
g_object_set (scroll, "clip-to-allocation", TRUE, NULL);
|
clutter_actor_set_clip_to_allocation (scroll, TRUE);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), scroll);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), scroll);
|
||||||
|
|
||||||
/* viewport: the actual container for the children; we scroll it using
|
/* viewport: the actual container for the children; we scroll it using
|
||||||
|
Loading…
Reference in New Issue
Block a user