[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-gtk-general
Subject:    Re: [PHP-GTK] Drag and Drop
From:       Christian Weiske <cweiske () cweiske ! de>
Date:       2004-10-15 17:59:27
Message-ID: 41701081.9040906 () cweiske ! de
[Download RAW message or body]


Hi


I'm currently writing a tutorial about using drag'n'drop from and to 
php-gtk applications. It should be finished sunday evening, but here is 
some sample code.

PS: The doc is currently not really helpful regarding this topic. But 
this will have changed until sunday :)


<?php
if( !extension_loaded('gtk')) {	
	dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}

function dnd_drag_data_received( $widget, $context, $x, $y, $data, 
$info, $time)
{
     var_dump( $data->data);
}

$window = &new GtkWindow();
$window->set_default_size(100, 100);
$window->connect_object('destroy', array('gtk', 'main_quit'));

$button = &new GtkButton('To');
$window->add($button);
$button->show();
$button->realize();
$button->connect('drag-data-received', 'dnd_drag_data_received');

$targets = array( array( 'text/uri-list', 0, -1));

$button->drag_dest_set(GTK_DEST_DEFAULT_ALL, $targets, GDK_ACTION_COPY | 
GDK_ACTION_MOVE);

$window->realize();
$window->show();

gtk::main();
?>

Regards/MfG,
Christian Weiske
-- 
XMMS is playing now:
Sylver - Secrets

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic