|$gladexml = Gtk2::GladeXML->new(GLADE_FILE, [ROOT, DOMAIN])||Create a new GladeXML object by loading the data in GLADE_FILE. ROOT is an optional parameter that specifies a point (widget node) from which to start building. DOMAIN is an optional parameter that specifies the translation domain for the xml file.|
|$gladexml = Gtk2::GladeXML->new_from_buffer(BUFFER, [ROOT, DOMAIN])||Create a new GladeXML object from the scalar string contained in BUFFER. ROOT is an optional parameter that specifies a point (widget node) from which to start building. DOMAIN is an optional parameter that specifies the translation domain for the xml file.|
|$widget = $gladexml->get_widget(NAME)||Return the widget created by the XML file with NAME or undef if no such name exists.|
Iterates over all signals and calls the given callback:
The following two convenience methods use this to provide a more convenient interface.
|$gladexml->signal_autoconnect_from_package([PACKAGE or OBJECT])||
Sets up the signal handling callbacks as specified in the glade XML data.
The argument to this method can be a Perl package name or an object. If a package name is used, each handler named in the Glade XML data will be called as a subroutine in the named package. If an object is supplied each handler will be called as a method of the object. If no argument is supplied, the name of the calling package will be used. A user data argument cannot be supplied however this is seldom necessary when an object is used.
The names of the subroutines or methods must exactly match the handler name in the XML data. It is worth noting that callbacks you get for free in c such as gtk_main_quit will not exist in perl and must always be defined, for example:
Otherwise behavior should be exactly as expected with the use of libglade from a C application.
|$gladexml->signal_autoconnect_all (name => handler, ...)||Iterates over all named signals and tries to connect them to the handlers specified as arguments (handlers not given as argument are being ignored). This is very handy when implementing your own widgets, where you cant use global callbacks.|
|$widget = Gtk2::Glade->set_custom_handler ($callback[, $userdata])||
This method tells Gtk2::GladeXML how to create handlers for custom widgets.
You can specify a custom widget in a glade file, which allows you to include in your interface widgets that Glade itself doesnt know how to create. To tell libglade how to instantiate such widgets, you specify a custom widget handler, a function which returns a Gtk2:Widget object for that custom widget. This handler needs to be installed sometime before the instantiation of your Gtk2::GladeXML object, by calling set_custom_handler.
The prototype for the custom handler is:
Where is the option to generate Perl source in Glade? Glade itself only creates the XML description, and relies on extra converter programs to write source code; only a few converters are widely popular.
In general, however, you dont want to generate source code for a variety of reasons, mostly to do with maintainability. This message on the glade-devel list explains it best:
Why does my program crash on startup? Does your glade file use Gnome widgets? If so, you must initialize Gnome manually; libglade can knows how to create gnome widgets, but cant know how you want to initialize the app. This is usually sufficient:
Libglades API reference mentions this: http://developer.gnome.org/doc/API/2.0/libglade/libglade-modules.html
perl(1), Glib(3pm), Gtk2(3pm)
The Libglade Reference Manual at <http://developer.gnome.org/doc/API/2.0/libglade/>
An introductory article that originally appeared in The Perl Review: <http://live.gnome.org/GTK2-Perl/GladeXML/Tutorial>
Ross McFarland <rwmcfa1 at neces dot com>, Marc Lehmann <email@example.com>, muppet <scott at asofyet dot org>. Bruce Alderson provided several examples. Grant McClean <grant at mclean dot net dot nz> and Marco Antonio Manzo <amnesiac at perl dot org dot mx> contributed documentation.
Copyright 2003-2006 by the gtk2-perl team.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA.
|perl v5.20.3||GLADEXML (3)||2008-09-07|