From 5fa9fc161beccd48f617f9492aa59bc10a001bf4 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Thu, 6 Jul 2006 18:12:19 +0000 Subject: [PATCH] 2006-07-06 Emmanuele Bassi * 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. --- ChangeLog | 15 +++++++ clutter/clutter-actor.c | 60 +++++++++++++++++++++++++--- clutter/clutter-actor.h | 1 + doc/reference/tmpl/clutter-main.sgml | 1 + 4 files changed, 71 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3da71719..37f4a9e4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2006-07-06 Emmanuele Bassi + + * 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 Big rework of the actor management semantics: now ClutterActor diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index d56f21dd0..b54de9f6e 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -476,6 +476,15 @@ clutter_actor_set_property (GObject *object, else clutter_actor_hide (actor); 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: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -518,6 +527,12 @@ clutter_actor_get_property (GObject *object, g_value_set_boolean (value, (CLUTTER_ACTOR_IS_VISIBLE (actor) != FALSE)); 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: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -617,8 +632,20 @@ clutter_actor_class_init (ClutterActorClass *klass) "Visible", "Whether the actor is visible or not", 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] = g_signal_new ("destroy", G_TYPE_FROM_CLASS (object_class), @@ -1186,10 +1213,10 @@ clutter_actor_rotate_y (ClutterActor *self, */ void clutter_actor_set_clip (ClutterActor *self, - gint xoff, - gint yoff, - gint width, - gint height) + gint xoff, + gint yoff, + gint width, + gint height) { ClutterGeometry *clip; @@ -1203,6 +1230,9 @@ clutter_actor_set_clip (ClutterActor *self, clip->height = height; 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)); 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: * @self: A #ClutterActor diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 35e9a8f8d..1fb2ff27e 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -189,6 +189,7 @@ void clutter_actor_set_clip (ClutterActor *sel gint width, gint height); void clutter_actor_remove_clip (ClutterActor *self); +gboolean clutter_actor_has_clip (ClutterActor *self); void clutter_actor_set_parent (ClutterActor *self, ClutterActor *parent); ClutterActor * clutter_actor_get_parent (ClutterActor *self); diff --git a/doc/reference/tmpl/clutter-main.sgml b/doc/reference/tmpl/clutter-main.sgml index c56f93d34..b2f8f5386 100644 --- a/doc/reference/tmpl/clutter-main.sgml +++ b/doc/reference/tmpl/clutter-main.sgml @@ -72,6 +72,7 @@ clutter-main @a...: @a...: @a...: +@a...: @a...: