#!/usr/bin/perl
use strict;
use warnings;
use Glib qw(TRUE FALSE);
use Gtk2 -init;

my $window = Gtk2::Window -> new();
my $hbox = Gtk2::HBox -> new(FALSE, 0);
my $label = Gtk2::Label -> new("Drag Me");
my $box = Gtk2::EventBox -> new();
my $vbox = Gtk2::VBox -> new(TRUE, 0);

my $target = { target => "STRING", flags => [], info => 23 };

$box -> drag_source_set(qw(button1-mask), "copy", $target);
$box -> signal_connect(drag_data_get => sub { warn @_; });

$box -> add($label);

$vbox -> drag_dest_set(qw(all), "copy", $target);
$vbox -> signal_connect(drag_data_received => sub { warn @_; });

$hbox -> pack_start($box, FALSE, FALSE, 0);
$hbox -> pack_start($vbox, TRUE, TRUE, 0);

$window -> signal_connect(delete_event => sub { Gtk2 -> main_quit(); 0; });
$window -> set_default_size(200, 100);
$window -> add($hbox);
$window -> show_all();

Gtk2 -> main();
