actor: Add content-repeat

ClutterContent implementations may allow repeating their contents when
painting; we should provide the repeat policy on the actor, like we do
for scaling filters and content gravity.
This commit is contained in:
Emmanuele Bassi 2012-06-08 12:44:28 +01:00
parent ec296646f6
commit e7aa21203c
5 changed files with 100 additions and 1 deletions

View File

@ -726,6 +726,7 @@ struct _ClutterActorPrivate
ClutterContentGravity content_gravity;
ClutterScalingFilter min_filter;
ClutterScalingFilter mag_filter;
ClutterContentRepeat content_repeat;
/* used when painting, to update the paint volume */
ClutterEffect *current_effect;
@ -910,6 +911,7 @@ enum
PROP_CONTENT_BOX,
PROP_MINIFICATION_FILTER,
PROP_MAGNIFICATION_FILTER,
PROP_CONTENT_REPEAT,
PROP_LAST
};
@ -4754,6 +4756,10 @@ clutter_actor_set_property (GObject *object,
g_value_get_enum (value));
break;
case PROP_CONTENT_REPEAT:
clutter_actor_set_content_repeat (actor, g_value_get_flags (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -5217,6 +5223,10 @@ clutter_actor_get_property (GObject *object,
g_value_set_enum (value, priv->mag_filter);
break;
case PROP_CONTENT_REPEAT:
g_value_set_flags (value, priv->content_repeat);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -6794,6 +6804,22 @@ clutter_actor_class_init (ClutterActorClass *klass)
CLUTTER_SCALING_FILTER_LINEAR,
CLUTTER_PARAM_READWRITE);
/**
* ClutterActor:content-repeat:
*
* The repeat policy for the actor's #ClutterActor:content.
*
* Since: 1.12
*/
obj_props[PROP_CONTENT_REPEAT] =
g_param_spec_flags ("content-repeat",
P_("Content Repeat"),
P_("The repeat policy for the actor's content"),
CLUTTER_TYPE_CONTENT_REPEAT,
CLUTTER_REPEAT_NONE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
/**
@ -18723,3 +18749,47 @@ clutter_actor_needs_expand (ClutterActor *self,
return FALSE;
}
/**
* clutter_actor_set_content_repeat:
* @self: a #ClutterActor
* @repeat: the repeat policy
*
* Sets the policy for repeating the #ClutterActor:content of a
* #ClutterActor. The behaviour is deferred to the #ClutterContent
* implementation.
*
* Since: 1.12
*/
void
clutter_actor_set_content_repeat (ClutterActor *self,
ClutterContentRepeat repeat)
{
g_return_if_fail (CLUTTER_IS_ACTOR (self));
if (self->priv->content_repeat == repeat)
return;
self->priv->content_repeat = repeat;
clutter_actor_queue_redraw (self);
}
/**
* clutter_actor_get_content_repeat:
* @self: a #ClutterActor
*
* Retrieves the repeat policy for a #ClutterActor set by
* clutter_actor_set_content_repeat().
*
* Return value: the content repeat policy
*
* Since: 1.12
*/
ClutterContentRepeat
clutter_actor_get_content_repeat (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), CLUTTER_REPEAT_NONE);
return self->priv->content_repeat;
}

View File

@ -502,6 +502,11 @@ CLUTTER_AVAILABLE_IN_1_10
void clutter_actor_get_content_scaling_filters (ClutterActor *self,
ClutterScalingFilter *min_filter,
ClutterScalingFilter *mag_filter);
CLUTTER_AVAILABLE_IN_1_12
void clutter_actor_set_content_repeat (ClutterActor *self,
ClutterContentRepeat repeat);
CLUTTER_AVAILABLE_IN_1_12
ClutterContentRepeat clutter_actor_get_content_repeat (ClutterActor *self);
CLUTTER_AVAILABLE_IN_1_10
void clutter_actor_get_content_box (ClutterActor *self,
ClutterActorBox *box);

View File

@ -1255,6 +1255,24 @@ typedef enum {
CLUTTER_GRID_POSITION_BOTTOM
} ClutterGridPosition;
/**
* ClutterContentRepeat:
* @CLUTTER_REPEAT_NONE: No repeat
* @CLUTTER_REPEAT_X_AXIS: Repeat the content on the X axis
* @CLUTTER_REPEAT_Y_AXIS: Repeat the content on the Y axis
* @CLUTTER_REPEAT_BOTH: Repeat the content on both axis
*
* Content repeat modes.
*
* Since: 1.12
*/
typedef enum {
CLUTTER_REPEAT_NONE = 0,
CLUTTER_REPEAT_X_AXIS = 1 << 0,
CLUTTER_REPEAT_Y_AXIS = 1 << 1,
CLUTTER_REPEAT_BOTH = CLUTTER_REPEAT_X_AXIS | CLUTTER_REPEAT_Y_AXIS
} ClutterContentRepeat;
G_END_DECLS
#endif /* __CLUTTER_ENUMS_H__ */

View File

@ -97,6 +97,7 @@ clutter_actor_get_constraints
clutter_actor_get_content
clutter_actor_get_content_box
clutter_actor_get_content_gravity
clutter_actor_get_content_repeat
clutter_actor_get_content_scaling_filters
clutter_actor_get_default_paint_volume
clutter_actor_get_depth
@ -229,6 +230,7 @@ clutter_actor_set_clip
clutter_actor_set_clip_to_allocation
clutter_actor_set_content
clutter_actor_set_content_gravity
clutter_actor_set_content_repeat
clutter_actor_set_content_scaling_filters
clutter_actor_set_depth
clutter_actor_set_easing_delay
@ -588,6 +590,7 @@ clutter_content_get_preferred_size
clutter_content_get_type
clutter_content_gravity_get_type
clutter_content_invalidate
clutter_content_repeat_get_type
clutter_constraint_get_type
clutter_debug_flags DATA
clutter_deform_effect_get_back_material

View File

@ -411,8 +411,11 @@ ClutterContentGravity
clutter_actor_set_content_gravity
clutter_actor_get_content_gravity
ClutterScalingFilter
clutter_actor_get_content_scaling_filters
clutter_actor_set_content_scaling_filters
clutter_actor_get_content_scaling_filters
ClutterContentRepeat
clutter_actor_set_content_repeat
clutter_actor_get_content_repeat
clutter_actor_get_content_box
clutter_actor_set_clip
clutter_actor_remove_clip