<?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();
?> |