All pastes #268744 Raw Edit

Someone

public php v1 · immutable
·published 2006-12-05 23:52 UTC
rendered paste body
<?php$mimetype = 'application/x-toolbar-item';$window = new GtkWindow();$window->add($toolbar = new GtkToolbar());$toolbar->set_show_arrow(FALSE);$toolbar->insert($button = GtkToolButton::new_from_stock(Gtk::STOCK_OPEN), -1);$button->set_use_drag_window(TRUE);$button->drag_source_set(Gdk::BUTTON1_MASK,array(array($mimetype, 0, 0)), Gdk::ACTION_COPY|Gdk::ACTION_MOVE);$button->connect('drag-begin', 'dragbegin');$toolbar->insert($button = GtkToolButton::new_from_stock(Gtk::STOCK_NEW), -1);$button->set_use_drag_window(TRUE);$button->drag_source_set(Gdk::BUTTON1_MASK,array(array($mimetype, 0, 0)), Gdk::ACTION_COPY|Gdk::ACTION_MOVE);$button->connect('drag-begin', 'dragbegin');$toolbar->insert($button = GtkToolButton::new_from_stock(Gtk::STOCK_CLOSE), -1);$button->set_use_drag_window(TRUE);$button->drag_source_set(Gdk::BUTTON1_MASK,array(array($mimetype, 0, 0)), Gdk::ACTION_COPY|Gdk::ACTION_MOVE);$button->connect('drag-begin', 'dragbegin');$toolbar->insert($button = GtkToolButton::new_from_stock(Gtk::STOCK_DELETE), -1);$button->set_use_drag_window(TRUE);$button->drag_source_set(Gdk::BUTTON1_MASK,array(array($mimetype, 0, 0)), Gdk::ACTION_COPY|Gdk::ACTION_MOVE);$button->connect('drag-begin', 'dragbegin');$toolbar->drag_dest_set(Gtk::DEST_DEFAULT_ALL,array( array($mimetype, 0, 0)), Gdk::ACTION_COPY|Gdk::ACTION_MOVE);$toolbar->connect('drag-data-received', 'dragreceived');$toolbar->connect('drag-motion', 'dragmotion');$toolbar->connect('drag-drop', 'dragdrop');$highlight = NULL;$position = NULL;$removed = FALSE;function dragbegin($widget, $context){	global $window, $highlight, $position, $toolbar, $removed;	$pixbuf = $window->render_icon($widget->get_property('stock-id'),  Gtk::ICON_SIZE_DND);	$widget->drag_source_set_icon_pixbuf($pixbuf);	$highlight = $widget;	$position =  $toolbar->get_item_index($widget);	$removed = FALSE;	return;}function dragmotion($widget, $context, $x, $y, $time){	global $highlight, $removed;	$index = $widget->get_drop_index($x, $y);	if($removed == FALSE)	{		$widget->remove($highlight);		$removed = TRUE;	}	$widget->set_drop_highlight_item($highlight, $index);	return;}function dragleave($widget, $context, $time){	global $highlight, $position;	$widget->set_drop_highlight_item(null, 0);	$widget->insert($highlight, $position);	$removed = FALSE;	return;}function dragdrop($widget, $context, $x, $y, $time){	global $highlight;	$widget->set_drop_highlight_item(null, 0);	$index = $widget->get_drop_index($x, $y);	$widget->insert($highlight, $index);	return;}$window->show_all();Gtk::main();?>