rendered paste body<?php
function build_list(){
$i = 0;
$list = array();
$i++;
$list[] = array ('id' => $i, 'parent' => '0', 'data' => 'constants');
$constant = $i;
$constants = get_defined_constants();
foreach ($constants as $key => $value){
$i++;
$list[] = array ('id' => $i, 'parent' => $constant, 'data' => $key);
}
$i++;
$list[] = array ('id' => $i, 'parent' => '0', 'data' => 'interfaces');
$interface = $i;
$interfaces = get_declared_interfaces();
foreach ($interfaces as $value){
$i++;
$list[] = array ('id' => $i, 'parent' => $interface, 'data' => $value);
}
$i++;
$list[] = array ('id' => $i, 'parent' => '0', 'data' => 'classes');
$class = $i;
$classes = get_declared_classes();
foreach ($classes as $value){
$i++;
$list[] = array ('id' => $i, 'parent' => $class, 'data' => $value);
}
$i++;
$list[] = array ('id' => $i, 'parent' => '0', 'data' => 'functions');
$function = $i;
$functions = get_defined_functions();
foreach ($functions['internal'] as $value){
$i++;
$list[] = array('id' => $i, 'parent' => $function, 'data' => $value);
}
$i++;
$list[] = array ('id' => $i, 'parent' => '0', 'data' => '$GLOBALS');
build_global_list($i,$list,$i,$GLOBALS);
return $list;
}
function build_global_list($parent, &$list, &$i, $array){
foreach ($array as $key => $value){
$i++;
if (is_array($value)) {
$list[] = array('id' => $i, 'parent' => $parent, 'data' => $key);
build_global_list($i, $list, $i, $value);
}else{
$list[] = array('id' => $i, 'parent' => $parent, 'data' => $key);
}
}
}
$store = new GtkTreeStore(Gtk::TYPE_LONG, Gtk::TYPE_STRING, Gtk::TYPE_STRING); // note 1
$nodes = array();
$nodes[0] = null; // root
foreach(build_list() as $item) {
$id = $item['id'];
$parent = $item['parent'];
$data = $item['data'];
$nodes[$id] = $store->append($nodes[$parent], array($id, "this is id $id", $data)); // note 2
}
//setup window
$wnd = new GtkWindow();
$wnd->connect_simple('destroy', array('gtk', 'main_quit'));
//create the view with the tree store set as model
$view = new GtkTreeView($store); // note 3
//set up the columns
$cell_renderer = new GtkCellRendererText();
$view->append_column(new GtkTreeViewColumn('App Analisis', $cell_renderer, 'text', 2));
//display it
//$view->expand_all();
$ScrolledWindow = new GtkScrolledWindow();
$ScrolledWindow->add($view);
$wnd->add($ScrolledWindow);
$wnd->show_all();
Gtk::main();
?>