actor: Add [xy]-expand properties

This commit is contained in:
Emmanuele Bassi 2011-11-20 22:00:01 +00:00
parent d5086da3fd
commit f2609dcca4
2 changed files with 106 additions and 0 deletions

View File

@ -523,6 +523,8 @@ struct _ClutterActorPrivate
the redraw was queued from or it will be NULL if the redraw was
queued without an effect. */
guint is_dirty : 1;
guint x_expand : 1;
guint y_expand : 1;
};
enum
@ -613,6 +615,9 @@ enum
PROP_LAYOUT_MANAGER,
PROP_X_EXPAND,
PROP_Y_EXPAND,
PROP_LAST
};
@ -3536,6 +3541,14 @@ clutter_actor_set_property (GObject *object,
clutter_actor_set_layout_manager (actor, g_value_get_object (value));
break;
case PROP_X_EXPAND:
clutter_actor_set_x_expand (actor, g_value_get_boolean (value));
break;
case PROP_Y_EXPAND:
clutter_actor_set_y_expand (actor, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -3805,6 +3818,14 @@ clutter_actor_get_property (GObject *object,
g_value_set_object (value, priv->layout_manager);
break;
case PROP_X_EXPAND:
g_value_set_boolean (value, priv->x_expand);
break;
case PROP_Y_EXPAND:
g_value_set_boolean (value, priv->y_expand);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -4858,6 +4879,24 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_object_class_install_property (object_class, PROP_LAYOUT_MANAGER,
obj_props[PROP_LAYOUT_MANAGER]);
obj_props[PROP_X_EXPAND] =
g_param_spec_boolean ("x-expand",
P_("X Expand"),
P_("Whether the actor should expand on the X axis"),
FALSE,
CLUTTER_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_X_EXPAND,
obj_props[PROP_X_EXPAND]);
obj_props[PROP_Y_EXPAND] =
g_param_spec_boolean ("y-expand",
P_("Y Expand"),
P_("Whether the actor should expand on the Y axis"),
FALSE,
CLUTTER_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_Y_EXPAND,
obj_props[PROP_Y_EXPAND]);
/**
* ClutterActor::destroy:
* @actor: the #ClutterActor which emitted the signal
@ -13025,3 +13064,63 @@ clutter_actor_get_layout_manager (ClutterActor *self)
return self->priv->layout_manager;
}
void
clutter_actor_set_x_expand (ClutterActor *self,
gboolean x_expand)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
x_expand = !!x_expand;
priv = self->priv;
if (priv->x_expand != x_expand)
{
priv->x_expand = x_expand;
clutter_actor_queue_relayout (self);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_X_EXPAND]);
}
}
gboolean
clutter_actor_get_x_expand (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
return self->priv->x_expand;
}
void
clutter_actor_set_y_expand (ClutterActor *self,
gboolean y_expand)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
y_expand = !!y_expand;
priv = self->priv;
if (priv->y_expand != y_expand)
{
priv->y_expand = y_expand;
clutter_actor_queue_relayout (self);
g_object_notify_by_pspec (G_OBJECT (self), obj_props[PROP_Y_EXPAND]);
}
}
gboolean
clutter_actor_get_y_expand (ClutterActor *self)
{
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), FALSE);
return self->priv->y_expand;
}

View File

@ -367,6 +367,13 @@ void clutter_actor_set_layout_manager (ClutterActor
ClutterLayoutManager *manager);
ClutterLayoutManager *clutter_actor_get_layout_manager (ClutterActor *self);
void clutter_actor_set_x_expand (ClutterActor *self,
gboolean x_expand);
gboolean clutter_actor_get_x_expand (ClutterActor *self);
void clutter_actor_set_y_expand (ClutterActor *self,
gboolean y_expand);
gboolean clutter_actor_get_y_expand (ClutterActor *self);
void clutter_actor_set_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,