diff --git a/src/st/st-box-layout.c b/src/st/st-box-layout.c index 180d893c4..12b15081a 100644 --- a/src/st/st-box-layout.c +++ b/src/st/st-box-layout.c @@ -21,6 +21,20 @@ * */ +/* Portions copied from Clutter: + * Clutter. + * + * An OpenGL based 'interactive canvas' library. + * + * Authored By Matthew Allum + * + * Copyright (C) 2006 OpenedHand + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + */ + /** * SECTION:st-box-layout * @short_description: a layout container arranging children in a single line @@ -294,8 +308,42 @@ st_box_container_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { - /* XXX: not yet implemented */ - g_warning ("%s() not yet implemented", __FUNCTION__); + StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (container)->priv; + + /* copied from clutter/clutter/clutter-group.c */ + + priv->children = g_list_remove (priv->children, actor); + + /* Push to bottom */ + if (!sibling) + { + GList *last_item; + + last_item = g_list_first (priv->children); + + if (last_item) + sibling = last_item->data; + + priv->children = g_list_prepend (priv->children, actor); + } + else + { + gint pos; + + pos = g_list_index (priv->children, sibling); + + priv->children = g_list_insert (priv->children, actor, pos); + } + + /* See comment in group_raise for this */ + if (sibling && + clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) + { + clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); + } + + if (CLUTTER_ACTOR_IS_VISIBLE (container)) + clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); } static void @@ -303,8 +351,47 @@ st_box_container_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { - /* XXX: not yet implemented */ - g_warning ("%s() not yet implemented", __FUNCTION__); + StBoxLayoutPrivate *priv = ST_BOX_LAYOUT (container)->priv; + + priv->children = g_list_remove (priv->children, actor); + + /* copied from clutter/clutter/clutter-group.c */ + + /* Raise at the top */ + if (!sibling) + { + GList *last_item; + + last_item = g_list_last (priv->children); + + if (last_item) + sibling = last_item->data; + + priv->children = g_list_append (priv->children, actor); + } + else + { + gint pos; + + pos = g_list_index (priv->children, sibling) + 1; + + priv->children = g_list_insert (priv->children, actor, pos); + } + + /* set Z ordering a value below, this will then call sort + * as values are equal ordering shouldn't change but Z + * values will be correct. + * + * FIXME: optimise + */ + if (sibling && + clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) + { + clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); + } + + if (CLUTTER_ACTOR_IS_VISIBLE (container)) + clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); } static void