StBoxLayout: add insert_before

Add st_container_move_before internal API, and
st_box_layout_insert_before, that inserts an actor before another
in the container.

https://bugzilla.gnome.org/show_bug.cgi?id=637681
This commit is contained in:
Giovanni Campagna 2010-12-20 19:06:54 +01:00
parent cedcbc5fcf
commit 046308c582
4 changed files with 41 additions and 0 deletions

View File

@ -1213,3 +1213,14 @@ st_box_layout_insert_actor (StBoxLayout *self,
clutter_container_add_actor((ClutterContainer*) self, actor);
st_container_move_child (ST_CONTAINER (self), actor, pos);
}
void
st_box_layout_insert_before (StBoxLayout *self,
ClutterActor *actor,
ClutterActor *sibling)
{
g_return_if_fail (ST_IS_BOX_LAYOUT (self));
clutter_container_add_actor(CLUTTER_CONTAINER (self), actor);
st_container_move_before (ST_CONTAINER (self), actor, sibling);
}

View File

@ -90,6 +90,10 @@ void st_box_layout_insert_actor (StBoxLayout *self,
ClutterActor *actor,
int pos);
void st_box_layout_insert_before (StBoxLayout *self,
ClutterActor *actor,
ClutterActor *sibling);
G_END_DECLS
#endif /* _ST_BOX_LAYOUT_H */

View File

@ -159,6 +159,29 @@ st_container_move_child (StContainer *container,
clutter_actor_queue_relayout ((ClutterActor*) container);
}
void
st_container_move_before (StContainer *container,
ClutterActor *actor,
ClutterActor *sibling)
{
StContainerPrivate *priv = container->priv;
GList *actor_item = NULL;
GList *sibling_item = NULL;
actor_item = g_list_find (priv->children, actor);
sibling_item = g_list_find (priv->children, sibling);
g_return_if_fail (actor_item != NULL);
g_return_if_fail (sibling_item != NULL);
priv->children = g_list_delete_link (priv->children, actor_item);
priv->children = g_list_insert_before (priv->children, sibling_item, actor);
st_container_update_pseudo_classes (container);
clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
}
/**
* st_container_get_children_list:
* @container: An #StContainer

View File

@ -62,6 +62,9 @@ GList * st_container_get_focus_chain (StContainer *container);
void st_container_move_child (StContainer *container,
ClutterActor *actor,
int pos);
void st_container_move_before (StContainer *container,
ClutterActor *actor,
ClutterActor *sibling);
GList * st_container_get_children_list (StContainer *container);
G_END_DECLS