=head1 NAME
Browser::Plugin - embed perl into a webbrowser using gtk.
=head1 SYNOPSIS
=head1 DESCRIPTION
sorry...
=over 4
=cut
package Browser::Plugin::Gtk;
use base Browser::Plugin;
use Gtk;
$VERSION = 0.01;
sub mainloop {
my $self = shift;
init Gtk;
input_add Gtk::Gdk (fileno($self->server_fh), 'read', sub {
$self->server_event;
});
main Gtk;
}
sub window_new {
my $self = shift;
my $wi = $_[0];
$self->SUPER::window_new(@_);
my $w = new Gtk::Plug $wi->{id};
if ($w->socket_window) {
$w->add(my $W = new Gtk::HandleBox);
$W->add(my $v = new Gtk::VBox 5,5);
$v->add(my $e = new Gtk::Entry);
$e->set_text("http://www.plan9.de/");
$v->add(my $b = new Gtk::Button "get_url");
signal_connect $b clicked => sub {
print "entry changed to ".($e->get_text)."\n";#d#
};
$w->show_all;
$w->socket_window->set_events([qw(leave_notify_mask structure_mask enter_notify_mask exposure_mask focus_change_mask key_press_mask)]);
signal_connect $e key_press_event => sub {
warn Dumper ({key_press => \@_});
1;
};
use Data::Dumper;
warn Dumper $w->socket_window->get_events;
warn Dumper $w->window->get_events;
return $w;
} else {
return ();
}
}
sub DESTROY {
warn "DESTROY";
}
1;
=back
=head1 BUGS
=head1 SEE ALSO
L.
=head1 AUTHOR
Marc Lehmann
http://www.goof.com/pcg/marc/
=cut