{ my $palette = Gtk2::ToolPalette->new; my $group = Gtk2::ToolItemGroup->new ('Test'); my $item = Gtk2::ToolItem->new; my $child = Gtk2::Label->new ('TestTest'); $item->add ($child); $group->insert ($item, 0); $palette->add ($group);
my $button = Gtk2::Button->new ('Test'); $palette->add_drag_dest ($button, 'all', 'groups', 'copy');
$button->signal_connect (drag_data_received => sub { my ($button, $context, $x, $y, $selection, $info, $time, $data) = @_; my $palette = $context->get_source_widget->get_ancestor ('Gtk2::ToolPalette'); my $group = $palette->get_drag_item ($selection); isa_ok ($group, 'Gtk2::ToolItemGroup'); });
my $window = Gtk2::Window->new; my $vbox = Gtk2::VBox->new; $vbox->add ($palette); $vbox->add ($button); $window->add ($vbox); $window->set_default_size (50, 100); $window->show_all;
isa_ok ($palette->get_drop_group (10, 10), 'Gtk2::ToolItemGroup'); isa_ok ($palette->get_drop_item (10, 30), 'Gtk2::ToolItem');
Gtk2->main; }
1 POD Error
The following errors were encountered while parsing the POD:
Unknown directive: =comment
To install Gtk2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gtk2
CPAN shell
perl -MCPAN -e shell install Gtk2
For more information on module installation, please visit the detailed CPAN module installation guide.