NAME
Gtk2::GladeXML::OO - Drop-in replacement for Gtk2::GladeXML with object oriented interface to Glade.
SYNOPSIS
use Gtk2::GladeXML::OO;
# exactly as in Gtk2::GladeXML
our $gladexml = Gtk2::GladeXML::OO->new('glade/example.glade');
$gladexml->signal_autoconnect_from_package('main');
$gladexml->load_objects(qw/GUI_/); # insert GUI objects to namespace
$gladexml->debug(2);
$::GUI_window->show; # method "show" of widget with name "GUI_window"
sub gtk_main_quit { Gtk2->main_quit; }
# Object _MUST_ be declared as "our"
our $myobject = MyObject->new();
Gtk2->main;
# ...and now callbacks in Glade can be:
#
# myobject->method <- Gtk2 will pass standard parameters to Your method
# myobject->method() <- without any parameters, ie. window->hide()
# myobject->method("param0", "param1") <- with Your parameters
# myobject->get_it()->do_sth("par0", "par1") <- multilevel call to Your object
# tree_view->get_selection->select_all() <- multilevel call to Glade object!!
#
# gtk_main_quit <- standard function interface, like before
# See example.glade and example.pl in example directory!
DESCRIPTION
This module provides a clean and easy object-oriented interface in Glade callbacks (automagicaly loads objects and do all dirty work for you, no action is required on your part). Now You can use in callbacks: widgets, Your objects or standard functions like before. Callbacks can be even multilevel!
Gtk2::GladeXML::OO is a drop-in replacement for Gtk2::GladeXML, so after a change from Gtk2::GladeXML to Gtk2::GladeXML::OO all Your applications will work fine and will have new functionality.
AUTOLOAD
If You are using AUTOLOAD subroutine in main package, Gtk2::GladeXML::OO module will invoke it, when it cound'nt find any matching object in Glade file and Your code.
SUBROUTINES/METHODS
- new('/path/to/file.glade')
-
This method should be called exactly as
new
in Gtk2::GladeXML. In example:# Gtk2::GladeXML::OO object our $gladexml = Gtk2::GladeXML::OO->new('glade/example.glade');
- debug
-
This method turns on/off debug. Three levels are acceptable.
0 => turns OFF debug 1 => turns ON debug (only important information/warnings), DEFAULT 2 => turns ON debug in verbose mode, use this when You are in a trouble
In example:
# tunrs OFF debug $gladexml->debug(0); ...some code... # tunrs ON debug $gladexml->debug(1); ...some code... # turns ON debug in verbose mode $gledexml->debug(2);
- load_objects(qr/regexp/)
-
This method loads to "main::" namespace all objects corresponding to widgets with names compatible with
regexp
. Defaultregexp
is set toqr/^[A-Z]/
. - For all other methods see
Gtk2::GladeXML
!
DEPENDENCIES
INCOMPATIBILITIES
None known. You can even use AUTOLOAD in Your application and all modules.
BUGS AND LIMITATIONS
Limitation (will be resolved in a future): For now Your objects are loaded only from main package.
AUTHOR
Strzelecki Łukasz <lukasz@strzeleccy.eu>
LICENCE AND COPYRIGHT
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 315:
Non-ASCII character seen before =encoding in 'Łukasz'. Assuming UTF-8