[clutter/wip/apocalypses/apocalypse-1: 80/92] box-layout: Override compute_expand()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter/wip/apocalypses/apocalypse-1: 80/92] box-layout: Override compute_expand()
- Date: Tue, 3 Jan 2012 22:26:54 +0000 (UTC)
commit 254d717806110d271a96a8503a0c8a7285bd4998
Author: Emmanuele Bassi <ebassi linux intel com>
Date: Tue Dec 20 18:41:51 2011 +0000
box-layout: Override compute_expand()
ClutterBoxLayout has an expansion flag, and we need to take that into
consideration when computing the Actor expansion flags.
clutter/clutter-box-layout.c | 57 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/clutter/clutter-box-layout.c b/clutter/clutter-box-layout.c
index c7055ba..595a76a 100644
--- a/clutter/clutter-box-layout.c
+++ b/clutter/clutter-box-layout.c
@@ -276,6 +276,11 @@ box_child_set_expand (ClutterBoxChild *self,
else
clutter_layout_manager_layout_changed (layout);
+ /* we need to let the scene graph that the expand flags may have
+ * been changed
+ */
+ clutter_actor_queue_compute_expand (CLUTTER_CHILD_META (self)->actor);
+
g_object_notify (G_OBJECT (self), "expand");
}
}
@@ -742,8 +747,10 @@ count_expand_children (ClutterLayoutManager *layout,
gint *visible_children,
gint *expand_children)
{
+ ClutterBoxLayoutPrivate *priv;
ClutterActor *actor, *child;
+ priv = CLUTTER_BOX_LAYOUT (layout)->priv;
actor = CLUTTER_ACTOR (container);
*visible_children = *expand_children = 0;
@@ -755,6 +762,7 @@ count_expand_children (ClutterLayoutManager *layout,
if (CLUTTER_ACTOR_IS_VISIBLE (child))
{
ClutterLayoutMeta *meta;
+ gboolean needs_expand;
*visible_children += 1;
@@ -762,7 +770,12 @@ count_expand_children (ClutterLayoutManager *layout,
container,
child);
- if (CLUTTER_BOX_CHILD (meta)->expand)
+ if (priv->is_vertical)
+ needs_expand = clutter_actor_needs_y_expand (child);
+ else
+ needs_expand = clutter_actor_needs_x_expand (child);
+
+ if (CLUTTER_BOX_CHILD (meta)->expand || needs_expand)
*expand_children += 1;
}
}
@@ -1057,9 +1070,16 @@ clutter_box_layout_allocate (ClutterLayoutManager *layout,
}
else
{
+ gboolean needs_expand;
+
child_size = sizes[i].minimum_size;
- if (box_child->expand)
+ if (priv->is_vertical)
+ needs_expand = clutter_actor_needs_y_expand (child);
+ else
+ needs_expand = clutter_actor_needs_x_expand (child);
+
+ if (box_child->expand || needs_expand)
{
child_size += extra;
@@ -1170,6 +1190,38 @@ clutter_box_layout_end_animation (ClutterLayoutManager *manager)
}
static void
+clutter_box_layout_compute_expand (ClutterLayoutManager *manager,
+ ClutterContainer *container,
+ ClutterActor *actor,
+ gboolean *x_expand_p,
+ gboolean *y_expand_p)
+{
+ ClutterBoxLayoutPrivate *priv;
+ ClutterLayoutMeta *meta;
+ gboolean x_expand, y_expand;
+
+ priv = CLUTTER_BOX_LAYOUT (manager)->priv;
+ meta = clutter_layout_manager_get_child_meta (manager, container, actor);
+
+ if (priv->is_vertical)
+ {
+ x_expand = FALSE;
+ y_expand = CLUTTER_BOX_CHILD (meta)->expand;
+ }
+ else
+ {
+ x_expand = CLUTTER_BOX_CHILD (meta)->expand;
+ y_expand = FALSE;
+ }
+
+ if (x_expand_p != NULL)
+ *x_expand_p = x_expand;
+
+ if (y_expand_p != NULL)
+ *y_expand_p = y_expand;
+}
+
+static void
clutter_box_layout_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
@@ -1279,6 +1331,7 @@ clutter_box_layout_class_init (ClutterBoxLayoutClass *klass)
clutter_box_layout_get_child_meta_type;
layout_class->begin_animation = clutter_box_layout_begin_animation;
layout_class->end_animation = clutter_box_layout_end_animation;
+ layout_class->compute_expand = clutter_box_layout_compute_expand;
g_type_class_add_private (klass, sizeof (ClutterBoxLayoutPrivate));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]