2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.h:
	* clutter/clutter-actor.c:
	
	(clutter_actor_class_init), (clutter_actor_set_property),
	(clutter_actor_get_property): Add the "clip" and "has-clip"
	properties.

	(clutter_actor_set_clip), (clutter_actor_remove_clip): Emit
	the notification for the changed properties.

	(clutter_actor_has_clip): Simple accessor to the "has-clip"
	property.
This commit is contained in:
Emmanuele Bassi 2006-07-06 18:12:19 +00:00
parent 212c4a0ee8
commit 5fa9fc161b
4 changed files with 71 additions and 6 deletions

View File

@ -1,3 +1,18 @@
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_class_init), (clutter_actor_set_property),
(clutter_actor_get_property): Add the "clip" and "has-clip"
properties.
(clutter_actor_set_clip), (clutter_actor_remove_clip): Emit
the notification for the changed properties.
(clutter_actor_has_clip): Simple accessor to the "has-clip"
property.
2006-07-06 Emmanuele Bassi <ebassi@openedhand.com> 2006-07-06 Emmanuele Bassi <ebassi@openedhand.com>
Big rework of the actor management semantics: now ClutterActor Big rework of the actor management semantics: now ClutterActor

View File

@ -476,6 +476,15 @@ clutter_actor_set_property (GObject *object,
else else
clutter_actor_hide (actor); clutter_actor_hide (actor);
break; break;
case PROP_CLIP:
{
ClutterGeometry *geom = g_value_get_boxed (value);
clutter_actor_set_clip (actor,
geom->x, geom->y,
geom->width, geom->height);
}
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -518,6 +527,12 @@ clutter_actor_get_property (GObject *object,
g_value_set_boolean (value, g_value_set_boolean (value,
(CLUTTER_ACTOR_IS_VISIBLE (actor) != FALSE)); (CLUTTER_ACTOR_IS_VISIBLE (actor) != FALSE));
break; break;
case PROP_HAS_CLIP:
g_value_set_boolean (value, priv->has_clip);
break;
case PROP_CLIP:
g_value_set_boxed (value, &(priv->clip));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -617,8 +632,20 @@ clutter_actor_class_init (ClutterActorClass *klass)
"Visible", "Visible",
"Whether the actor is visible or not", "Whether the actor is visible or not",
FALSE, FALSE,
G_PARAM_READABLE)); G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_HAS_CLIP,
g_param_spec_boolean ("has-clip",
"Has Clip",
"Whether the actor has a clip set or not",
FALSE,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_CLIP,
g_param_spec_boxed ("clip",
"Clip",
"The clip region for the actor",
CLUTTER_TYPE_GEOMETRY,
G_PARAM_READWRITE));
actor_signals[DESTROY] = actor_signals[DESTROY] =
g_signal_new ("destroy", g_signal_new ("destroy",
G_TYPE_FROM_CLASS (object_class), G_TYPE_FROM_CLASS (object_class),
@ -1186,10 +1213,10 @@ clutter_actor_rotate_y (ClutterActor *self,
*/ */
void void
clutter_actor_set_clip (ClutterActor *self, clutter_actor_set_clip (ClutterActor *self,
gint xoff, gint xoff,
gint yoff, gint yoff,
gint width, gint width,
gint height) gint height)
{ {
ClutterGeometry *clip; ClutterGeometry *clip;
@ -1203,6 +1230,9 @@ clutter_actor_set_clip (ClutterActor *self,
clip->height = height; clip->height = height;
self->priv->has_clip = TRUE; self->priv->has_clip = TRUE;
g_object_notify (G_OBJECT (self), "has-clip");
g_object_notify (G_OBJECT (self), "clip");
} }
/** /**
@ -1217,8 +1247,26 @@ clutter_actor_remove_clip (ClutterActor *self)
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
self->priv->has_clip = FALSE; self->priv->has_clip = FALSE;
g_object_notify (G_OBJECT (self), "has-clip");
} }
/**
* clutter_actor_has_clip:
* @self: a #ClutterActor
*
* Gets whether the actor has a clip set or not.
*
* Return value: %TRUE if the actor has a clip set.
*/
gboolean
clutter_actor_has_clip (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
return self->priv->has_clip;
}
/** /**
* clutter_actor_set_parent: * clutter_actor_set_parent:
* @self: A #ClutterActor * @self: A #ClutterActor

View File

@ -189,6 +189,7 @@ void clutter_actor_set_clip (ClutterActor *sel
gint width, gint width,
gint height); gint height);
void clutter_actor_remove_clip (ClutterActor *self); void clutter_actor_remove_clip (ClutterActor *self);
gboolean clutter_actor_has_clip (ClutterActor *self);
void clutter_actor_set_parent (ClutterActor *self, void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent); ClutterActor *parent);
ClutterActor * clutter_actor_get_parent (ClutterActor *self); ClutterActor * clutter_actor_get_parent (ClutterActor *self);

View File

@ -72,6 +72,7 @@ clutter-main
@a...: @a...:
@a...: @a...:
@a...: @a...:
@a...:
@a...: @a...: