test1.pl
author Peter Gervai <grin@grin.hu>
Thu, 16 Oct 2008 11:09:43 +0200
changeset 0 43c199fb1993
child 1 90185416e8ff
permissions -rwxr-xr-x
glade perl test, first import
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     1
#!/usr/bin/perl -w
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     2
#$Id$
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     3
#
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     4
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     5
use strict;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     6
use warnings;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     7
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     8
use Gtk2 '-init';
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     9
use Gtk2::GladeXML;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    10
use Gtk2::Gdk::Keysyms; # keyboard code constants
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    11
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    12
my $glade;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    13
my $label;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    14
my $field;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    15
my $window_about;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    16
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    17
# load UI
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    18
$glade = Gtk2::GladeXML->new("test1.glade");
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    19
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    20
# connect signals
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    21
$glade->signal_autoconnect_from_package('main');
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    22
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    23
$label = $glade->get_widget('label1');
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    24
$field = $glade->get_widget('yourname_field');
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    25
$window_about = $glade->get_widget('aboutdialog1');
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    26
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    27
Gtk2->main;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    28
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    29
exit 0;
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    30
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    31
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    32
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    33
# Handles window-manager-quit: shuts down gtk2 lib
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    34
sub on_main_delete_event {Gtk2->main_quit;}
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    35
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    36
# Handles close-button quit
43c199fb1993 glade perl test, first import
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    37
sub on_close_button_clicked {on_main_delete_event;}