GtkTreeStore::insert_after

GtkTreeIter insert_after([GtkTreeIter sibling [, GtkTreeIter parent [, array items]]]);

Inserts a new row after sibling. If sibling is null, then the row will be prepended to parent's children. If parent and sibling are null, then the row will be prepended to the toplevel. If both sibling and parent are set, then parent must be the parent of sibling. When sibling is set, parent is optional.

items can be an array of values for the column.

Example 133. Filling a GtkTreeStore with insert_after

<?php
//new model with just one column of type string
$store = new GtkTreeStore(Gtk::TYPE_STRING);

//insert a new row without a parent (root row)
$root = $store->insert_after();
$store->set($root, 0, 'root');

//insert this child as child of root row
$child1 = $store->insert_after(null, $root, array('child1'));

//insert this child after $child1
$child2 = $store->insert_after($child1, $root, array('child2'));

//insert new child after $child1, making $child2
//moving to position 2
$child3 = $store->insert_after($child1, $root);
$store->set($child3, 0, 'child3');

//Display the store
$wnd  = new GtkWindow();
$view = new GtkTreeView($store);
$view->append_column(
    new GtkTreeViewColumn('String column', new GtkCellRendererText(), 'text', 0)
);
$wnd->add($view);
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
$wnd->show_all();
Gtk::main();
?>

See also: insert() , insert_before() , append() , prepend()