2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.c: Document :show-on-set-parent and
	the fact that calling clutter_actor_show() and hide() on an
	unparented actor will change that property as well as a side
	effect.
This commit is contained in:
Emmanuele Bassi 2008-04-23 13:54:13 +00:00
parent 7d103daed4
commit 43992d9964
2 changed files with 40 additions and 13 deletions

View File

@ -1,3 +1,10 @@
2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c: Document :show-on-set-parent and
the fact that calling clutter_actor_show() and hide() on an
unparented actor will change that property as well as a side
effect.
2008-04-23 Emmanuele Bassi <ebassi@openedhand.com> 2008-04-23 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c (clutter_actor_set_property): Use the * clutter/clutter-actor.c (clutter_actor_set_property): Use the

View File

@ -306,6 +306,11 @@ clutter_actor_real_show (ClutterActor *self)
* *
* Flags an actor to be displayed. An actor that isn't shown will not * Flags an actor to be displayed. An actor that isn't shown will not
* be rendered on the stage. * be rendered on the stage.
*
* Actors are visible by default.
*
* If this function is called on an actor without a parent, the
* ClutterActor:show-on-set-parent will be set to %TRUE as a side effect.
*/ */
void void
clutter_actor_show (ClutterActor *self) clutter_actor_show (ClutterActor *self)
@ -316,18 +321,21 @@ clutter_actor_show (ClutterActor *self)
priv = self->priv; priv = self->priv;
if (priv->show_on_set_parent == FALSE && priv->parent_actor == NULL) g_object_freeze_notify (G_OBJECT (self));
g_object_set (self, "show-on-set-parent", TRUE, NULL);
if (!priv->show_on_set_parent && !priv->parent_actor)
{
priv->show_on_set_parent = TRUE;
g_object_notify (G_OBJECT (self), "show-on-set-parent");
}
if (!CLUTTER_ACTOR_IS_VISIBLE (self)) if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{ {
g_object_ref (self);
g_signal_emit (self, actor_signals[SHOW], 0); g_signal_emit (self, actor_signals[SHOW], 0);
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
g_object_unref (self);
} }
g_object_thaw_notify (G_OBJECT (self));
} }
/** /**
@ -371,6 +379,12 @@ clutter_actor_real_hide (ClutterActor *self)
* *
* Flags an actor to be hidden. A hidden actor will not be * Flags an actor to be hidden. A hidden actor will not be
* rendered on the stage. * rendered on the stage.
*
* Actors are visible by default.
*
* If this function is called on an actor without a parent, the
* ClutterActor:show-on-set-parent property will be set to %FALSE
* as a side-effect.
*/ */
void void
clutter_actor_hide (ClutterActor *self) clutter_actor_hide (ClutterActor *self)
@ -381,18 +395,21 @@ clutter_actor_hide (ClutterActor *self)
priv = self->priv; priv = self->priv;
if (priv->show_on_set_parent == TRUE && priv->parent_actor == NULL) g_object_freeze_notify (G_OBJECT (self));
g_object_set (self, "show-on-set-parent", FALSE, NULL);
if (priv->show_on_set_parent && !priv->parent_actor)
{
priv->show_on_set_parent = FALSE;
g_object_notify (G_OBJECT (self), "show-on-set-parent");
}
if (CLUTTER_ACTOR_IS_MAPPED (self)) if (CLUTTER_ACTOR_IS_MAPPED (self))
{ {
g_object_ref (self);
g_signal_emit (self, actor_signals[HIDE], 0); g_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify (G_OBJECT (self), "visible"); g_object_notify (G_OBJECT (self), "visible");
g_object_unref (self);
} }
g_object_thaw_notify (G_OBJECT (self));
} }
/** /**
@ -2077,7 +2094,10 @@ clutter_actor_class_init (ClutterActorClass *klass)
/** /**
* ClutterActor:show-on-set-parent: * ClutterActor:show-on-set-parent:
* *
* If TRUE, the Actor is automatically shown when parented. * If %TRUE, the actor is automatically shown when parented.
*
* Calling clutter_actor_hide() on an actor which has not been
* parented will set this property to %FALSE as a side effect.
* *
* Since: 0.8 * Since: 0.8
*/ */