[clutter/wip/apocalypses/apocalypse-1: 7/44] actor: Add [xy]-expand properties



commit db8cfa11be83285a25fe67c983d5fc209c0d829c
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Sun Nov 20 22:00:01 2011 +0000

    actor: Add [xy]-expand properties

 clutter/clutter-actor.c |   99 +++++++++++++++++++++++++++++++++++++++++++++++
 clutter/clutter-actor.h |    7 +++
 2 files changed, 106 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 784a976..9a3c9e9 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -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
 };
 
@@ -3519,6 +3524,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;
@@ -3788,6 +3801,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;
@@ -4865,6 +4886,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
@@ -12989,3 +13028,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;
+}
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 80d9f1b..7caafbf 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -365,6 +365,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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]