widget = &new GtkCTree(1,0); $this->widget->set_usize(300,20); $this->widget->connect_object('realize', array(&$this, 'prepare_pixmaps')); $this->widget->connect_object_after('realize', array(&$this, 'init')); $this->widget->connect_object('tree-select-row', array(&$this, 'select_row')); $this->widget->connect_object_after('tree-expand', array(&$this, 'expand_tree')); $this->widget->connect_object_after('tree-collapse', array(&$this, 'collapse')); $this->widget->connect_object_after('tree_move', array(&$this, 'user_move_node')); $this->widget->drag_dest_set(GTK_DEST_DEFAULT_ALL, array(array('text/plain', 0, -1)) , GDK_ACTION_COPY); $this->widget->connect('drag_data_received', array(&$this,"drop_recieved")); $this->widget->show(); $parent->add($this->widget); $this->_insert_node(array( 'BOOKMARKID' => 'x', 'parent' => '', 'url' => 'x', 'icontype' => 'test' ) ); } function _insert_node($nodedata) { //echo "ADDING $bookmarkid:$parentname : URL: $URL ($ispeek,$expandonly)\n"; $sibling = NULL; $parent = NULL; if ($nodedata["parent"]) $parent = &$this->nodes[$nodedata["BOOKMARKID"]][$nodedata["parent"]]["widget"]; $pixmap_open = &$this->_pixmap['test']['pixmap']; $pixmap_closed = &$this->_pixmap['test']['pixmap']; $mask_open = &$this->_pixmap['test']['mask']; $mask_closed = &$this->_pixmap['test']['mask']; // create the node $node = $this->widget->insert_node( $parent, null, array('test'), 5, $pixmap_closed, $mask_closed, $pixmap_open, $mask_open, false, false); $node = $this->widget->insert_node( $node, null, array('test'), 5, $pixmap_closed, $mask_closed, $pixmap_open, $mask_open, false, false); $this->node_children[$bookmarkid][$nodedata["parent"]][$nodedata["URL"]] = "C"; } function prepare_pixmaps() { // loads pixmaps $i=0; $this->icons[0] = 'test'; closedir($fp); for ($i=0;$iicons);$i++) { $xpm = $this->icons[$i]; list($this->_pixmap[$xpm]['pixmap'], $this->_pixmap[$xpm]['mask']) = Gdk::pixmap_create_from_xpm($this->widget->window, NULL, dirname(__FILE__) ."/{$xpm}.xpm"); } } function expand_tree($node) { $this->_insert_node(array( 'BOOKMARKID' => 'y', 'parent' => 'x', 'url' => 'x/y', )); return TRUE; } } dl('php_gtk.so'); $w = &new GtkWindow(); $test = &new test; $test->addTo($w); $w->show(); gtk::main(); ?>