sub _init{
my($ventana, $imagen, $footer, $opciones, $togglebutton1, $togglebutton2, $vbox);
$ventana = Gtk2::Window->new('toplevel');
$ventana->set_border_width(20);
$ventana->set_title('Generador automático de resúmenes');
$imagen = Gtk2::Image->new_from_file("informatica.jpg");
$footer = Gtk2::Label->new( 'Choose language/ Elija idioma' );
#Boton de cancelar
my $hbox2 = Gtk2::HBox->new(0, 5);
$hbox2->set_border_width(1);
my $boton_cancelar = Gtk2::Button->new_from_stock('gtk-cancel');
$boton_cancelar->signal_connect('clicked' => sub {Gtk2->main_quit; });
$boton_cancelar->set_size_request(100, 30);
#Boton de ayuda
my $boton_ayuda = Gtk2::Button->new_from_stock('gtk-help');
$boton_ayuda->signal_connect('clicked' => sub { &ayuda_idioma()});
$boton_ayuda->set_size_request(100, 30);
$hbox2->pack_start($boton_ayuda, FALSE, FALSE, 2);
$hbox2->pack_start($boton_cancelar, FALSE, FALSE, 2);
sub ayuda_idioma{
my $about = Gtk2::Dialog->new( 'Ayuda/Help', undef, 'modal',
'Atrás' => 'ok' );
my $text =<<INFO;
Tiene usted que elegir el idioma en el que desea realizar la búsqueda.
You have to choose the language in which you want to make the search.
INFO
# Podemos observar como un objeto Gtk2::Dialog contiene un vbox internamente
# para poder empaquetarle otros items.
my $imagen = Gtk2::Image->new_from_file("ayuda2.png");
$about->vbox->pack_start( $imagen, FALSE, FALSE, 4 );
$about->vbox->pack_start( Gtk2::Label->new( $text ), FALSE, FALSE, 4 );
$about->vbox->show_all;
# Simplemente, presionamos el botón y cerramos la ventana.
$about->destroy if $about->run;
return TRUE;
}
#$opciones=&create_option_bar();
my $hbox3 = Gtk2::HBox->new( FALSE, 0 );
$togglebutton1 = Gtk2::ToggleButton->new_with_label('Castellano');
$togglebutton2 = Gtk2::ToggleButton->new_with_label('English');
$togglebutton1->set_size_request(100, 30);
$togglebutton2->set_size_request(100, 30);
$togglebutton1->signal_connect('clicked' => sub { &abrir_castellano() });
$togglebutton2->signal_connect('clicked' => sub { &abrir_ingles() });
$hbox3->pack_start( $togglebutton1, FALSE, FALSE, 3 );
$hbox3->pack_start( $togglebutton2, FALSE, FALSE, 3 );
my $separador = Gtk2::HSeparator->new();
$separador->set_size_request(400, 30);
$vbox = Gtk2::VBox->new( FALSE, 0 );
$vbox->pack_start( $footer, FALSE, FALSE, 3 );
$vbox->pack_start( Gtk2::HSeparator->new, FALSE, FALSE, 3 );
$vbox->pack_start( $imagen, FALSE, FALSE, 3 );
$vbox->pack_start( $hbox3, FALSE, FALSE, 3 );
$vbox->pack_start( $separador, FALSE, FALSE, 3 );
$vbox->pack_end( $hbox2, FALSE, FALSE, 3 );
$ventana->add($vbox);
$ventana->set_position('center');
$ventana->show_all;
return;
}
_init;
Gtk2->main;
sub abrir_ingles{
my $ventana = Gtk2::Window->new('toplevel');
$ventana->set_border_width(20);
$ventana->set_title('Interface 2');
my $imagen = Gtk2::Image->new_from_file("informatica.jpg");
my $footer = Gtk2::Label->new( 'Choose kind of summary' );
#Boton de cancelar
my $hbox2 = Gtk2::HBox->new(0, 0);
$hbox2->set_border_width(5);
my $boton_cancelar = Gtk2::Button->new_from_stock('gtk-cancel');
$boton_cancelar->signal_connect('clicked' => sub {Gtk2->main_quit; });
#Boton de ayuda
my $boton_ayuda = Gtk2::Button->new_from_stock('gtk-help');
$boton_ayuda->signal_connect( 'clicked' => \&about_this_ingles);
$boton_ayuda->set_size_request(100, 30);
$boton_cancelar->set_size_request(100, 30);
$hbox2->pack_start($boton_ayuda, FALSE, FALSE, 2);
$hbox2->pack_start($boton_cancelar, FALSE, FALSE, 2);
#$opciones=&create_option_bar();
my $togglebutton1 = Gtk2::ToggleButton->new_with_label('Free summary');
my $togglebutton2 = Gtk2::ToggleButton->new_with_label('Most important paragraph');
my $togglebutton3 = Gtk2::ToggleButton->new_with_label('10 lines');
$togglebutton1->signal_connect('clicked' => sub { &abrir_resumen_libre_ingles() });
$togglebutton2->signal_connect('clicked' => sub { &abrir_parrafo_mas_ingles() });
$togglebutton3->signal_connect('clicked' => sub { &abrir_10_lineas_ingles()});
my $vbox1 = Gtk2::VBox->new( FALSE, 0 );
$vbox1->pack_start( $togglebutton1, FALSE, FALSE, 3 );
$vbox1->pack_start( $togglebutton2, FALSE, FALSE, 3 );
$vbox1->pack_start( $togglebutton3, FALSE, FALSE, 3 );
my $separador = Gtk2::HSeparator->new();
$separador->set_size_request(400, 30);
my $vbox = Gtk2::VBox->new( FALSE, 0 );
$vbox->pack_start( $footer, FALSE, FALSE, 3 );
$vbox->pack_start( Gtk2::HSeparator->new, FALSE, FALSE, 3 );
$vbox->pack_start( $imagen, FALSE, FALSE, 3 );
$vbox->pack_start( $vbox1, FALSE, FALSE, 3 );
$vbox->pack_start( $separador, FALSE, FALSE, 3 );
$vbox->pack_start( $hbox2, FALSE, FALSE, 3 );
$ventana->add($vbox);
$ventana->set_position('center');
$ventana->show_all;
return;
}