Gtk2::GladeXML::Simple 0.32 review
DownloadGtk2::GladeXML::Simple is a clean object-oriented interface to Gtk2::GladeXML. SYNOPSIS package MyApp; use base qw( Gtk2
|
|
Gtk2::GladeXML::Simple is a clean object-oriented interface to Gtk2::GladeXML.
SYNOPSIS
package MyApp;
use base qw( Gtk2::GladeXML::Simple );
sub new {
my $class = shift;
my $self = $class->SUPER::new( $gladefile );
return $self;
}
...
# Signal handlers are methods of your class
sub on_button_clicked {
my $self = shift;
# You have access to your widgets directly
# or using $self->get_widget( widget_name )
my $button = $self->{button1};
}
Gtk2::GladeXML::Simple is a module that provides a clean and easy interface for Gnome/Gtk2 and Glade applications using an object-oriented syntax. You just make Gtk2::GladeXML::Simple your application's base class, have your new call SUPER::new, and the module will do the tedious and dirty work for you.
Gtk2::GladeXML::Simple offers:
Signal handler callbacks as methods of your class.
sub on_button1_clicked {
my $self = shift; # $self always received as first parameter
...
# do anything you want in a OO fashioned way
}
Autoconnection of signal handlers.
Autocalling of creation functions for custom widgets.
Access to the widgets as instance attributes.
my $btn = $self->{button1}; # fetch widgets as instance attributes by their names
my $window = $self->{main_window};
my $custom = $self->{custom_widget};
Requirements:
Perl
Gtk2::GladeXML::Simple 0.32 keywords