2007-10-12 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-actor.c: Add a :depth property, so we can
	set the initial depth of an actor inside the UI definition
	files.
This commit is contained in:
Emmanuele Bassi 2007-10-12 12:42:54 +00:00
parent d9d10f4704
commit 12b9b3bbfc
2 changed files with 51 additions and 15 deletions

View File

@ -1,3 +1,9 @@
2007-10-12 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-actor.c: Add a :depth property, so we can
set the initial depth of an actor inside the UI definition
files.
2007-10-12 Tomas Frydrych <tf@o-hand.com> 2007-10-12 Tomas Frydrych <tf@o-hand.com>
* tests/test-actors.c: * tests/test-actors.c:

View File

@ -99,6 +99,7 @@ enum
PROP_Y, PROP_Y,
PROP_WIDTH, PROP_WIDTH,
PROP_HEIGHT, PROP_HEIGHT,
PROP_DEPTH,
PROP_CLIP, PROP_CLIP,
PROP_HAS_CLIP, PROP_HAS_CLIP,
PROP_OPACITY, PROP_OPACITY,
@ -899,6 +900,9 @@ clutter_actor_set_property (GObject *object,
clutter_actor_get_width (actor), clutter_actor_get_width (actor),
g_value_get_int (value)); g_value_get_int (value));
break; break;
case PROP_DEPTH:
clutter_actor_set_depth (actor, g_value_get_int (value));
break;
case PROP_OPACITY: case PROP_OPACITY:
clutter_actor_set_opacity (actor, g_value_get_uchar (value)); clutter_actor_set_opacity (actor, g_value_get_uchar (value));
break; break;
@ -964,6 +968,9 @@ clutter_actor_get_property (GObject *object,
case PROP_HEIGHT: case PROP_HEIGHT:
g_value_set_int (value, clutter_actor_get_height (actor)); g_value_set_int (value, clutter_actor_get_height (actor));
break; break;
case PROP_DEPTH:
g_value_set_int (value, clutter_actor_get_depth (actor));
break;
case PROP_OPACITY: case PROP_OPACITY:
g_value_set_uchar (value, priv->opacity); g_value_set_uchar (value, priv->opacity);
break; break;
@ -1087,6 +1094,21 @@ clutter_actor_class_init (ClutterActorClass *klass)
0, G_MAXINT, 0, G_MAXINT,
0, 0,
CLUTTER_PARAM_READWRITE)); CLUTTER_PARAM_READWRITE));
/**
* ClutterActor:depth:
*
* Depth of the actor.
*
* Since: 0.6
*/
g_object_class_install_property (object_class,
PROP_DEPTH,
g_param_spec_int ("depth",
"Depth",
"Depth of actor",
-G_MAXINT, G_MAXINT,
0,
CLUTTER_PARAM_READWRITE));
/** /**
* ClutterActor:opacity: * ClutterActor:opacity:
* *
@ -2339,22 +2361,30 @@ clutter_actor_set_depth (ClutterActor *self,
priv = self->priv; priv = self->priv;
/* Sets Z value. - FIXME: should invert ?*/ if (priv->z != depth)
priv->z = depth;
if (priv->parent_actor && CLUTTER_IS_CONTAINER (priv->parent_actor))
{ {
/* We need to resort the container stacking order as to /* Sets Z value. - FIXME: should invert ?*/
* correctly render alpha values. priv->z = depth;
*
* FIXME: This is sub optimal. maybe queue the the sort
* before stacking
*/
clutter_container_sort_depth_order (CLUTTER_CONTAINER (priv->parent_actor));
}
if (CLUTTER_ACTOR_IS_VISIBLE (self)) if (priv->parent_actor && CLUTTER_IS_CONTAINER (priv->parent_actor))
clutter_actor_queue_redraw (self); {
ClutterContainer *parent;
/* We need to resort the container stacking order as to
* correctly render alpha values.
*
* FIXME: This is sub optimal. maybe queue the the sort
* before stacking
*/
parent = CLUTTER_CONTAINER (priv->parent_actor);
clutter_container_sort_depth_order (parent);
}
if (CLUTTER_ACTOR_IS_VISIBLE (self))
clutter_actor_queue_redraw (self);
g_object_notify (G_OBJECT (self), "depth");
}
} }
/** /**