1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
use strict;
use Gtk2 '-init';
use Glib qw/TRUE FALSE/;
use utf8;
use encoding 'utf8';
##################################Création de la fenetre principale##################################
my $window = Gtk2::Window->new('toplevel');
$window->set_title('Modelisation Statistique De Langage /Master Rim LAATAR 2013/');
$window->signal_connect('delete_event' => sub { Gtk2->main_quit; });
$window->set_border_width(5);
$window->modify_bg('normal',$greyl);
$window->set_size_request(800,550);
$window->set_position('center');
$window->show();
######################################################################################################
##################################Création de la barre d'outil########################################
my $vbox = Gtk2::VBox->new(FALSE,5);
$window->add($vbox);
#====================================
#The handle box helps in creating a detachable toolbar
my $hb = Gtk2::HandleBox->new;
#create a toolbar, and do some initial settings
my $toolbar = Gtk2::Toolbar->new;
$toolbar->set_icon_size ('large-toolbar');
$toolbar->set_show_arrow (FALSE);
#________
#Create a menu tool button that contains a simple menu.
my $t_mbtn_edit = Gtk2::MenuToolButton->new_from_stock('gtk-edit');
$t_mbtn_edit->set_label ('Fichier');
$t_mbtn_edit->set_menu (&ret_menu_1);
$toolbar->insert($t_mbtn_edit,-1);
$toolbar->set_style('text');
############################création de la zone de saisie############################################
set_style();
my $textbuffer = Gtk2::TextBuffer->new();
$textbuffer->set_text("\n");
# Create a textview using that textbuffer
my $textview = Gtk2::TextView->new_with_buffer($textbuffer);
# Add the textview to a scrolledwindow
my $scrolledwindow = Gtk2::ScrolledWindow->new( undef, undef );
$scrolledwindow->set_size_request (300, 300);
$scrolledwindow->set_border_width(8);
$scrolledwindow->add($textview);
$vbox->pack_start($scrolledwindow, 1, 1, 0 );
my $end_mark = $textbuffer->create_mark( 'end', $textbuffer->get_end_iter, FALSE );
# every time we insert text, scroll to that mark.
$textbuffer->signal_connect(
insert_text => sub {
$textview->scroll_to_mark( $end_mark, 0.0, TRUE, 0.0, 1.0 );
}
);
######################################################################################################
$window->show_all;
$vbox->show_all();
Gtk2->main();
######################################################################################################
sub ret_menu_1 {
my $menu_edit = Gtk2::Menu->new();
$menu_edit->append(Gtk2::MenuItem->new('Ouvrir'));
$menu_edit->append(Gtk2::MenuItem->new('Enregistrer'));
$menu_edit->append(Gtk2::MenuItem->new('Quitter'));
$menu_edit->show_all();
return $menu_edit;
} |
Partager