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

NAME

Gtk2::Ex::GraphViz - A Gtk2 wrapper to the GraphViz.pm module.

DESCRIPTION

GraphViz can be used to produce good-looking network graphs. Wrapping with Gtk2 allows those images to respond to events such as mouse-over, clicked etc.

By implementing callbacks to the respective signals, you can create fairly interactive network graphs. For example, when the user double-clicks a node, you can open up a widget that contains information on that node.

SYNOPSIS

        use GraphViz;
        use Gtk2::Ex::GraphViz;
        my $g = GraphViz->new; # First do all the work in GraphViz.pm
        $g->add_node('London', shape => 'box', fillcolor =>'lightblue', style =>'filled',);
        $g->add_node('Paris', label => 'City of\nlurve', );
        $g->add_edge('London' => 'Paris');
        # Now the actual Gtk2::Ex::GraphViz portion takes over
        my $graphviz = Gtk2::Ex::GraphViz->new($g);
        $graphviz->signal_connect ('mouse-enter-node' => 
                sub {
                        my ($self, $x, $y, $nodename) = @_;
                        my $nodetitle = $graphviz->{svgdata}->{g}->{g}->{$nodename}->{title};
                        print "Node : $nodetitle : $x, $y\n";
                }
        );

METHODS

new;

The constructor accepts a GraphViz object as the first argument.

        my $g = GraphViz->new; # First do all the work in GraphViz.pm
        my $graphviz = Gtk2::Ex::GraphViz->new($g);

get_widget;

Returns the widget that can be added to any container and presented in a window.

signal_connect($signal, $callback);

See the SIGNALS section to see the supported signals.

SIGNALS

mouse-enter-node;

mouse-exit-node;

mouse-enter-edge;

mouse-exit-edge;

SEE ALSO

GraphViz

COPYRIGHT & LICENSE

Copyright 2005 Ofey Aikon, All Rights Reserved.

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