The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gtk2::GladeXML - Perl wrappers for the Gtk2::GladeXML utilities.

SYNOPSIS

  use Gtk2 -init;
  use Gtk2::GladeXML;
  
  $gladxml = Gtk2::GladeXML->new('example.glade');
  $gladexml->signal_autoconnect_from_package('main');
  $quitbtn = $gladexml->get_widget('Quit'); 
  Gtk2->main;

ABSTRACT

Provides mechinisms for instantiating and utilization of user interfaces created with glade-2.

DESCRIPTION

Glade is open source project that provides utilities for rapid user interface development. After designing an application with glade-2 the layout and configuration is saved in a XML formatted file. libglade is a library to load and use files of this particular XML format at application run time. This module is a set of mappings of libglade. More specifically the gladexml portion of libglade. These mappings allow access to libglade from PERL code. Better yet you can load a file's contents into a PERL scalar do a few magical regular expressions to customize things and the load up the app. It doesn't get any easier.

FUNCTIONS

$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.

$gladexml->get_widget(NAME)

Return the widget created by the XML file with NAME or undef if no such name exists.

$gladexml->signal_autoconnect($callback[, $userdata])

Iterates over all signals and calls the given callback:

   sub example_cb {
      my ($name, $widget, $signal, $signal_data, $connect, $after, $userdata) = @_;
   }

The following two convinience methods use this to provide a more convinient interface.

$gladexml->signal_autoconnect_from_package([PACKAGE])

Sets up the signal handling callbacks as specified in the glade XML data. Callbacks will need to have the exact name as specified in the XML data and be located in the provided package (or the callers package if none is provided.) 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:

  sub gtk_main_quit
  {
        Gtk2->main_quit;
  }

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 can't use global callbacks.

SEE ALSO

perl(1), Glib(1), Gtk2(1), libglade.

AUTHOR

Ross McFarland <rwmcfa1 at neces dot com>, Marc Lehmann <pcg@goof.com>.

COPYRIGHT AND LICENSE

Copyright 2003 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.